Click here to Skip to main content
11,411,494 members (66,727 online)
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
Add your own
alternative version

Tagged as

Achieve Persistence Through Serialization

, 6 Jan 2011 CPOL
This article compares the two common types of serialization in aspects of data access, readability, and runtime cost.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Drawing;
using System.Xml.Serialization;

namespace Trestan
    class Program
        static void Main(string[] args)
            Console.WriteLine("Normally we will create GUI for user interaction. Here we just use console as a demo.\n");
            Console.WriteLine("Configuration settings:\n");
            Console.WriteLine("ServerIP: "+Configuration.Instance.ServerIP);
            Console.WriteLine("ServerPort: " + Configuration.Instance.ServerPort);
            Console.WriteLine("UserName: " + Configuration.Instance.CurrentUser.UserName);
            Console.WriteLine("UserID: " + Configuration.Instance.CurrentUser.UserID);
            Console.WriteLine("\nPlease input user name: ");
            Configuration.Instance.CurrentUser.UserName = Console.ReadLine();
            Configuration.Instance.CurrentUser.UserID = 1001;   //In real application, this value will be obtained from server side after athentication.
            Configuration.Instance.ServerIP = Utility.getHostIP();

            Console.WriteLine("Press enter to exit. Run the program again will show new settings.");

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Team Leader
Canada Canada
Looking for something to do in the new year.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150414.5 | Last Updated 6 Jan 2011
Article Copyright 2011 by trestan
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid