This is a simple Singleton class created which I have serialized using separate serialized class and saved in a text file in encrypted form. The main reason of having separate Singleton Class object and Serialized Class object is to maintain its basic integrity and keep maintainable easy.
Reference - http://msdn.microsoft.com/en-us/library/ff650316.aspx
To See how to serialize in encrypted form please refer to my previous implementation (link below).
Reference - http://msdn.microsoft.com/en-us/library/ff650316.aspx
To See how to serialize in encrypted form please refer to my previous implementation (link below).
Serialize singleton object to file - encrypted
Implementation:
Implementation:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Diagnostics; namespace TestNamespace { public class SingletonClass { string abc; // This is the crux of singleton implementation private static SingletonClass instance; private SingletonClass(){} public static SingletonClass Instance { get { if (instance == null) { instance = new SingletonClass(); } return instance; } } // standard get and set methods public Version ABC { get { return abc; } set { abc = value; } } } }
Great Post! I really like it Acmarket Gbinstagram WPS Connect
ReplyDelete