Hi All,
Was anybody able to serialize the "Type" class properly using
XmlSerializer()....
Want to serialize and deserialze the Type in a string form, but can this be
done ?
myobj.Type = typeof(System.String) as <type>System.String</type>
thanks a ton.
Oleg Tkachenko - 23 Nov 2003 10:23 GMT
> Was anybody able to serialize the "Type" class properly using
> XmlSerializer()....
AFAIK that's impossible due to security reasons.

Signature
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog
Dino Chiesa [Microsoft] - 24 Nov 2003 18:54 GMT
If all you want is the type name, can you use a buddy member that depends on
the actual type?
public class MyType {
[XmlIgnore] // this is not serialized
public System.Type ActualTypeInstance;
public System.String TypeName {
get {
return ActualTypeInstance.FullName;
}
set {
ActualTypeInstance= System.Type.GetType(value);
}
}
}
-Dino
> > Was anybody able to serialize the "Type" class properly using
> > XmlSerializer()....
>
> AFAIK that's impossible due to security reasons.
Christoph Schittko [MVP] - 28 Nov 2003 21:53 GMT
The XmlSerializer is not really intended for anything but binding XML to
simple data classes, check [0] for a more detailed discussion.
Why do you want to serialize a Type object to a string anyway? There isn't
much state information in a Type object that's interesting to serialize. If
you need to store information about what Type you were dealing with, then
storing the Type's FullName property will suffice.

Signature
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor
[0] http://www.topxml.com/xmlserializer/serializable_classes.asp
> Hi All,
>
[quoted text clipped - 6 lines]
>
> thanks a ton.