IfcDoc.Schema.SEntity.GetTypeCaption C# (CSharp) Method

GetTypeCaption() public method

Gets user-friendly caption describing the type of object.
public GetTypeCaption ( ) : string
return string
        public virtual string GetTypeCaption()
        {
            // use display name if one exists
            if (this.GetType().IsDefined(typeof(DisplayNameAttribute), false))
            {
                DisplayNameAttribute attr = (DisplayNameAttribute)this.GetType().GetCustomAttributes(typeof(DisplayNameAttribute), false)[0];
                return attr.DisplayName;
            }

            // try base class (i.e. BeamStandardCase -> Beam)
            if (this.GetType().BaseType.IsDefined(typeof(DisplayNameAttribute), false))
            {
                DisplayNameAttribute attr = (DisplayNameAttribute)this.GetType().BaseType.GetCustomAttributes(typeof(DisplayNameAttribute), false)[0];
                return attr.DisplayName;
            }

            // fall back on internal type
            return this.GetType().Name;
        }