Class ValueParser
  
  
  
  
    Inheritance
    System.Object
    ValueParser
   
  
  Assembly: McMaster.Extensions.CommandLineUtils.dll
  Syntax
  
    public static class ValueParser
   
  Methods
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Create(Type, Func<String, String, CultureInfo, Object>)
  Creates an IValueParser implementation for a type
given a parsing function that receives an argument name, a value
to parse and a culture to use for parsing.
Declaration
  
    public static IValueParser Create(Type targetType, Func<string, string, CultureInfo, object> parser)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Type | targetType |  | 
      
        | System.Func<System.String, System.String, System.Globalization.CultureInfo, System.Object> | parser |  | 
    
  
  Returns
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Create<T>(Func<String, CultureInfo, (Boolean, T)>)
  Creates an IValueParser<T> implementation given
a parsing function that receives an argument name, a value to
parse, a culture to use for parsing and returns a tuple whose
first element indicates whether parsing was successful and
second element is the parsed value.
Declaration
  
    public static IValueParser<T> Create<T>(Func<string, CultureInfo, (bool, T)> parser)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Func<System.String, System.Globalization.CultureInfo, System.ValueTuple<System.Boolean, T>> | parser |  | 
    
  
  Returns
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  
  Creates an IValueParser<T> implementation given
a parsing function that receives an argument name, a value to
parse, a culture to use for parsing and returns a tuple whose
first element indicates whether parsing was successful and
second element is the parsed value. An additional parameter
specifies a function that returns the System.FormatException
to throw, given the argument name and value, when parsing is
unsuccessful.
Declaration
  
    public static IValueParser<T> Create<T>(Func<string, CultureInfo, (bool, T)> parser, Func<string, string, FormatException> errorSelector)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Func<System.String, System.Globalization.CultureInfo, System.ValueTuple<System.Boolean, T>> | parser |  | 
      
        | System.Func<System.String, System.String, System.FormatException> | errorSelector |  | 
    
  
  Returns
  
  Type Parameters
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Create<T>(Func<String, String, CultureInfo, T>)
  Creates an IValueParser<T> implementation given
a parsing function that receives an argument name, a value to
parse and a culture to use for parsing.
Declaration
  
    public static IValueParser<T> Create<T>(Func<string, string, CultureInfo, T> parser)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Func<System.String, System.String, System.Globalization.CultureInfo, T> | parser |  | 
    
  
  Returns
  
  Type Parameters