-
Notifications
You must be signed in to change notification settings - Fork 4
AA1301VariablesShouldBeAssignedOnceOnly
Warning: this wiki page is auto-generated by the Arnolyzer solution-build process. Do not directly edit this page, as your changes will be lost on the next commit. To edit this page, please refer to Contributing to this project.
These wiki pages reflect the state of the project in development, per the last commit. For details of the latest release of the Arnolyzer Analysers, please see the Arnolyzer website.
Report code: AA1301-VariablesShouldBeAssignedOnceOnly
Status | Implemented |
Description | Variables should be treated as immutable and should not be overwritten |
Category | Immutability Analyzers |
Enabled by default: | Yes |
Severity: | Error |
There currently aren't any implemented code-fixes for this rule.
This rule can be suppressed using the following attributes:
[MutableVariable]
A method annotated with MutableVariable attribute is allowed to have variables that change value (ie canbe reassigned. The variables affected must be named in the MutableVariable attribute attribute, eg
[MutableVariable attribute("var1")]
public void F()
{
var var1 = 1;
var1 = 2;
}
Multiple variables can be supplied to the attribute, eg [MutableVariable attribute("var1", "var2")]