JetBrains Rider 2017.3 Help

Code Inspection: Parameter name differs in partial method declaration

When processing partial methods, C# compiler only checks the order and the types of the parameters, not their names. Although the compiler allows you to use different names for the same parameters in the defining and in the implementing declarations, the example below demonstrates why this could be a bad practice.

JetBrains Rider detects mismatching parameter names and suggests that you use the same names for the same parameters. As it is impossible to infer which parameter name is meant to be correct, JetBrains Rider does not offer any quick-fixes for this warning.

partial class Item { partial void ToCart(int itemId, int transactionId); partial void ToCart(int transactionId, int itemId) { Console.WriteLine($"{transactionId}: success"); Console.WriteLine($"{itemId} added to cart"); } }
Last modified: 19 April 2018

See Also