Change from const to property and static context (C#) -
i had public class that:
public class classn { public const int someint = 16; ... }
this called somewhere else using
int myint = classn.someint
now have change 16 more dynamic , looks this:
public int someint { { //this method not static , cant changed static return getintdynamically(); } }
of course call not working anymore, because of static context. cant create new instance of classn ... option not violate coding rules?
thanks
if getintdynamically
not static , can't made static, have no other option create instance of classn
.
Comments
Post a Comment