How can I get generic Type from a string representation?

前端 未结 5 744
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 00:42

I have MyClass.

And then I have this string s = \"MyClass\";. How can I get Type from the string s

5条回答
  •  青春惊慌失措
    2020-11-30 01:37

    I don't have much time to parse through this, though I think I have seen some similar answers. In particular, I think they are doing exactly what you want to do here:

    Entity Framework Generic Repository Error

    (String.Format("[{0}]", baseType.Name.ToString())).OfType();
    

    Hopefully this helps, let me know more specifically if this isn't.

提交回复
热议问题