C#: How can I create a class dynamically from text?

The following code is a really simple way to create a class dynamically from string.

 dynamic data = new ExpandoObject();

IDictionary<string, object> dictionary = (IDictionary<string, object>)data;
dictionary.Add("FirstName", "Richard");
dictionary.Add("Surname", "Leeman");

Console.WriteLine(data.FirstName + " " + data.Surame);

Comments

Popular posts from this blog

SharePoint 2013: Error updating managed account credentials

How can I call a JIRA api through Powershell?