Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class NewObject
- {
- }
- [XmlRoot]
- public class XmlData
- {
- private Type t;
- public Type T
- {
- get { return t; }
- set { t = value; }
- }
- }
- static void Main(string[] args)
- {
- XmlData data = new XmlData();
- data.T = typeof(NewObject);
- try
- {
- XmlSerializer serializer = new XmlSerializer(typeof(XmlData));
- try
- {
- using (FileStream fs = new FileStream("test.xml", FileMode.Create))
- {
- serializer.Serialize(fs, data);
- }
- }
- catch (Exception ex)
- {
- }
- }
- catch (Exception ex)
- {
- }
- }
- public class c
- {
- [XmlIgnore]
- private Type t;
- [XmlIgnore]
- public Type T {
- get { return t; }
- set {
- t = value;
- tName = value.AssemblyQualifiedName;
- }
- }
- public string tName{
- get { return t.AssemblyQualifiedName; }
- set { t = Type.GetType(value);}
- }
- }
- Class dummie
- {
- Type objType;
- string xml;
- }
Add Comment
Please, Sign In to add comment