RSS

C# How to

11 Jun

XML

  • How to serialize an object to XML by using Visual C#
    • Mark an class with the attribute [Serializable];
    • XmlSerializer x = new XmlSerializer(SomeObject.GetType());
      using (FileStream stream = System.IO.File.Create(FilePath))
      {
      XmlWriter writer = XmlWriter.Create(stream);
      x.Serialize(writer, SomeObject);
      }

Assembly

Visual Studio

Misc

WinForm

LINQ

Advertisements
 
Leave a comment

Posted by on June 11, 2008 in Dotnet/C#

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: