-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.cs
27 lines (25 loc) · 950 Bytes
/
test.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
* C# Variant data type: A class that mimics the behavior of the so-called variant data type
* Jonas Raoni Soares da Silva <http://raoni.org>
* https://github.com/jonasraoni/csharp-variant-type
*/
using System;
using Raoni;
namespace Test{
class Program{
static void Main(string[] args){
var v = new Variant(123);
Variant v2 = 0;
Console.WriteLine(v == v2);
Console.WriteLine(v > v2);
Console.WriteLine(v2 ? "v2 converted to true" : "v2 converted to false");
Console.WriteLine((int)v);
Console.WriteLine((bool)v);
Console.WriteLine((double)v);
Console.WriteLine(((int?)new Variant(null)).HasValue);
Console.WriteLine(((DateTime)new Variant(DateTime.Now)).ToString("o"));
Console.WriteLine((bool)new Variant("False"));
Console.WriteLine((float)new Variant("123.321"));
}
}
}