ReSharper 2024.3 Help

Code inspection: Parameter name differs between partial member declarations

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.

ReSharper 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, ReSharper 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: 11 February 2024