design patterns - C# - Member variables passed to internal methods? -
when class has internal variable, should passed methods internally, or should method 'know' it?
eg
int _someid; private void myfunction(int id) { use id ... }
or
private void myfunction() { use _someid ... }
no, should use second example.
if method meant use member variable, second example correct.
if intentions use method other passed in values, other methods within class, or maybe external calls, first option do.
Comments
Post a Comment