Merge pull request #33 from dnsnx/Add_method_calling

ISSUE #32 - Add Named Arguments
This commit is contained in:
Konstantin Taranov
2021-02-18 11:53:28 +03:00
committed by GitHub
+19 -1
View File
@@ -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)