public class EntitySearchCollection
{
public IList<EntitySearchItem> Items { get; set; } // each item is a simple list of key-value pairs
}
public class EntitySearchItem : Dictionary<string, object>
{
public T GetValue<T>(string key)
{
if (base[key] != null)
{
var t = typeof(T);
t = Nullable.GetUnderlyingType(t) ?? t;
return (T)Convert.ChangeType(base[key], t);
}
return default(T);
}
}
{
public IList<EntitySearchItem> Items { get; set; } // each item is a simple list of key-value pairs
}
public class EntitySearchItem : Dictionary<string, object>
{
public T GetValue<T>(string key)
{
if (base[key] != null)
{
var t = typeof(T);
t = Nullable.GetUnderlyingType(t) ?? t;
return (T)Convert.ChangeType(base[key], t);
}
return default(T);
}
}