string myClass =" public class AcademicTestQuestion { public int Id { get; set; } public string Content { get; set; } public int ContentType { get; set; } public string Descrtionption { get; set; } public bool IsMandatory { get; set; } public bool IsMultiChoice { get; set; } public DateTime InsertDate { get; set; } public DateTime? UpdateDate { get; set; } public bool IsActive { get; set; } public int AcademicTestPageId { get; set; } } ";
格式低于
的可读性 string myClass ="
public class AcademicTestQuestion
{
public int Id { get; set; }
public string Content { get; set; }
public int ContentType { get; set; }
public string Descrtionption { get; set; }
public bool IsMandatory { get; set; }
public bool IsMultiChoice { get; set; }
public DateTime InsertDate { get; set; }
public DateTime? UpdateDate { get; set; }
public bool IsActive { get; set; }
public int AcademicTestPageId { get; set; }
}
";
如何在运行时创建上述字符串表示形式的实例并使用?
我正在尝试在运行时生成表结构。
答案 0 :(得分:1)
除非安装了C#SDK,否则不能在运行时执行此操作。
这有点棘手,因为作为开发人员,您通常会安装C#SDK,所以对您来说它似乎有效,但如果您将应用程序部署到用户,用户通常只会拥有DotNet安装了运行时环境,但没有安装SDK,所以它不适用于它们。
如果你坚持这样做,请从这里开始阅读: