internal abstract class ReadonlyCoefs
{
public const Boolean Allowed = true;
public const Boolean Disallowed = false;
public abstract Boolean GetCoef();
}
internal class Coefs : ReadonlyCoefs
{
public override Boolean GetCoef() { ... }
public void SetCoef() { ... }
}
Now, suppose i want to use it somewhere like this
if (variable == ReadonlyCoefs.Allowed)
...
I don't think i want to have Readonly prefix.
In this case i can just add instance methods IsAllowed and SetAllowed, SetDisallowed, but if there are a lot of consts, how to be in such a case?
Aucun commentaire:
Enregistrer un commentaire