Antaris.AspNetCore.Mvc.Widgets.Internal.WidgetConventions.GetShortNameByConvention C# (CSharp) Method

GetShortNameByConvention() public static method

Gets the short name for a widget.
public static GetShortNameByConvention ( TypeInfo widgetType ) : string
widgetType System.Reflection.TypeInfo The widget type.
return string
        public static string GetShortNameByConvention(TypeInfo widgetType)
        {
            if (widgetType == null)
            {
                throw new ArgumentNullException(nameof(widgetType));
            }

            if (widgetType.Name.EndsWith(WidgetSuffix, StringComparison.OrdinalIgnoreCase))
            {
                return widgetType.Name.Substring(0, widgetType.Name.Length - WidgetSuffix.Length);
            }

            return widgetType.Name;
        }