Enables property identifier changes.
Namespace: Dapfor.Net.DataAssembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)
Syntax
| C# |
|---|
public sealed class FieldAttribute : Attribute |
| Visual Basic |
|---|
Public NotInheritable Class FieldAttribute Inherits Attribute |
| Visual C++ |
|---|
public ref class FieldAttribute sealed : public Attribute |
| F# |
|---|
[<SealedAttribute>] type FieldAttribute = class inherit Attribute end |
Remarks
By default property identifier equals to property name. This attribute enables to change this identifier.
public class Product { //Some fields private double price; private double lastPrice; //Property, which is accessed by the "LastPrice" identifier public double LastPrice { get { return lastPrice; } } //Property, which is accessed by the "CurrentPrice" identifier [Field("CurrentPrice")] public double Price { get { return price; } } } public void HowToUseFieldAttribute(Grid grid) { //Initialize the header grid.Headers.Add(new Header()); grid.Headers[0].Add(new Column("LastPrice")); grid.Headers[0].Add(new Column("CurrentPrice")); //Add a product to the grid. grid.Rows.Add(new Product()); } | |