RoboZhando/CommandNext/CommandQuery.cs
/// <summary>
/// Converts a argument to the specific type. Will not throw "KeyNotFound".
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="param"></param>
/// <returns></returns>
Converts a argument to the specific type. Will not throw "KeyNotFound".
Converts a argument to the specific type . Will not throw " KeyNotFound " .
public async Task<T> GetArgumentAsync<T>(string param, T @default = default(T))
        {
            try
            {
                T value = await ConvertArgumentAsync<T>(param);
                return value;
            }
            catch (KeyNotFoundException) { }
            catch (ArgumentNullException e) { throw new ArgumentNullException(param, e.Message); }
            catch (ArgumentException e) { throw new ArgumentException(e.Message, param); }
            return @default;
        }
public async Task < T > GetArgumentAsync < T > ( string param , T @default = default ( T ) ) { try { T value = await ConvertArgumentAsync < T > ( param ) ; return value ; } catch ( KeyNotFoundException ) { } catch ( ArgumentNullException e ) { throw new ArgumentNullException ( param , e . Message ) ; } catch ( ArgumentException e ) { throw new ArgumentException ( e . Message , param ) ; } return @default ; }
Converts a argument to the specific type.
Converts a argument to the specific type .
None
param
string
None
@default
T
typeparam
None