Basically what I want is the same that is answered here but in C#: Self-references in object literal declarations
What I have is this code:
private List<myObject> myFunction()
{
return myList.Select(l => new myObject
{
propA = 6,
propB = 3,
propC = propA + propB
}
).ToList();
}
Of course it does not work, because I cannot reference propA and propB this way. What it the right way to do it?
Thank you