It is absolutely optional in the example you provide.
Mainly, it implicitely tells the user that the member that is worked with is part of the current class object.
One practice was to differentiate parameters from members or fields like the following:
public class Customer {
private string name;
public Customer(string name) {
this.name = name;
}
}
For readability's sake, one would put this
in front of the name
field to make it clear that the value of the name
parameter is assigned to the this class' name
field.
In such situation, it is necessery, as both the constructor parameter and the field have the same name. Otherwise, if they were different variable names, the this
keyword would be optional.