using System.Collections.Generic;
private static Dictionary<string, object> _values = new Dictionary<string, object>
{ "property1", "MyValue" },
public static void Main()
var typedObject = Create<MyType>(_values);
Console.WriteLine("Property1:" + typedObject.Property1);
Console.WriteLine("Property2:" + typedObject.Property2);
Console.WriteLine("Property3:" + typedObject.Property3);
public static TType Create<TType>(Dictionary<string, object> dictionary) where TType : new()
var type = typeof(TType);
var properties = type.GetProperties();
var dictionaryKeys = _values.Keys;
foreach(var prop in properties)
var propName = prop.Name.ToLower();
var propType = prop.PropertyType;
var dictionaryValue = _values[propName];
if(dictionaryValue != null && propType == dictionaryValue.GetType())
prop.SetValue(obj, dictionaryValue);
public string Property1 {get;set;}
public int Property2 {get;set;}
public bool Property3 {get;set;}