假設我有在C#中的一些代表:C#委託:字面構造
public delegate void ExampleDelegate();
和地方我有SampleMethod,我想委託引用:
ExampleDelegate sample = new ExampleDelegate(SampleMethod);
我見過一些人做在2行,而不是這樣的:
ExampleDelegate sample;
sample = SampleMethod;
這是像上面的行功能相同或是有一些(意外的)副作用正在進行?基本上,我不明白之間的差別:
ExampleDelegate sample = new ExampleDelegate(SampleMethod);
和
ExampleDelegate sample; = SampleMethod;
他們似乎工作的同..
查找_method組conversion_ – chomba