c# - Change values in Class Attribute at runtime -
if have class this
[attr("blah", data = "blah")] public class test : superclass{} is there way can change values of attribute of instance of class @ runtime? eg in pseudo code
superclass test = new test(); test.attr.value = "blah1"; test.attr.data = "blah2"; (i have instance of class want change attributes on, cast class extends)
there no implicit connection between attributes , objects instances. between class , attribute. best bet attribute in constructor , "cache" values in properties on object. of course doesn't make sense if looking @ test class, make sense if constructor of superclass looks custom attributes on type retrieved "this.gettype()".
Comments
Post a Comment