Skip to content
ptittof57 edited this page Aug 15, 2015 · 3 revisions
<title>SA1202: ElementsMustBeOrderedByAccess</title> <script src="script/helpstudio.js" type="text/javascript"></script> <script src="script/StandardText.js" type="text/jscript"></script>
<script type="text/jscript">WritePageTop(document.title);</script>

TypeName

ElementsMustBeOrderedByAccess

CheckId

SA1202

Category

Ordering Rules

Cause

An element within a C# code file is out of order within regard to access level, in relation to other elements in the code.

Rule Description

A violation of this rule occurs when the code elements within a file do not follow a standard ordering scheme based on access level.

To comply with this rule, adjacent elements of the same type must be positioned in the following order by access level:

public

internal

protected internal

protected

private

Complying with a standard ordering scheme based on access level can increase the readability and maintainability of the file and make it easier to identify the public interface that is being exposed from a class.

How to Fix Violations

To fix an instance of this violation, order the elements in the file in the order described above.

How to Suppress Violations

[SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1202:ElementsMustBeOrderedByAccess", Justification = "Reviewed.")]
Clone this wiki locally