C #, read "C Sharp", Chinese transliteration for the time being, non-professionals generally read "C well", professionals generally read "C sharp".
C # is a secure, stable, simple, elegant, object-oriented programming language derived from C and C + +. It inherits the power of C and C + + while removing some of their complex features (for example, no macros and templates, multiple inheritance is not allowed). C # combines VB's simple visualization and C + + 's high operational efficiency with its powerful operational capabilities, elegant grammatical style, innovative language features and convenient component-oriented programming support. The preferred language for net development. and C # becomes the ECMA and ISO standard specification. C # seems to be based on C + +, but also into other languages such as Pascal, Java, VB and so on. A new generation of languages with a high starting point and fast development, this five-year-old has gone through many more than 10 years of its predecessors. To be fair, C # is the best practical language for both system development and application development, and is likely to be the first "all-in-one" language in the history of programming languages.
Main Features:
Features of C # inherited from Java
Class: The declaration of a class in C # is similar to Java. This is reasonable because the experience tells us that the Java model works very well. The Java keyword Import has been replaced with a using, which plays the same role. The starting point for a class to start is a static method, main (). The following Hello The world program shows the basic form:
Using System;
Class Hello
{
static void Main ()
{
Console.WriteLine ("Hello, World");
}
}
In this example, the system name refers to a namespace (namespace) that includes a collection of basic C # Utilities. This namespace includes the console class, which is used in this example to output a string. A class can be abstract and non-inheritable: A class that is declared abstract cannot be instantiated; it can only be used as a base class. The C # keyword sealed, like the Java keyword final, declares that a class is not abstract, but it cannot be used as a base class for another class. Interface: As in Java, an interface is an abstract definition of a set of methods. When a class or struct implements an interface, It must implement all the methods defined in this interface. A single class can implement several interfaces. There may be some subtle differences in the future, but this feature does not seem to change in comparison with Java.
C # inherits from the features of:
Compile
The program compiles directly into the standard binary executable form. However, C # 's source program is not compiled into binary executable form, but rather an intermediate language (IL), similar to Java bytecode. If the previous Hello World program is saved as a text file and named Hello.cs, it will be compiled into an executable program named Hello.exe.
Structural body
A C # struct is similar to a C + + struct because it can contain data declarations and methods. However, unlike the c++,c# struct, which is different from the class and does not support inheritance. However, as with Java, a struct can implement an interface.
Pre-compilation
Precompiled directives in C # support conditional compilation, warnings, error reporting, and compilation Line control. The available precompiled directives are:
#define
#undef
#if
#elif
#else
#endif
#warning
#error
#line []
There is no include pseudo-directive. You can no longer assign a value to a symbol with a # define statement, so there is no concept of source code substitution-these symbols can only be used in # if and #elif pseudo-directives. Number in #line pseudo-directive (and optional name) can modify line number and # The file name of the warning and #error output results.
Operator overloading
Some operators can be overloaded, while others cannot. In particular, no assignment operator can be overloaded. The single-mesh operator that can be overloaded is:
+ - ! ~ + +--true false
The two-tuple operators that can be overloaded are:
+-*/% & | ^ << >> = = = > < >= <=
C # Unique Features: intermediate code, declarations in namespaces, basic data types, two basic classes, parameter passing, integration with COM, index subscript.
The development Prospects of C #:
According to the evaluation of scientific and technical Media, C # has almost all the latest achievements in software development and software engineering Research: Object-oriented, type-safe, component technology, automatic memory management, cross-platform exception handling, versioning, code security management .... C # will inevitably rise and become the protagonist on the Windows platform, and Java will dominate the UNIX, Linux and other platforms, and C + + will continue to play a part in the System software field.
Summary: C # Learning makes me understand a lot, I have to work hard, I am too poor. Strive!
Learning in C #