Reputation: 35522
// This method never gets called
public void DoSomethingWithByte(byte b)
{
Writeline(b);
}
class Test<T>
{
public Test(Action<T> act, T data)
{
Dispatcher.Current.BeginInvoke(act, data);
}
}
void TestAll()
{
new Test<Byte>(DoSomethingWithByte, 6);
}
this does not work, why?
It compiles, gets to the line, but does not call the method
Why is this happening?
Upvotes: 0
Views: 101
Reputation: 6444
Act doesn't have a method to call, it is null.
Action<byte> act = ((byte b) DoSomethingwithByte(b));
Then have your method.
public void DoSomethingWithByte(byte b) {}
Upvotes: 1