Accelerates getting values from properties.

Namespace: Dapfor.Net.Data
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: (


public interface IGetAccelerator
Visual Basic
Public Interface IGetAccelerator
Visual C++
public interface class IGetAccelerator
type IGetAccelerator =  interface end


In many cases, the values getting from the IDataField may be a long operation because it can occur by the reflection. To accelerate the values getting, the data objects may implement IGetAccelerator interface. Such objects can get values by using the delegating mechanism or direct method or property call which are much faster than reflection.


 Copy imageCopy
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(IDataField field)
        switch (field.Id)
            //This implementation returns a delegate that calls IntValue property
            case "IntValue": 
                return new Getter<int>(delegate { return IntValue; });

            //This implementation creates a new object of the ValueGetter type which keeps a value, returned by the DoubleValue property call
            case "DoubleValue": 
                return new ValueGetter(DoubleValue);
        return null;

See Also