Exemplo n.º 1
0
 /// <summary>
 /// Creates a fixed-width field definition with value transformation/conversion
 /// </summary>
 /// <typeparam name="T">The type the raw string value will be converted into</typeparam>
 /// <param name="name">The name of the field</param>
 /// <param name="width">The width of the field (measured in characters, not bytes)</param>
 /// <param name="handler">The handler used to convert the raw string value</param>
 /// <remarks>If no conversion (raw string value) is desired, use the alternative overload</remarks>
 public static FixedWidthInputFieldDefinition Create <T>(string name, int width, FixedWidthParser.FixedWidthInputFieldHandler <T> handler)
 {
     if (handler == null)
     {
         throw new ArgumentNullException("handler");
     }
     return(new FixedWidthInputFieldDefinition(name, width, value => handler(value)));
 }
Exemplo n.º 2
0
 private FixedWidthInputFieldDefinition(string name, int width, FixedWidthParser.FixedWidthInputFieldHandler <object> handler)
 {
     _name    = name;
     _width   = width;
     _handler = handler;
 }