I. Syntax features 1. using introduces the type of using keyword in. NET. Here it refers to the introduction of namespace. It is very convenient to support the using type, for example: using System. runtime. interopServices. marshall; // you can directly call the static method and attribute using List of the Marshall class <string> = StringList; // do not call again after writing <> 2. variable namespaces sometimes process complex services. Even a single unpartitioned processing unit contains many variables, naming and organizing becomes a headache, it is not worthwhile to encapsulate these classes. If you can define a namespace when declaring a variable or field, this problem can be solved: class ProductUtil {namespace Price {float old; float New; float standard;} float GetPrice () {float Price. discount; // declare discount // calculate the price... return Price. new ;}} The namespace can be in the method or type. After a life space is declared, a variable can be declared separately. 3. declare variables with out. experienced developers often use Try-Parse to avoid exceptions. Generally, methods such as TryParse and TryGet send results to parameters declared with out. I always think, why should we declare this parameter first? Int value; // This statement can be completely removed. if (int. tryParse (s, out value) {Console. writeLine (value);} 4. omitting the attribute field C #3.0 introduces the simplified attribute method: public string Text {get; set ;}. However, it is still incomplete. If the get set contains some processing logic, the field cannot be omitted. If a keyword can be used to replace a field, the code will be more neat. I think it is good to use default to indicate a field in the attribute. If you want to directly access this field in other internal methods (it should be very careful), you can use default (this. text), it seems a little troublesome, but this situation is rare, so it will be more eye-catching. 5. the most annoying thing to do is to judge the Code if (list! = Null & list. count> 0) {return list. last ();} many times, you don't have to deal with the case that list is null or empty. If the code above can be written like this, it will be very popular: return list. last ()??; From then on, we can sing: Brother, you write down boldly ~~, Don't be afraid of exceptions ~~ 6. Constraints of constructors with parameters generic constraints can only declare constructors without parameters, which makes no sense. It should be as follows. Public class MyClass <T> where T: class, new (int ){...} or do not limit the constructor parameter: public class MyClass <T> where T: class, new {...} if an incompatible constructor is called, IDE can check it during compilation. 7. When a case can be used with an expression just learning to program a switch case, it is hard to understand the restriction that a case can only be followed by a constant. This is actually a bug, including other languages. 8. Why didn't I extend attributes when the extension method was launched? I know there must be some reason, but this is actually a good one. 9. The binding operator directs AB to the same reference for two class instances A = B. If the subsequent reference of B changes, the binding operator has no effect on. Many beginners cannot figure out the role of the = Operator and think that B is changing, and A is also changing. In fact, this feature is always lacking in C #. If we can enable A = B to bind A and B (the expression on the Left can be used), it is easy to do A lot of work. The GC problem should be considered. If A is not recycled, B cannot be recycled. 10. the project references the Native dll. To call the C/C ++ assembly, you must check the parameters, convert the type, and declare it like this: [DllImport ("User32.dll", CharSet = CharSet. unicode)] public static extern int MessageBox (int h, string m, string c, int type); why cannot it be referenced like this.. NET dll references the dll written in C/C ++, or adds a Native Reference Directory like the Service Reference to automatically generate a proxy class. 11. The Fluent syntax uses the syntax sugar to greatly reduce the use of keywords. For example, ToSomeType () can be used for (int) value and value as string. If you call a constructor, You can omit the new keyword. After using the first using declaration to call a class of static methods, you can use static methods as an extension method of any parameter. Using String; static void SortDates (string dates) {var lstDates = dates. split (','). select (d => d. toDateTime (); // ToDateTime () is equivalent to (DateTime) var endDate = DateTime (lstDates. max (). year, 12, 31); // omitting new dates = lstDates. orderBy (d => d ). join (","); // String. join method variable extension method} 12. global configuration is actually implemented by Visual Studio. If a static method is called directly to implement the extended attributes, the automatic prompt will be congested, reducing the convenience. You can configure it in the Project Properties and import a configuration template. By default, the infrequently used members are hidden, such as Equals/ReferenceEquals/GetHashCode that cannot be discarded by all types. This template can also use using as the alias type, so you do not have to declare them one by one in each file. In this way, the C # keyword will be greatly reduced, and you can also customize the names that better suit individual or team habits. 2. Although the dynamic support for C # reflection is perfect, the performance is still poor and unfriendly. If you want to modify the Code at runtime, that is, use the most advanced Lamda Expression, and the third-party framework MonoCecil is very troublesome, let alone use Emit and Code Generator. Therefore, C # is basically a static language. It is still very difficult to meet the high-scalability development requirements such as AOP. We have long been eager to see a project-based Metadata Framework to completely free up the productivity that has been bound by metadata and dynamic code for a long time. First, enhance the T4 template to make it easier to reference itself and third-party assembly. The implementation of the syntax like Razor should not be too much. Using the T4 template can greatly improve code reusability (personal understanding of the AVL Tree and the red and black tree), and avoid metadata operations (the ToString method with a performance difference of times ). For a project, a compilation option should be provided to automatically generate a strongly typed metadata assembly. For example, in MVC, you can use: using MySite. metadata; // introduce the automatically generated Metadata Assembly namespace MySite. controllers {public class HomeController: Controller {public ActionResult Home () {if (! User. identity. isAuthenticated) return Views. login; // automatically generated by Views, replacing View ("Login") return View () ;}}suppose there is a Person class with three attributes: Name/Sex/Birthday, we want to add an Age attribute: MyProject. metadata. class. person. createProperty ("Age", p => (DateTime. now-p. birthday ). year); when calling these dynamic attributes, you only need to use the dynamc feature (currently this feature is very limited). It is best to provide a attr function similar to JQuery for the dynamic type. If Javascript eval functions can be implemented, the C # code may become unfamiliar to me. Iii. programming language design has been developing for more than half a century. First, variable-oriented assembly language. After the emergence of advanced languages, Pascal/C language is oriented to processes and variables, to C ++. C # and Java are only greatly improved in terms of language features, and the design concept has not advanced. C #, as the most advanced programming language, reflects the bottleneck of the current language development. To make some breakthroughs, we must have new design ideas to raise the granularity to a new level. After my personal analysis, I believe that the successor of C # Or C # will develop in three directions in the future: 1. the business logic for future-oriented programming languages will be more complex, and collection processing is the core content of business logic. LINQ puts C # at the forefront of the industry, but there are still many problems. Too many Collection types are too messy due to historical reasons. It is required to support generics. We need to use consistent high-performance Collection types based on variability, ordering, Hash features, and concurrency requirements. These collection classes can be flexibly converted to intelligently process bottom-layer operations such as resizing and replication, and cannot be transferred across program domains as in LINQ. This requires both the framework and CLR support. 2. Concurrency-oriented is a natural direction. unless there is a breakthrough in light, biology, and quantum computing technology, the single-core limitation of semiconductor circuit processors will become increasingly difficult to break through, and the trend of multi-core computing will become increasingly fierce. In future programming languages, concurrency support must be integrated into its underlying layer. Taking Node. js as an example, we have already begun to use this feature. All its accesses to IO are non-blocking and asynchronous operations are supported from the underlying layer. For C #, it is not just the framework repair and completion, but the full support of CLR. The emergence of async and await is a good sign and we look forward to seeing more such developments. 3. For task Node. js, it implements parallel operations through event loop, which can only process the simplest multi-task synchronization. To implement a real concurrent language and meet the increasingly complex business logic processing, strong support must be provided for concurrent unit-task.. NET supports a series of classes under System. Threading. Tasks for the task, but this is only the beginning. We need to dynamically create, decompose, modify, and cancel tasks. We need to conveniently obtain and control the task status, manage time-out and resources, calculate task efficiency, and handle exceptions. The road ahead is still far away, long, and wonderful. I will continue to study these areas in the future.