|
using System;
// Code from CPian leppie: http://www.codeproject.com/KB/cs/NonNullable.aspx?msg=2504221#xx2504221xx
sealed class Box<T> where T : struct
{
readonly T value;
private Box(T t)
{
value = t;
}
public static implicit operator T(Box<T> b)
{
return b.value;
}
public static implicit operator Box<T>(T t)
{
return new Box<T>(t);
}
public override bool Equals(object obj)
{
return value.Equals(obj);
}
public override int GetHashCode()
{
return value.GetHashCode();
}
public override string ToString()
{
return value.ToString();
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.