diff --git a/C# Coding Standards and Naming Conventions.md b/C# Coding Standards and Naming Conventions.md index 66a39f1..6cada74 100644 --- a/C# Coding Standards and Naming Conventions.md +++ b/C# Coding Standards and Naming Conventions.md @@ -413,7 +413,7 @@ public class BarcodeReadException : System.Exception ***Why: consistent with the Microsoft's .NET Framework and easy to read.*** -#### 26. Do use prefix Any, Is, Have or similar keywords for boolean identifier : +#### 26. Do use prefix Any, Is, Have or similar keywords for boolean identifier: ```csharp // Correct @@ -424,6 +424,24 @@ public static bool IsNullOrEmpty(string value) { ***Why: consistent with the Microsoft's .NET Framework and easy to read.*** +#### 27. Use Named Arguments in method calls: +When calling a method, arguments are passed with the parameter name followed by a colon and a value. + +```csharp +// Method +public void DoSomething(string foo, int bar) +{ +... +} + +// Avoid +DoSomething("someString", 1); +// Correct +DoSomething(foo: "someString", bar: 1); +``` + +***Why: consistent with the Microsoft's .NET Framework and easy to read. In Named Arguments, we do not need to pass the parameters in order as defined on method definition, so we can pass the arguments in any order on method calling.*** + ## Offical Reference 1. [MSDN General Naming Conventions](http://msdn.microsoft.com/en-us/library/ms229045(v=vs.110).aspx)