C# 查找所有Func委托
为什么C# 查找所有Func委托,c#,.net,reflection,delegates,func,C#,.net,Reflection,Delegates,Func,为什么 返回9。但事实上有17个。答案很有趣 Func到Func在mscorlib程序集中 Func到Func在System.Core程序集中 检查: var funcDelegatesCount = Assembly.Load("mscorlib") .GetTypes() .Count(t => t.Name.StartsWith("Func`") && t.BaseType ==
返回9。但事实上有17个。答案很有趣 Func到Func在mscorlib程序集中 Func到Func在System.Core程序集中 检查:
var funcDelegatesCount = Assembly.Load("mscorlib")
.GetTypes()
.Count(t =>
t.Name.StartsWith("Func`")
&& t.BaseType == typeof(MulticastDelegate));
Console.WriteLine("{0} != {1}",
typeof(Func<,,,,,,,,>).Assembly, typeof(Func<,,,,,,,,,>).Assembly);