Gets a value of a data object property.
Namespace: Dapfor.Net.Data
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)
Syntax
C# |
---|
public interface IGetter |
Visual Basic |
---|
Public Interface IGetter |
Visual C++ |
---|
public interface class IGetter |
F# |
---|
type IGetter = interface end |
Remarks
In some cases getting values of data objects through the IDataField interface may be a costly operation because it occurs through the reflection.
To accelerate the values getting, the data objects may implement IGetAccelerator interface. In this case the values are returned through the delegating mechanism
and not through the reflection.
Examples
![]() | |
---|---|
public class TestClass : IGetAccelerator { private int intValue; private double doubleValue; //Some property that returns int value public int IntValue { get { return intValue; } set { intValue = value; } } public double DoubleValue { get { return doubleValue; } set { doubleValue = value; } } //IGetAccelerator implementation. public IGetter GetGetter(string fieldId) { switch(fieldId) { //This implementation returns a delegate that calls IntValue property case "IntValue": return new Getter<int>(delegate { return IntValue; }); //This implementation directly calls the DoubleValue method and returns the result case "DoubleValue": return new ValueGetter(DoubleValue); } return null; } } //Demonstrates how the data object can be added to the grid public void HowToUseExample(Grid grid) { grid.Rows.Add(new TestClass()); } |