Which is better? private static vs private
Posted
by
KiD0M4N
on Stack Overflow
See other posts from Stack Overflow
or by KiD0M4N
Published on 2011-01-15T09:47:48Z
Indexed on
2011/01/15
9:53 UTC
Read the original article
Hit count: 351
In this code sample:
public class SuperMan {
private static bool IsProper(decimal x) {
return x > 31.0m && x < 45.0m;
}
public bool CheckStuff(string a, string b, string c) {
// lots of code, some of which introduces a variable x
return IsProper(x) && /* other conditions */;
}
}
Should IsProper(..) be a 'private static' or a 'private'. Assuming:
- IsProper(..) doesn't need to access any instance state.
© Stack Overflow or respective owner