All rules
CA1050Design Enabled by default: As suggestion

Declare types in namespaces

Declare types in namespaces

Microsoft docs

Description

Types are declared in namespaces to prevent name collisions, and as a way to organize related types in an object hierarchy. Types that are outside any named namespace are in a global namespace that cannot be referenced in code.

Cause

A public or protected type is defined outside the scope of a named namespace.

How to fix violations

To fix a violation of this rule, place the type in a namespace.

Example

#pragma warning disable CA1050
// The code that's violating the rule is on this line.
#pragma warning restore CA1050

When to suppress

Although you never have to suppress a warning from this rule, it is safe to do this when the assembly will never be used together with other assemblies.

Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0