Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.15 KB

GU0022.md

File metadata and controls

50 lines (36 loc) · 1.15 KB

GU0022

Use get-only

Topic Value
Id GU0022
Severity Hidden
Enabled True
Category Gu.Analyzers.Correctness
Code GU0022UseGetOnly

Description

Use get-only.

Motivation

The property is only assigned in constructor or in property initializer and can be made get-only.

How to fix violations

Use the code fix.

Configure severity

Via ruleset file.

Configure the severity per project, for more info see MSDN.

Via #pragma directive.

#pragma warning disable GU0022 // Use get-only
Code violating the rule here
#pragma warning restore GU0022 // Use get-only

Or put this at the top of the file to disable all instances.

#pragma warning disable GU0022 // Use get-only

Via attribute [SuppressMessage].

[System.Diagnostics.CodeAnalysis.SuppressMessage("Gu.Analyzers.Correctness", 
    "GU0022:Use get-only", 
    Justification = "Reason...")]