When you do not use the return value of a method with no side effects, it indicates that something is wrong. Either this method is unnecessary, or the source code does not behave as expected and could lead to code defects.
For example, there are methods, such as https://learn.microsoft.com/en-us/dotnet/api/system.datetime.addyears[DateTime.AddYears], that don't change the value of the input object, but instead, they return a new object whose value is the result of this operation, and as a result that you will have unexpected effects if you do not use the return value.
* Although https://learn.microsoft.com/en-us/dotnet/api/system.string.intern[`string.Intern`] has a side effect, ignoring its return value is still suspicious as it is the only reference ensured to point to the intern pool.
* LINQ methods can have side effects if they are misused. For example:
Such code should be rewritten as a loop because https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.all[`Enumerable.All<TSource>`] method should be used to determine if all elements satisfy a condition and not to change their state.
=== Exceptions
This rule doesn't report issues on invocations with https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/out-parameter-modifier[`out`] or https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ref[`ref`] arguments.