A cache that keep a value returned from 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 sealed class ValueGetter : IGetter
Visual Basic
Public NotInheritable Class ValueGetter
	Implements IGetter
Visual C++
public ref class ValueGetter sealed : IGetter
F#
[<SealedAttribute>]
type ValueGetter =  
    class
        interface IGetter
    end

Remarks

 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;
    }
}


//Demonstrates how the data object can be added to the grid
public void HowToUseExample(Grid grid)
{
    grid.Rows.Add(new TestClass());
}

Inheritance Hierarchy

System..::..Object
  Dapfor.Net.Data..::..ValueGetter

See Also