有点长,但typeof(Dictionary<string, Dictionary<Guid, DateTime>>).FullName 是:
System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Collections.Generic.Dictionary`2[[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
typeof() 运算符返回一个RuntimeType,它是一个 .NET 类。所以FullName 是一种.NET 类型的属性,所以它是官方的:-)
如果您尝试执行Type.GetType(thatstring),您将获得正确的类型:-)
可以通过typeof(Dictionary<string, Dictionary<Guid, DateTime>>).ToString() 获得更紧凑的版本,没有程序集短名称。这也可以与Type.GetType(...)一起使用
System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic.Dictionary`2[System.Guid,System.DateTime]]
请注意,Type.GetType 存在以下格式的限制:
要获取的类型的程序集限定名称。请参阅 AssemblyQualifiedName。 如果类型在当前执行的程序集中或在 Mscorlib.dll 中,则提供由其命名空间限定的类型名称就足够了。
如果你有兴趣,这里有完整格式: AssemblyQualifiedName