小编Hua*_* Fu的帖子

如何通过类名获取类类型?

namespace Myspace
{
    public class MyClass
    {
    }
} //This class is in another file.

using Myspace;
static void Main(string[] args)
{
    Regex regexViewModelKey = new Regex(RegularExpr.ViewModelKeyPattern);
    string viewModel = regexViewModelKey.Match(match.Value).Value;
    //Now, vieModel is a string, and its value is "MyClass". So, I only know the class name, this is why I ask this question.

    //Now, I'm only allowed to use the string form of this class name to get its type.
    //I have tyied like this, but its no …
Run Code Online (Sandbox Code Playgroud)

c# reflection gettype

17
推荐指数
2
解决办法
4万
查看次数

标签 统计

c# ×1

gettype ×1

reflection ×1