17/11/13 22:01:26.37 qSvbvuzsa.net
>>220
こんな型でも返しますかw
public class FunctionResult<T>
{
public FunctionResult(T val)
{
Value = val;
}
public FunctionResult(Exception ex)
{
Exception = ex;
}
public bool HasValue
{
get { return Exception != null; }
}
private T _Value;
public T Value
{
get
{
if (!HasValue) throw new InvalidOperationException();
return _Value;
}
private set { _Value = value; }
}
public Exception Exception { get; private set; }
}