My apologies for jumping into this thread without reading all the prior
posts, but why don't you just do:

XmlSerializer xs = new XmlSerializer( typeof(ToolDescriptor) );
xs.Serialize( ..., td );
...

The type[] is only needed to let the XmlSerializer know about types it might
have to process at runtime but  your class doesn't explicitly declare them,
i.e. if you have a field of a reference type and you assign types derived
from the reference type (hope that's clear)...

HTH,
Christoph

> On Wed, 24 Apr 2002 10:05:01 -0700, Justin Rudd
> 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