I\'ve got an object that has a collection of properties. When I get the specific entity I can see the field I\'m looking for (opportunityid
) and that it\'s
If the name of the property is changing, you should use GetValue:
info.GetValue(attr, null);
The last attribute of that method can be null
, since it is the index value, and that is only needed when accessing arrays, like Value[1,2]
.
If you know the name of the attribute on beforehand, you could use the dynamic
behavior of it: you can call the property without the need of doing reflection yourself:
var x = attr.Guid;