On Wed, 24 Apr 2002 10:05:01 -0700, Justin Rudd
<[EMAIL PROTECTED]> wrote:

>[code snipped]
>
>Why would you do all that work when you can just do this...
>
>public class Std {
>   public Int32 MyVal;
>   public String MyString;
>}
>
>public class MyObject {
>   public Std Std;
>}
>Type[]types = new Type[]{typeof(MyObject)};
>XmlSerializer[] s = XmlSerializer.FromTypes(types);
>
>Plus this is supported by Microsoft.  IXmlSerializable is not supported
by MS (or so says my help files).
>
>If you have more complicated XML, then you can use the serialization
attributes.  No reason to do it all yourself.
>
>Justin
>
>You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
>subscribe to other DevelopMentor lists at http://discuss.develop.com.

Justin, thanks for your response but I am still confused. Why do I need to
embed the object in another to pass to typeof? And what about setting
values? I want those to get serialized too. What if I have:
class Test
 {
  /// <summary>
  /// The main entry point for the application.
  /// </summary>
  [STAThread]
  static void Main()
  {
   ToolDescriptor td = new ToolDescriptor();
   td.Author = "Sam Gentile";
   td.Description = "Tool Descriptor";
   td.Name = "Tool Descriptor";
   td.OrganizationURL = "http://www.microsoft.com";;

   Type[] ourTypes = new Type[] {typeof(td) };
  }
How do I get this to work?

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to