I am working on a C # library, so we are interested in breaking backward compatibility, but I was wondering if it is only possible to change the parameter name and maintain backward compatibility due to the ability to use named parameters? An example of what I'm trying to do is below
[Obsolete("use ChangeSpecificFoo(SpecificFoo specificFoo)")]
public void ChangeSpecificFoo(SpecificFoo foo)
{
_specificFoo = foo;
}
public void ChangeSpecificFoo(SpecificFoo specificFoo)
{
_specificFoo = specificFoo;
}
Just changing the parameter name poses a potential risk of backward compatibility because someone can invoke a method using named parameters such as ChangeSpecificFoo(foo: someSpecificFoo), but we cannot refuse a method by adding a new method with the correct parameter name because parameter names are not included in the method signature, so the compiler sees this as a duplicate.
? , , , , , ( , ), , , , .