Tuesday, November 26, 2013

expandoObject: property get


namespace Qwerty
{
public static class Asdfg
{
private static dynamic xp = new ExpandoObject();

public static void BuildTheExpandoObject(double[] arrayOfDoubles)
{
Asdfg.xp.DoubleArray = arrayOfDoubles;
Func<int, double> funcintdouble = (i) => xp.DoubleArray[i];
Asdfg.xp.DoubleArrayValue = funcintdouble;
}

public static dynamic GetExpandoObject()
{
return Asdfg.xp;
}
}
}

namespace Example_ExpandoObject
{
class Program
{
static void Main(string[] args)
{
double[] arrayOfDoubles = { -1, 0, 1, 2, 3, 4, };
Qwerty.Asdfg.BuildTheExpandoObject(arrayOfDoubles);

//
// ---
//

int index0 = 0;
Console.WriteLine("value index {0} = {1}"
, index0
, Qwerty
.Asdfg
.GetExpandoObject()
.DoubleArrayValue(index0)
);

int index5 = 5;
Console.WriteLine("value index {0} = {1}"
, index5
, Qwerty
.Asdfg
.GetExpandoObject()
.DoubleArrayValue(index5)
);

Console.WriteLine("type at index {0} = {1}"
, index5
, Qwerty
.Asdfg
.GetExpandoObject()
.DoubleArrayValue(index5)
.GetType()
);

Console.ReadKey();
}
}
}




... don't disturb ... life is short, and I have to think what I'll do next ...


No comments:

Post a Comment