Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SimpleExtensions.cs
1using System;
2using System.Collections.Generic;
3
5{
9 public static class SimpleExtensions
10 {
16 public static string ToYesNo(this bool Value)
17 {
18 return Value ? "Yes" : "No";
19 }
20
26 public static string ToStringTZ(this DateTime Value)
27 {
28 if (Value == DateTime.MinValue || Value == DateTime.MaxValue)
29 return string.Empty;
30 else
31 {
32 string s = Value.ToShortDateString() + ", " + Value.ToLongTimeString();
33
34 if (Value.Kind == DateTimeKind.Utc)
35 s += "Z";
36
37 return s;
38 }
39 }
40
48 public static Value[] ToValueArray<Key, Value>(this IDictionary<Key, Value> Dictionary)
49 {
50 Value[] Result = new Value[Dictionary.Count];
51 Dictionary.Values.CopyTo(Result, 0);
52 return Result;
53 }
54
62 public static Key[] ToKeyArray<Key, Value>(this IDictionary<Key, Value> Dictionary)
63 {
64 Key[] Result = new Key[Dictionary.Count];
65 Dictionary.Keys.CopyTo(Result, 0);
66 return Result;
67 }
68
69 }
70}