Initializes a new instance of the FormatAttribute class.

Namespace: Dapfor.Net.Formats
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)

Syntax

C#
public FormatAttribute(
	string formatString
)
Visual Basic
Public Sub New ( 
	formatString As String
)
Visual C++
public:
FormatAttribute(
	String^ formatString
)
F#
new : 
        formatString : string -> FormatAttribute

Parameters

formatString
Type: System..::..String
This is a string that is passed to the Format(String, array<Object>[]()[][]) method. See MSDN for more information.

Examples

 Copy imageCopy
public class Product
{
    private DateTime maturity;

    [Format("yyyy-MM-dd")]
    public DateTime Maturity
    {
        get { return maturity; }
        set { maturity = value; }
    }
}

public void PopulateGrid(Grid grid)
{
    //Initialize the grid
    grid.Headers.Add(new Header());
    grid.Headers[0].Add(new Column("Maturity"));

    Product product = new Product();
    product.Maturity = new DateTime(2009, 10, 20);

    grid.Rows.Add(product);

    Console.WriteLine("The cell displays the text: {0}", grid.Rows[0]["Maturity"].Text);
}

//Console output:
The cell displays the text: 2009-10-20

See Also