``++ToCharArray++`` can be omitted when the operation on the array could have been done directly on the string, such as when iterating over the characters in a string, and when accessing a character in a string via an array index. In those cases, explicit ``++ToCharArray++`` calls should be omitted.


== Noncompliant Code Example

----
string str = "some string";
foreach (var c in str.ToCharArray()) // Noncompliant
{
  // ...    
}
----


== Compliant Solution

----
string str = "some string";
foreach (var c in str)
{
  // ...    
}
----


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
