// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; namespace E { public class Foobar { private DateTime theTime; public DateTime TheTimeAsDateTime { get { return theTime; } set { theTime = value; } } public String TheTimeAsString { get { return theTime.ToString(); } set { theTime = DateTime.Parse(value); } } } public class Program { public static void Main(string[] args) { Foobar o = new Foobar(); o.TheTimeAsDateTime = DateTime.Now; String s = o.TheTimeAsString; o.TheTimeAsString = s; DateTime dt = o.TheTimeAsDateTime; Console.WriteLine("{0} {1}", s, dt); } } }