Inheritance: IComparable, IWrapper
        /// <summary>
        /// Compares the names of Constructions.
        /// </summary>
        /// <param name="obj">ConstructionWrapper used to compare</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects
        /// being compared. The return value has these meanings:
        /// Value Condition Less than zero This instance is less than value.
        /// Zero This instance is equal to value. Greater than zero This instance is
        /// greater than value.-or- value is null.</returns>
        public int CompareTo(object obj)
        {
            ConstructionWrapper wrapper = obj as ConstructionWrapper;

            if (wrapper != null)
            {
                return(this.Name.CompareTo(wrapper.Name));
            }
            return(1);
        }
Beispiel #2
0
 /// <summary>
 /// Convert object to string
 /// </summary>
 /// <param name="context">An ITypeDescriptorContext that provides a format context. </param>
 /// <param name="culture">A CultureInfo. If null is passed, the current culture is assumed. </param>
 /// <param name="value">The Object to convert. </param>
 /// <param name="destinationType">The Type to convert the value parameter to. </param>
 /// <returns>empty string if current construction is null, otherwise construction name</returns>
 public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     if (destinationType == typeof(string))
     {
         if (value == null)
         {
             return(string.Empty);
         }
         ConstructionWrapper construction = value as ConstructionWrapper;
         if (construction != null)
         {
             return(construction.Name);
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }