dimanche 23 février 2020

Can not get Type of LinkedList`T with Type.GetType(string)

I am able to get type information of List<T>, Dictinary<TK, TVal> etc. by:

Type.GetType("System.Collections.Generic.List`1[System.String]")
Type.GetType("System.Collections.Generic.Dictionary`2[System.String,System.String[]]")

But failing to get type information of 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

Inspecting the assembly of LinkedList<string>

typeof(LinkedList<decimal>).Assembly

Gives:

System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Using .NET Standart 2.0.3.





Aucun commentaire:

Enregistrer un commentaire