03.01.2015 Views

C# 5.0 Programmer's Reference

Visual Studio 2013 C# 5.0 Programmer's Reference

Visual Studio 2013 C# 5.0 Programmer's Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

580 ❘ CHAPTER 25 Serialization<br />

Use the following Person class to store information about the people.<br />

public class Person<br />

{<br />

public string Name;<br />

public List Friends = new List();<br />

public override string ToString()<br />

{<br />

return Name;<br />

}<br />

}<br />

Hints: Store the person information in a List. Serialize and deserialize the data<br />

into a file when the program stops and starts. If the data file doesn’t exist when the program<br />

starts, just create some Person objects. (A real application would let the user add, edit, and<br />

delete Person objects, perhaps as in the program you wrote for Exercise 2.)<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!