C #4.0 new features (2) named parameters, optional parameters for interoperation with COM
1. Introduction
C # (2.0) is a pure object-oriented language like Java. They all use overload rather than optional parameters. However, for other external
Named parameters and optional parameters in C,
The named parameters and optional parameters are new in C # framework 4.0.
1. Definitions and calls of common methods
Public void Demo1 (string x, int y) {// do something...} public void Main () {//
This is the first blog from a series of blog post which I'm planning to do on whet's new in Visual C #4.0
This is the first article in the series of Visual C #4.0 new features I plan to write.
Optional parameter (optional parameters)
Optional
Many developers asked why the named parameters and optional parameters were not added to the C # language until now. From the usage of other languages, they are all good features, especially when there are a lot of parameters in the method, but many
The three parameters of this introduction are grammatical sugars . 4. Array parameters When declaring a method, add the params keyword before the parameter. Simplified parameter invocation for added readability.Usage:(1) used when the parameter
The named parameter and optional parameter are new features of the C # Framework 4.0.I. General method definition and invocationpublic void Demo1 (string x, int y) { //do something ...} public void Main () { //Call Demo1 ("similar",
First, background:The Internet industry, in order to reduce program maintenance, upgrade deployment risk, often the program is split into many projects, compiled into multiple DLL deployment, so when released, only need to deploy the modified
Va Function Definition and VA macro
C language supports the VA function, which is an extension of C language. c ++ also supports the VA function, but it is not recommended in C ++.The polymorphism introduced by C ++ can also be used to implement
1. Optional parameters and named parameters1.1 Optional parametersGrammar:[Modifier] Return type method name (required parameter n, optional parameter n)Attention:1. The required parameters may not exist, or can have multiple, optional parameters
The number of new postings on the. NET blog has been decreasing. I think everyone should be diligent, share their experience and ideas, do not let this blog decline.
VB supports the feature "optional parameters" starting from 4.0. That is, some of
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.