Sometimes I can't understand the simplest things, i'm sure it's in my face, i just fail to see it. Im trying to create a delegate for a method in this simple class:
public static class BalloonTip
{
public static BalloonType BalType
{
get;
set;
}
public static void ShowBalloon(string message, BalloonType bType)
{
// notify user
}
}
Now, this Action<> is supposed to create the delegate without actually declaring one with the keyword "delegate", did I understand correctly? Then:
private void NotifyUser(string message, BalloonTip.BalloonType ballType)
{
Action<string, BalloonTip.BalloonType> act;
act((message, ballType) => BalloonTip.ShowBalloon(message, ballType));
}
This fails to compile. Why?
(By the way, the reason why I need this delegate instead of directly calling ShowBalloon(), is that the calls must be made from another thread than the UI one, so I figured I need the Action<>)
Thanks,