The following two StyleCop rules collide!
SA1202 : All private methods must be placed after all public methods.
SA1204 : All static private methods must be placed before all non-static private methods.
class Foo
{
public static void Bar() { ... }
private static void Grep() { ... }
public void Meep() { ... }
private void Moop() { ... }
}
Given the class above, StyleCop will complain that a private method has been declared above the a public method
class Foo
{
public static void Bar() { ... }
public void Meep() { ... }
private static void Grep() { ... }
private void Moop() { ... }
}
Given the class above, StyleCop will complain that a static method has been declared beow an instance method.
If I wish to be completely anal with my code and ensure StyleCop always passes validation, what can I do, or is the only option simply to (God forbid) switch off one of these rules?
There doesn't appear to be any conflict here. Is there a third rule you are not showing?
SA1202 : All private methods must be placed after all public methods.
That first rule is only specifying the private/public ordering.
SA1204 : All static private methods must be placed before all non-static private methods.
That second rule is only specifying the static/non-static ordering within the private methods.