TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
misterraj
NA
7
0
Reflection
Dec 24 2004 4:10 AM
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);
Reply
Answers (
6
)
c# compile errors
How to take cursor from file