Exemplo n.º 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));
 }
Exemplo n.º 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));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="other">The other object to make a copy of.</param>
 protected LengthLimitedString(LengthLimitedString other)
 {
     MaxLength = other.MaxLength;
     Value     = other.Value;
 }