i've seen various threads on how call property's private setter via reflection. however, auto-properties without setter?
public class test { public string property { get; } = ""; } is possible set value of readonly property using reflection?
propertyinfo.setmethodreturns nullpropertyinfo.setvaluefails
any ideas?
is possible set value of readonly property using reflection?
no. properties backed read-only fields. there is no setter; assignments performed in constructor write directly fields.
if design makes want write read-only property via reflection, should revisit design :)
Comments
Post a Comment