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; } } ";
for readability formatted below
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; }
}
";
How can i create a instance of above string representation of class at run time and use?
I'm trying to generating the table structure in to classes at run time.
@
in front of the string, but that does not invalidate the question.object
instances. You can use reflection (ordynamic
) to access properties on it, but you can't elsewhere declare a variable of typeAcademicTestQuestion
. Additionally, to actually compile this takes a bit of work so I would urge you to explain more so that we're sure you really need to bark up this tree.