public static int ReflectAPI(object obj)
{
try
{
System.Reflection.PropertyInfo[] propertyInfo = obj.GetType().GetProperties();
string strOutput;
strOutput = "\n The object is of type: " + obj.GetType().ToString() + " has the following reflected property info: ";
for (int i = 0; i < propertyInfo.Length; i++)
{
string name = propertyInfo[i].Name;
string s;
try
{
s = obj.GetType().InvokeMember(name, System.Reflection.BindingFlags.GetProperty, null, obj, null).ToString();
strOutput += "\n " + name + ": " + s + " IsSpecialName == " + propertyInfo[i].IsSpecialName.ToString();
}
catch (System.Exception invokeMemberException)
{
strOutput += "\n" + name + ": EXCEPTION: " + invokeMemberException.Message;
}
}
System.Diagnostics.Debug.Write(strOutput);
}
catch (Exception e)
{
MessageBox.Show("Exception occurred: " + e.Message);
}
return 1;
}