Reflection and Trying to Figure Out What is Exposed

Updated to clean up formatting of code

So, I was struggling to find the property in the ListViewItem to get the contents of a particular column.

Queue Reflection.

I wrote a quick little function which will iterate through an object and display a message box with the methods and properties that object has.

import System.Reflection;

public function displayMemeberInfo(objCurr: Object)
{
 try
 {
  if(null != objCurr)
  {
   var myMemberInfo : MemberInfo[]; var myType, str;
   myType = objCurr.GetType();
   myMemberInfo = myType.GetMembers();
   if(null != myMemberInfo)
   {
    for(var i = 0; i < myMemberInfo.length; i++)
    {
str += myMemberInfo[i].Name + ": " + myMemberInfo[i].MemberType.ToString() + "\n";
    }
   }
   MessageBox.Show(str);
  }
 }
 catch(ex)
 {
MessageBox.Show("Exception: displayMemeberInfo()" + ex.Message);
}
}

This entry was posted in Development, M3 / MoveX. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s