From 9c3c081fbb9c0e371720f182f476bd37cdfa71c3 Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Wed, 16 May 2018 20:06:51 +0200 Subject: [PATCH] Revert: replace underscores with discards (#164) Because the current example does not compile. Discards can be used at the call site (arguments), but not at declaration site (parameters), which is what happens here. --- _pages/1700_NamingGuidelines.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_pages/1700_NamingGuidelines.md b/_pages/1700_NamingGuidelines.md index 7ff264f..9ed6d61 100644 --- a/_pages/1700_NamingGuidelines.md +++ b/_pages/1700_NamingGuidelines.md @@ -139,10 +139,10 @@ Suppose you want to define events related to the deletion of an object. Avoid de ### Prefix an event handler with "On" (AV1738) ![](/assets/images/3.png) It is good practice to prefix the method that handles an event with "On". For example, a method that handles the `Closing` event can be named `OnClosing`. -### Use an underscore for irrelevant parameters (AV1739) ![](/assets/images/3.png) -If you use a lambda expression (for instance, to subscribe to an event) and the actual arguments of the event are irrelevant, use discards to make that explicit: +### Use an underscore for irrelevant lambda parameters (AV1739) ![](/assets/images/3.png) +If you use a lambda expression (for instance, to subscribe to an event) and the actual parameters of the event are irrelevant, use the following convention to make that explicit: - button.Click += (_, _) => HandleClick(); + button.Click += (_, __) => HandleClick(); ### Group extension methods in a class suffixed with Extensions (AV1745) ![](/assets/images/3.png) If the name of an extension method conflicts with another member or extension method, you must prefix the call with the class name. Having them in a dedicated class with the `Extensions` suffix improves readability.