Minggu, 28 November 2010

Get Property using Reflection C# +Java

התבקשתי לכתוב ב java class מאוד גדול (שלא ניתן לחלק אותו)ולהפוך אותו ל xml, סיקרן אותי מאוד כיצד כותבים את אותו class גם ב c#: יש לציין שניתן להפוך Class ל XML גם בצורה אחרת דרך XmlSerializer.להלן הקוד ב C#://Class into XML//Get the Properties of the Class and //Create xml elementXElement xml_line = new XElement("je");Type type = MyClass.GetType(); //Get the Type of your ClassPropertyInfo[]

Tidak ada komentar:

Posting Komentar