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,
	string prefix,
	string suffix
)
Visual Basic
Public Sub New ( 
	formatString As String,
	prefix As String,
	suffix As String
)
Visual C++
public:
FormatAttribute(
	String^ formatString, 
	String^ prefix, 
	String^ suffix
)
F#
new : 
        formatString : string * 
        prefix : string * 
        suffix : 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.
prefix
Type: System..::..String
The prefix that is added before the formatted string.
suffix
Type: System..::..String
The suffix that is added after the formatted string.

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