SSW Foursquare

Do you declare member accessibility for all classes?

Last updated by Brady Stroud [SSW] 7 months ago.See history

Not explicitly specifying the access type for members of a structure or class can be misleading for other developers. The default member accessibility level for classes and structs in Visual C# .NET is always private. In Visual Basic .NET, the default for classes is private, but for structs is public.

Match MatchExpression(string input, string pattern)

Figure: Bad - Method without member accessibility declared

private Match MatchExpression(string input, string pattern)

Figure: Good - Method with member accessibility declared

Figure: Compiler warning given for not explicitly defining member access level

We have a program called SSW Code Auditor to check for this rule.

Adam Cogan
We open source.Loving SSW Rules? Star us on GitHub. Star
Stand by... we're migrating this site to TinaCMS