| layout | page |
|---|---|
| title | CC0006 |
| tagline | ForInArrayAnalyzer |
|TypeName|ForInArrayAnalyzer | |Check Id | CC0006 | |Category | Style | |Severity | Info |
A simple iteration using a for loop and it is not interacting
with the indexer anywhere but in a single place where it
accesses the array used in the for condition to assign it to
a variable, which is itself used isnde the for loop.
{% highlight csharp %} var array = new [] { 1, 2, 3 }; for (int i = 0; i < array.Length; i++) { var someNumber = array[i]; //some code } {% endhighlight %}
A code fix will be presented to you that will transform the code:
{% highlight csharp %} var array = new [] { 1, 2, 3 }; foreach (var someNumber in array) { //some code } {% endhighlight %}

None
TBD