【发布时间】:2020-02-23 09:40:17
【问题描述】:
我可以通过以下方式获取List<T>、Dictinary<TK, TVal>等的类型信息:
Type.GetType("System.Collections.Generic.List`1[System.String]")
Type.GetType("System.Collections.Generic.Dictionary`2[System.String,System.String[]]")
但是无法获取LinkedList<T>的类型信息:
Type.GetType("System.Collections.Generic.LinkedList`1[System.String]") // Returns NULL
Type.GetType("System.Collections.Generic.LinkedList`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]") // Also returns NULL
检查LinkedList<string>的组装
typeof(LinkedList<decimal>).Assembly
给予:
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
使用 .NET 标准 2.0.3。
【问题讨论】:
标签: c# .net reflection