Serialize class instance to file, then retrieve

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; }
}
}
 
M

Mark

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top