private async Task handleSchemaAsync() { if (recordCount != 0) { return; } if (!parser.Options.IsFirstRecordSchema) { return; } if (schema != null) { await skipAsync(); return; } string[] columnNames = await readNextRecordAsync(); schema = new SeparatedValueSchema(); foreach (string columnName in columnNames) { StringColumn column = new StringColumn(columnName); schema.AddColumn(column); } }
/// <summary> /// Adds a column to the schema, using the given definition to define it. /// </summary> /// <param name="definition">The definition of the column to add.</param> /// <param name="window">Describes the column</param> /// <returns>The current schema.</returns> public FixedLengthSchema AddColumn(ColumnDefinition definition, Window window) { if (window == null) { throw new ArgumentNullException("window"); } schema.AddColumn(definition); windows.Add(window); totalWidth += window.Width; return(this); }