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

GetWidgetFullName() public static method

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

            var attr = widgetType.GetCustomAttribute<WidgetAttribute>();
            if (attr != null && !string.IsNullOrEmpty(attr.Name))
            {
                return attr.Name;
            }

            var shortName = GetShortNameByConvention(widgetType);
            if (string.IsNullOrEmpty(widgetType.Namespace))
            {
                return shortName;
            }

            return $"{widgetType.Namespace}.{shortName}";
        }