【问题标题】:Find all Func delegates查找所有 Func 代表
【发布时间】:2014-09-17 03:19:42
【问题描述】:

为什么

var funcDelegatesCount = Assembly.Load("mscorlib")
        .GetTypes()
        .Count(t => 
               t.Name.StartsWith("Func`") 
            && t.BaseType == typeof(MulticastDelegate));

返回 9。但实际上有 17 个。

【问题讨论】:

    标签: c# .net reflection delegates func


    【解决方案1】:

    嗯。答案很有趣。

    • Func<>Func<,,,,,,,,>mscorlib 程序集中。

    • Func<,,,,,,,,>Func<,,,,,,,,,,,,,,,,>System.Core 程序集中。

    检查:

    Console.WriteLine("{0} != {1}",
        typeof(Func<,,,,,,,,>).Assembly, typeof(Func<,,,,,,,,,>).Assembly);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-21
      • 1970-01-01
      • 2021-10-16
      • 2010-09-27
      • 1970-01-01
      • 2021-03-21
      相关资源
      最近更新 更多