public static object AttemptStructDeserialization(XmlRpcStruct response, Type output)
{
MemberInfo[] outputMembers = output.GetMembers ();
object result = Activator.CreateInstance (output);
PropertyInfo[] properties = output.GetProperties ();
foreach (PropertyInfo property in properties) {
//Console.WriteLine (property.Name);
if (response.ContainsKey (property.Name)) {
//Console.WriteLine("Declaring type:{0}, output type:{1}", property.PropertyType, response[property.Name].GetType());
if (Type.Equals (property.PropertyType, response[property.Name].GetType ())) {
//Console.WriteLine ("Identical Type! Woot! Value is " + response[property.Name]);
property.SetValue (result, response[property.Name], null);
}
}
}
return result;
}