Type.FullName is not returning correct name for generic dictionary
tosandeepgarg opened this issue · comments
Type.FullName returns generic arguments without separator.
In next test case instead of return type name System.Collections.Generic.Dictionary2[[A, CreateTypeFromName.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null],[B, CreateTypeFromName.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
it returns
System.Collections.Generic.Dictionary2[[A, CreateTypeFromName.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null][B, CreateTypeFromName.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
Here is test case:
using System;
using System.Collections.Generic;
public static class Program
{
public static void Main(string[] args)
{
var dictionary = new Dictionary<A,B>();
var dictionaryType = dictionary.GetType();
Type type = Type.GetType(dictionaryType.FullName);
if (type != null)
Activator.CreateInstance(type);
Console.WriteLine(
"{0},{1}", dictionaryType.Name,dictionaryType.FullName
);
}
}
public class A { }
public class B { }