You cannot refer to properties of the object you're constructing on the right-hand side of a =
, i.e., you can only assign to the properties, but not read from them.
Possible solution:
var expandAndSelect = true;
var result = new MyClass
{
Title = "Murali",
Key = "MM",
Expand = expandAndSelect,
Select = expandAndSelect,
};
and
var select = true;
var expand = false;
var result = new MyClass
{
Expand = expand,
Select = select,
Editable = select & expand,
};