Serialize class instance to file, then retrieve

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I'd like to take an instance of a class, and serialize it to a file on my
computer. No security required on the file. Then, I'd like to be able to
unserialize the file later and use the instance again. A quick sample on
how to do this would be grand. A little pseudo code below just to clarify
what type of class I'd like serialize to a file ...

Thanks in advance.

Mark

[Serializable]
public class Person
{
private string _firstName;

public Person(firstName)
{
_firstName = firstName;
}

public string FirstName
{
get { return _firstName; }
}
}
 
Just kidding. Just found a great example in the VS.NET help files under
".NET Framework Developer's Guide". The "Basic Serialization" section has a
full example of both.
 
Back
Top