Skip to content

Latest commit

 

History

History
91 lines (61 loc) · 1.19 KB

RCS1235.md

File metadata and controls

91 lines (61 loc) · 1.19 KB

RCS1235: Optimize method call

Property Value
Id RCS1235
Category Performance
Severity Info

Examples

Code with Diagnostic

string.Compare(x, y, StringComparison.Ordinal) // RCS1235

Code with Fix

string.CompareOrdinal(x, y)

Code with Diagnostic

string.Compare(x, y, StringComparison.CurrentCulture) == 0 // RCS1235

Code with Fix

string.Equals(x, y, StringComparison.CurrentCulture)

Code with Diagnostic

string.Join("", x, z, y) // RCS1235

Code with Fix

string.Concat(x, y, z)

Code with Diagnostic

Debug.Assert(false, "message"); // RCS1235

Code with Fix

Debug.Fail("message");

Code with Diagnostic

if (dic.ContainsKey(key)) // RCS1235
{
  dic[key] = value;
}
else
{
  dic.Add(key, value);
}

Code with Fix

dic[key] = value;

See Also

(Generated with DotMarkdown)