Re: how to wrap your brain around delegates?



"Peter Morris [Droopy eyes software]" <pete@xxxxxxxxxxxxxxxxxxxxxx> a écrit
dans le message de news: 44900b2f@xxxxxxxxxxxxxxxxxxxxxxxxx

| I'm experiencing one of those "Nah, I don't get it" scenarios :-)

Basically :

public class Base
{
protected Dictionary<string, EventHandler> events = new Dictionary<string,
EventHandler>();

}

public class Derived : Base
{
public void OnClick()
{
if (events.ContainsKey("Click"))
{
EventArgs args = EventArgs.Empty;
events["Click"](args);
}
}
}

I know this is not exact, but does it give you the idea ?

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer


.



Relevant Pages

  • Reflection on partially overriden property?
    ... public class Derived: Base ...
    (microsoft.public.dotnet.framework)
  • Calling parent class?
    ... I have a question on calling parent class... ... public class Derived: Base ... public override void SomeMethod() { ...
    (microsoft.public.dotnet.languages.csharp)
  • Calling parent class?
    ... I have a question on calling parent class... ... public class Derived: Base ... public override void SomeMethod() { ...
    (microsoft.public.dotnet.framework.aspnet)
  • What will be the constructor flow of control
    ... hard time understanding how C# can allow initialization of member variables ... public class D1: Base { ...
    (microsoft.public.dotnet.languages.csharp)