By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,491 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,491 IT Pros & Developers. It's quick & easy.

Serialize class instance to file, then retrieve

P: n/a
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; }
}
}
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

"Mark" <fi******@idonotlikejunkmail.umn.edu> wrote in message
news:O2**************@TK2MSFTNGP15.phx.gbl...
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; }
}
}

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.