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

Popular posts from this blog

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

Java - Returning an array from a method to main -