Get class by string value

前端 未结 5 916
感动是毒
感动是毒 2021-02-18 14:11

I have an abstract class with a few derived class

public abstract class MyObject
{
    public string name { get; set; }
    public bool IsObject(string pattern);         


        
5条回答
  •  北荒
    北荒 (楼主)
    2021-02-18 15:04

    You can use Reflection or System.Activator.CreateInstance to create an instance based on the Type or TypeName as string.

提交回复
热议问题