1 |
william |
111 |
using System; |
2 |
|
|
using System.Collections.Generic; |
3 |
|
|
using System.Linq; |
4 |
|
|
using System.Text; |
5 |
|
|
|
6 |
|
|
namespace RomCheater.Logging |
7 |
|
|
{ |
8 |
|
|
public class EnumNameValuePair<TName,TValue> |
9 |
|
|
where TValue : IConvertible |
10 |
|
|
{ |
11 |
|
|
#region implicit operators |
12 |
|
|
public static implicit operator TValue(EnumNameValuePair<TName, TValue> o) { return o.Value; } |
13 |
|
|
public static implicit operator TName(EnumNameValuePair<TName, TValue> o) { return o.Name; } |
14 |
|
|
#endregion |
15 |
|
|
public EnumNameValuePair() : this(default(TName)) { } |
16 |
|
|
public EnumNameValuePair(TName name) : this(name, default(TValue)) { } |
17 |
|
|
public EnumNameValuePair(TName name, TValue value) |
18 |
|
|
{ |
19 |
|
|
this.Name = name; |
20 |
|
|
this.Value = value; |
21 |
|
|
} |
22 |
|
|
public TName Name { get; protected set; } |
23 |
|
|
public TValue Value { get; protected set; } |
24 |
|
|
public override string ToString() |
25 |
|
|
{ |
26 |
|
|
return string.Format("[{0}: 0x{1:x8}]", Name.ToString(), Value); |
27 |
|
|
} |
28 |
|
|
} |
29 |
|
|
} |