-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Design.DoNotDeclareProtectedMembersInSealedTypeRule(git)
Sebastien Pouliot edited this page Mar 2, 2011
·
1 revision
Assembly: Gendarme.Rules.Design
Version: git
This rule ensures that sealed types (i.e. types that you can't inherit from) do not define family (protected in C#) fields or methods. Instead make the member private so that its accessibility is not misleading.
Bad example (field):
public sealed class MyClass {
protected int someValue;
}
Bad example (method):
public sealed class MyClass {
protected int GetAnswer ()
{
return 42;
}
}
Good example (field):
public sealed class MyClass {
private int someValue;
}
Good example (method):
public sealed class MyClass {
private int GetAnswer ()
{
return 42;
}
}
- Prior to Gendarme 2.2 this rule applied only to fields and was named DoNotDeclareProtectedFieldsInSealedClassRule
You can browse the latest source code of this rule on github.com
Note that this page was autogenerated (3/17/2011 1:55:44 PM) based on the xmldoc
comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!