Catel.ObjectToStringHelper.ToTypeString C# (CSharp) Method

ToTypeString() public static method

Returns a string that represents the type name of the instance. If the instance is null, this method will return "null". This method is great when the value of a property must be logged.
public static ToTypeString ( object instance ) : string
instance object The instance.
return string
        public static string ToTypeString(object instance)
        {
            if (instance == null)
            {
                return "null";
            }

            var instanceAsType = instance as Type;
            if (instanceAsType != null)
            {
                return instanceAsType.Name;
            }

            return instance.GetType().Name;
        }