| Start |
|---|
| Optional parameters and named arguments We can omit the argument in the call if that argument is an Optional Argument Every Optional Argument has its own default value It will take default value if we do not supply the value A default value of a Optional Argument must be a
It must be set at the end of parameter list Method parameters with default values: As said by MSDN, A named argument , Enables you to pass the argument to the function by associating the parameter’s name No needs for remembering the parameters position that we are not aware of always. No need to look the order of the parameters in the parameters list of called function. We can specify parameter for each arguments by its name. Named arguments: Limitation of using a Named Argument Named argument specification must appear after all fixed arguments have been specified. If you use a named argument before a fixed argument you will get a compile time error as follows. Named argument specification must appear after all fixed arguments have been specified |
| Variance Generic interfaces and delegates can have their type parameters marked as covariant (opens new window) or contravariant (opens new window) using the For example, the existing interface The existing interface IComparer has been redefined as being contravariant: |
| Dynamic member lookup A new pseudo-type In this case, dynamic type is used to avoid more verbose Reflection. It still uses Reflection under the hood, but it's usually faster thanks to caching. This feature is primarily targeted at interoperability with dynamic languages. Dynamic type has applications even in mostly statically typed code, for example it makes double dispatch (opens new window) posible without implementing Visitor pattern. |
| Optional ref keyword when using COM The ref keyword for callers of methods is now optional when calling into methods supplied by COM interfaces. Given a COM method with the signature the invocation can now be written as either |
Read Article
https://develop.horje.com/learn/1434/reference