public object Deserialize() { Type listType = typeof(List <>).MakeGenericType(Type.GetType(JmxTypeMapping.GetCLRTypeName(leafType))); object results = Activator.CreateInstance(listType); foreach (GenericValueType valueType in Value) { listType.GetMethod("Add").Invoke(results, new[] { valueType.Deserialize() }); } return(results); }
public object Deserialize() { Type dictType = typeof(Dictionary <,>).MakeGenericType( Type.GetType(JmxTypeMapping.GetCLRTypeName(keyType)), Type.GetType(JmxTypeMapping.GetCLRTypeName(valueType))); object results = Activator.CreateInstance(dictType); foreach (MapTypeEntry entry in Entry) { dictType.GetMethod("Add").Invoke(results, new[] { entry.Key.Deserialize(), entry.Value.Deserialize() }); } return(results); }