DSharpPlus.CommandsNext/CommandsNextExtension.cs
/// <summary>
/// Registers a user-friendly type name.
/// </summary>
/// <typeparam name="T">Type to register the name for.</typeparam>
/// <param name="value">Name to register.</param>
Registers a user-friendly type name.
Registers a user - friendly type name .
public void RegisterUserFriendlyTypeName<T>(string value)
        {
            if (string.IsNullOrWhiteSpace(value))
                throw new ArgumentNullException(nameof(value), "Name cannot be null or empty.");
            var t = typeof(T);
            var ti = t.GetTypeInfo();
            if (!this.ArgumentConverters.ContainsKey(t))
                throw new InvalidOperationException("Cannot register a friendly name for a type which has no associated converter.");
            this.UserFriendlyTypeNames[t] = value;
            if (!ti.IsValueType)
                return;
            var nullableConverterType = typeof(NullableConverter<>).MakeGenericType(t);
            var nullableType = typeof(Nullable<>).MakeGenericType(t);
            this.UserFriendlyTypeNames[nullableType] = value;
        }
public void RegisterUserFriendlyTypeName < T > ( string value ) { if ( string . IsNullOrWhiteSpace ( value ) ) throw new ArgumentNullException ( nameof ( value ) , " " ) ; var t = typeof ( T ) ; var ti = t . GetTypeInfo ( ) ; if ( ! this . ArgumentConverters . ContainsKey ( t ) ) throw new InvalidOperationException ( " " ) ; this . UserFriendlyTypeNames [ t ] = value ; if ( ! ti . IsValueType ) return ; var nullableConverterType = typeof ( NullableConverter < > ) . MakeGenericType ( t ) ; var nullableType = typeof ( Nullable < > ) . MakeGenericType ( t ) ; this . UserFriendlyTypeNames [ nullableType ] = value ; }
Registers a user-friendly type name.
Registers a user - friendly type name .
value
string
Name to register.
Name to register .
typeparam
Type to register the name for.
Type to register the name for .