示例#1
0
 /// <summary>
 /// Determine whether two objects are equal.
 /// </summary>
 /// <param name="other">The other object to compare to.</param>
 /// <returns>true if both objects are null or empty, or has identical content.</returns>
 protected bool Equals(LengthLimitedString other)
 {
     if (null == other)
     {
         return(false);
     }
     if (IsNullOrEmpty() && other.IsNullOrEmpty())
     {
         return(true);
     }
     return(Value.Equals(other.Value));
 }
示例#2
0
        public int CompareTo(object obj)
        {
            if (null == obj)
            {
                return(1);
            }
            LengthLimitedString other = obj as LengthLimitedString;

            if (null == other)
            {
                throw new ArgumentException("Must be LengthLimitedString");
            }
            if (IsNullOrEmpty() && other.IsNullOrEmpty())
            {
                return(0);
            }
            return(String.Compare(Value, other.Value, StringComparison.CurrentCulture));
        }