There is no advanced Syntax section, only basic syntax and OOP. C # is really a good language, and Poseidon is admirable.
Basic syntax
Two Boolean logical operators. Kan: Interesting
string format printing. Kan: Well, this is the API for people.
Arrays: The syntax for declaring C # arrays and declaring C + + arrays is different. In C #, the "[]" tag appears after the array type. Kan: C # array is good, more intuitive, there are more grammar sugar.
BOOL Type: There is no conversion between the bool type and other types (especially int). Kan: good
struct type: In C #, classes and structs are semantically different. A struct is a value type, and class is a reference type. Kan: good, value types and reference types are useful, otherwise C + + will not toss what pod.
Switch statement: Unlike the switch statement in C + +, C # does not support running from one case label to another case label. Kan: very good, switch through the most of the writing is missing the break
Delegate type: The delegate is basically similar to a function pointer in C + +, but the former is type safe and safe. Kan: excellent, one of C # 's biggest selling points, delegate very gracefully defines the callback, compared to the various function pointer type definitions in C + + is simply vomiting
Preprocessor directives are used for conditional compilation. Header files are not used in C #. Kan: Very good, in addition to despise C + + head file when the document
Exception handling: Use the finally statement. Kan: good
A non-escaped string. Kan: Excellent, this is the reading string.
C # operators: C # supports other operators, such as IS and TypeOf. It also introduces the different functions of some logical operators. Kan: good
The main method and the main function in C + + are declared differently. Also, compare the use of command-line arguments for each language. Kan: Well, finally don't have to fight for old Tan
Method parameters: C # supports ref and out parameters, which supersede pointers passing parameters by reference. Kan: excellent, explicit call, which is higher than C + + does not know where to go
Pointers are used only in unsafe mode in C #. Kan: Well, java because there is no pointer sales by a spray, had to pretend to have pointers. This facilitates marketing.
Local variables in C # cannot be used until they are initialized. Kan: good
Document comments. Kan: good
The function supports a parameter array. Kan: Well, it's much more comfortable than writing printf.
Oop
There are no global methods and global variables in C #: Methods and variables must be included in a type declaration, such as class or struct. Kan: Habit is good, the global method sometimes is very ugly, such as a getxxx, you exactly from where get.
Inheritance: A class can only inherit an implementation from a base class. In addition, a class or interface can implement multiple interfaces. Kan: A single inheritance is very good.
Class members have fields and attribute points. Kan: Yes, lazy people and diligent people can use
Property access syntax and Automatic properties. Kan: Well, better than handwriting getter,setter.
Hides an inherited member using the new modifier modifier explicitly. Kan: Very good
A partial class definition. Kan: Well, who rules the Java class can not more than how many rows, it is possible to godless.
Read-only fields. Kan: good
Static constructors. Kan: Well, finally don't have to write separately.
Reference:
https://msdn.microsoft.com/zh-cn/library/aa287549 (v=vs.71). aspx
This article is from the "play The Old G" blog, please be sure to keep this source http://goldlion.blog.51cto.com/4127613/1939424
A summary of the differences between C # and C + +