Class FixedWidthSkipAttribute
- Namespace
- Wolfgang.Etl.FixedWidth.Attributes
- Assembly
- Wolfgang.Etl.FixedWidth.dll
Declares a column in the fixed-width file that should be skipped during extraction and not mapped to any property. Multiple instances may be stacked on the same property to declare several skipped columns.
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
public sealed class FixedWidthSkipAttribute : Attribute
- Inheritance
-
FixedWidthSkipAttribute
- Inherited Members
Examples
// File columns: FirstName(10), DOB(8), HireDate(8), EmployeeNumber(5)
// POCO only cares about FirstName and EmployeeNumber.
public class EmployeeRecord
{
[FixedWidthField(0, 10)]
public string FirstName { get; set; }
[FixedWidthSkip(1, 8, Message = "DOB")]
[FixedWidthSkip(2, 8, Message = "HireDate")]
[FixedWidthField(3, 5)]
public string EmployeeNumber { get; set; }
}
Remarks
Index participates in the same global ordering as Index and must be unique across all FixedWidthFieldAttribute and FixedWidthSkipAttribute instances on the type.
Constructors
FixedWidthSkipAttribute(int, int)
Declares a skipped column at the specified index with the specified width.
public FixedWidthSkipAttribute(int index, int length)
Parameters
indexintThe zero-based column index. Must be unique across all FixedWidthFieldAttribute and FixedWidthSkipAttribute instances on the type.
lengthintThe number of characters occupied by the skipped column in the file. Must be greater than zero.
Properties
Index
The zero-based column index.
public int Index { get; }
Property Value
Length
The number of characters occupied by this column in the file.
public int Length { get; }
Property Value
Message
An optional description of what this column contains. Used purely for documentation — it has no effect on parsing or writing.
public string? Message { get; set; }