Suppose I have this code:
List<MyObj> resultList = new List<MyObj>();
foreach (var item in collection)
{
resultList.Add(new MyObj
{
X = item.foo,
Y = item.bar,
Z = [I want it to be X + Y]
});
}
I can't use the 'this' keyword. Is there another way of accomplishing this? Thanks!