示例#1
0
 public bool Equals(ImmutableContainer <T>?other)
 {
     if (other is null)
     {
         return(false);
     }
     return(ReferenceEquals(this, other) || EqualityComparer <T> .Default.Equals(Value, other.Value));
 }
示例#2
0
 public int CompareTo(ImmutableContainer <T>?other)
 {
     if (Value is not IComparable <T> comparable)
     {
         throw new InvalidOperationException("T must be IComparable.");
     }
     return(comparable.CompareTo(other !.Value));
 }