Reflection
I am using reflection to get load an assembly. I donot know how to get the properties of the object using reflection.
I want to know how to get the values of the properties in the object. I have attached my code, if any one could check what is missing I would be thankful.
string strPath = GetInstalledPath();
asm = Assembly.LoadFrom (strPath);
PublishType = asm.GetType("ControlLicenseService.LicenseInfoClient");
Object theObj = Activator.CreateInstance(PublishType);
// Array with Two members for passing the Parameter for Initialize method.
Type[] paramTypes = new Type[2];
paramTypes[0]= Type.GetType("System.String");
paramTypes[1]= Type.GetType("System.Int32");
// Get method info for Initialize( )
MethodInfo InitializeInfo =
PublishType.GetMethod("Initialize",paramTypes);
// Fill the array with the actual parameters
Object[] parameters = new Object[2];
parameters[0] = "sk26901CODA904O";
parameters[1] = 10300;
Object returnVal = InitializeInfo.Invoke(theObj,parameters);
pi = PublishType.GetProperty("UsersCount");
string valu = pi.GetValue(theObj,null).ToString();
MessageBox.Show(valu);

shimtannyRank #3,312 · 434 pointsPosted Dec 24, 2004, 12:03 AM EST
misterraj7 pointsPosted Dec 24, 2004, 12:52 AM EST
shimtannyRank #3,312 · 434 pointsPosted Dec 24, 2004, 2:34 AM EST
misterraj7 pointsPosted Dec 26, 2004, 7:26 PM EST
shimtannyRank #3,312 · 434 pointsPosted Dec 26, 2004, 10:45 PM EST
misterraj7 pointsPosted Dec 26, 2004, 11:11 PM EST