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
linxxd
NA
10
0
dynamic fields and methods
Sep 26 2004 7:33 PM
hi all, i would like to write a method to which i can give an object of any class as a parameter and which should return an xml string with the content of the object. to do that, i have to go through all available classmembers of the input class. this is thought especially for beans. is there a possibility to get all members of an object in run time? example: public class A { private string s1; private string s2; private string s3; } public class B { public static Main() { A a = new A(); a.setS1("string 1"); a.setS2("string 2"); string xml = ConverterClass.convert2Xml(a, "nodeName"); } } the string xml should contain the following:
now i should now, how the convert2Xml() method can get to know, that class A has the 3 strings s1, s2 and s3? the next step would be making this method recursive that fields which are objects, that they appear as nodes... i'd be glad if anyone has any hints or any links to a good tutorial concerning this issue. thanks a lot...
Reply
Answers (
4
)
LDAP
Which is the best ? C# or VB