Learn about the C #

 

For a long time knowledge of C # is stuck on the vague impression language fully object-oriented software development of micro, its lack of multi-file project above the level of the ability to modify, and driven by the current popularity, want to learn about it and use .

 

Then download a C # open source project from the git, open the project to see doubled. . .

 

I. Project

  Project to .cs file-based, small compiled binaries, configuration files, and the project is another suffix.

  Although most of the suffix .cs, but still works with different specific names of files to separate file storage different functions.

  .Cs source code and its files are files, and the C / C ++ is different is that it is not the first document, which is probably the biggest obstacle C in the fourth year / C ++ programmers.

  There are many open source C # library, but in the form of a reference included in the project, which simplifies the replacement and similar C / C ++ header files functions.

  C #, more out of commission, the event mechanism,  Delegates are similar to function pointers in C ++; however, delegates are type-safe and reliable. Class or object can notify what happened to the other class or object through the event. Classes send (or caused by) an event known as the "publisher" to receive (or handle) the event is called "subscribers."

 

Second, operator

  Learn a new language, the most important thing is to understand its operator, the operator is the language of the chip. This is the most basic rules constitute the entire language. All data, whether keywords, variables, expressions, operators need to have connected makes sense, otherwise, nothing but a dead letter heap.

  Because the operator and the ever-changing language, control operator as if beach-goers between heaven and earth, the nine days under the ocean.

 

  After learned that some of the key features of C # compared to C / C ++, there are several operators need special attention :( If overload ==, you must also reload! =)

 

  + Operator can be used as a unary operator can also be used as a binary operator, provides the delegate type binary + operator, the operator performs delegate concatenation.

  - operators can be used as a unary operator can also be used as binary operators delegate type provides two yuan - operator, the operator performs delegate removed.

Multiplication operator * (*) for calculating the number of product operation. Also as dereference operators, allows reading and writing pointers. * Operator is also used to declare the type of pointer and dereference. The operator can only be used in an unsafe context, the keyword is represented by the unsafe and require / unsafe compiler option. Dereference operator is also referred to as the indirection operator.

& Operator can be used as a unary operator can also be used as binary operators. One yuan & operator returns the address of the operand (requires unsafe context).

+ = Addition assignment operator can not directly = + operator overloads, but user-defined types can overload the + operator (see operator). [+ Contact with the line to drag-related functions, the operator must also have the function similar to other related symbols]

<< = left shift assignment operator.

-> operator to dereference a pointer to access the member together. -> operator can only be used in unmanaged code. You can not be overloaded -> operator.

?? ?? if left operand operator is non-empty, the operator returns the left operand, otherwise the right operand.

 

Particular, this symbol is not included in the lower C # operator, the only class in the inheritance

 : For inheritance

 

Third, keyword

  The main focus for a moment C # and C / C ++ in different keywords for quick understanding of grammar

  Several typical keywords such as:

  decimal 16-byte floating-point, floating-point type double than twice as large as 8 bytes.

  delegate A reference type or naming method for encapsulating anonymous method.

  event Publisher keyword is used to declare class events.

 

  By keyword, you can know, C # is a strongly typed

 

 

Guess you like

Origin www.cnblogs.com/ice-arrow/p/11951297.html