|
@ -125,17 +125,9 @@ namespace Apewer |
|
|
#region 运算符。
|
|
|
#region 运算符。
|
|
|
|
|
|
|
|
|
/// <summary>从 <see cref="Class{T}"/> 到 Boolean 的隐式转换,判断 <see cref="Class{T}"/> 包含值。</summary>
|
|
|
/// <summary>从 <see cref="Class{T}"/> 到 Boolean 的隐式转换,判断 <see cref="Class{T}"/> 包含值。</summary>
|
|
|
/// <remarks>当 T 是 Boolean 时,获取 Value。<br />当 T 是 String 时,判断 Value 不为 NULL 且不为空。</remarks>
|
|
|
|
|
|
public static implicit operator bool(Class<T> instance) |
|
|
public static implicit operator bool(Class<T> instance) |
|
|
{ |
|
|
{ |
|
|
if (instance == null) return false; |
|
|
if (instance == null) return false; |
|
|
|
|
|
|
|
|
// var boolean = instance as Class<bool>;
|
|
|
|
|
|
// if (boolean != null) return boolean.Value;
|
|
|
|
|
|
|
|
|
|
|
|
// var text = instance as Class<string>;
|
|
|
|
|
|
// if (text != null) return !string.IsNullOrEmpty(text.Value);
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|