set value of a property of an anonymous type using reflection / TypeDescriptor is it possible?
According to @Slaks ,
C# anonymous types are immutable, and their properties cannot be
changed.
example :
dynamic p = new {aaa="1", bbb="2"};
my question is , What is immutable ? ( structure , values , whole world ?)
the structure of
{
something (in type of string)
,
something (in type of string )
}
(meaning – the structure is immutable – and i cant change its structure)
or
{
something called aaa (in type of string)
,
something called bbb (in type of string )
}
or
the whole world :
{
something (in type of string + value of 1)
,
something (in type of string + value of 2)
}
?
Immutable means it cannot change.
The structure or the values, in this case.
The type of
pwill always be twostringproperties – one calledaaawith the value"1"and the other one calledbbbwith the value"2".You cannot add members to this anonymous type, nor can you change the values of the properties.