Skip to main content

CRR0016 - Method call's return value is ignored

This analyzer detects calls to non-void methods where the return value is not considered. Normally, if a method returns data, you should check or save the output. Consider the following example.

string s = "(10.2, 381.8)";
s.Replace(",", ";"); // CRR0016

In this code, the programmer expects that the Replace method modifies the source string. Since it is not so, the statement is useless and should be changed as follows.

string s = "(10.2, 381.8)";
s = s.Replace(",", ";");