I'm working on an app that will read in data from my database, do some processing, and then export the results out to a fixed width flat file.
I'm starting out with the code in this question, and building off that.
Now, there are three main data types for the exported file, String, Num, and Decimal(x,y); where x are the numbers to the left of the decimal point and y is the numbers to the right.
I have this so far as my custom attribute:
public class FixedWidthColumn : Attribute
{
public int Position { get; set; }
public int Length { get; set; }
public FixedWidthColumn(int position, int length)
{
Position = position;
Length = length;
}
}
Is it possible to create a custom attribute (or some other structure) that I can use to build properties like this:
[FixedWidthColumn(3,2, String)]
public string CompanyId
[FixedWidthColumn(6, 20, Num)]
public int Sku { get; set; }
[FixedWidthColumn(5, 10, Decimal(6,4)]
public decimal Price { get; set; }