Beeper is a member function of Singer (the class)... Calling it like Beeper alone will only work when you are in the context of Singer (from other members for instance).
If you are out of that context you have to tell the compiler the new/actual context... in your case cacophony...
So the code should be like this:
Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.
You really need to understand the basics of c# before you try anything half-way complicated. We can't solve every basic problem you have. Get a book on c# and learn the fundamentals so you can solve these issues yourself, a forum is not a good place to learn something from scratch.
Yes, what you are creating here is a delegate, not an immediate call to the beeper method. You need to spend more time reading the links you have been given to understand how delegates are used. See the tutorials on Events and Delegates at C# Tutorials (C#)[^].
While I'm generally in favor of Controls letting the user do anything ... and, then, pay the price for doing something stupid, I'm just curious if the WPF and ASP.NET Controls allow the same.
I have a bright student who keeps asking me why they can create multiple nodes whose text (what appears on the Node Label) is identical; I tell them: "you think that's crazy: how about an entire TreeView where every Node has both identical Text and Name (Key) values ?" Then, I show them how to create a sub-classed TreeView that prevents identical Text, or Name (Key) values.
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
I have a bright student who keeps asking me why they can create multiple nodes whose text (what appears on the Node Label) is identical
..because that would be a limitation that does not bring us much in return, but it would be easy to prevent loading duplicates yourself.
I agree that the user should be able to uniquely identify an item before interacting with it; a identity-column should not be visible and is not enough for a user to distinguish between items - so, how do you convey that there are three fields in your view that make an item unique?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]