Marking a method with the Pure
attribute indicates that the method doesn’t make any visible state changes. Therefore, a Pure method should return a result otherwise it
indicates a no-operation call.
Using Pure on a void method is either by mistake or the method is not doing a meaningful task.
class Person
{
private int age;
[Pure] // Noncompliant: The method makes a state change
void ConfigureAge(int age) =>
this.age = age;
}
class Person
{
private int age;
void ConfigureAge(int age) =>
this.age = age;
}