コード例 #1
0
ファイル: May.cs プロジェクト: willCode2Surf/cassette
 ///<summary>
 ///Determines if this potential value is equivalent to the given potential value.
 ///Note: All forms of no value are equal, including May.NoValue, May&lt;T&gt;.NoValue, May&lt;AnyOtherT&gt;.NoValue, default(May&lt;T&gt;) and new May&lt;T&gt;().
 ///Note: Null is NOT equivalent to new May&lt;object&gt;(null) and neither is equivalent to new May&lt;string&gt;(null).
 ///</summary>
 public bool Equals(IMayHaveValue other)
 {
     if (other is May <T> )
     {
         return(Equals((May <T>)other));
     }
     // potential values containing no value are always equal
     return(other != null && !this.HasValue && !other.HasValue);
 }
コード例 #2
0
 ///<summary>Runs the given no value action if the given potential value does not contain a value, and otherwise does nothing.</summary>
 public static void ElseDo(this IMayHaveValue potentialValue, Action noValueAction)
 {
     if (potentialValue == null)
     {
         throw new ArgumentNullException("potentialValue");
     }
     if (noValueAction == null)
     {
         throw new ArgumentNullException("noValueAction");
     }
     if (!potentialValue.HasValue)
     {
         noValueAction();
     }
 }
コード例 #3
0
ファイル: MayNoValue.cs プロジェクト: willCode2Surf/cassette
 ///<summary>Determines if the given potential value contains no value.</summary>
 public bool Equals(IMayHaveValue other)
 {
     return(other != null && !other.HasValue);
 }
コード例 #4
0
ファイル: MayNoValue.cs プロジェクト: shishkin-pavel/May
 ///<summary>Determines if the given potential value contains no value.</summary>
 public bool Equals(IMayHaveValue other)
 {
     return other != null && !other.HasValue;
 }
コード例 #5
0
ファイル: Result.cs プロジェクト: shishkin-pavel/May
 public bool Equals(IMayHaveValue other)
 {
     throw new NotImplementedException();
 }