I thought it might be a cool idea to start sharing some code snippets. They don't have to be big or important, just some cool/educating code that you think vCampus can use or learn from.
You can attach your code to your post. Please note that the forum software does not accept .cs/.vb files. Please add a .txt extension, so the forum software will let it trough.
So, if you want to share your code, please provide the following:
Language (Framework version):
I will kick off with a small piece of code.
Description: PiDateTime class
Language / Framework version: C# 3.0, .NET 3.5
Purpose: This is a generic PI DateTime object, that can handle both PI (relative) time notation, and .NET DateTime classess. For instance: you can instantiate a class, and compare it to a string of PI time notation. Or, you can instantiate it using relative time notation and compare, substract or add it to a DateTime object (and get a timespan back). Maybe someone finds this usefull.
It's interesting because it shows how type inference and operator overloading is done in C#/.NET.
var p1 = PiDateTime.Now;
var p2 = new PiDateTime("*-2h");
System.Console.WriteLine(p1 < "*-1h");
System.Console.WriteLine("*-1h" > new PiDateTime(DateTime.Today));