Easily learn the basics of C

  • 2021-08-21 21:16:16
  • OfStack

C # is a simple, Safe, stable, An object-oriented programming language derived from C and C + +, It not only inherits the powerful functions of C and C + +, but also removes some complexity of them. It combines the simple visual operation of Visual, Studio and the efficient operation efficiency of C + +. With its powerful operation ability, unique grammar style, innovative language characteristics and convenient component-oriented programming support, it has become the preferred language for NET development and the standard specification of ECMA and ISO.
C # and Java are strikingly similar, mainly including processes such as single 1 inheritance, interfaces, almost identical syntax to Java, and compiling into intermediate code at work. However, there are obvious differences between C # and Java. It draws lessons from one feature of Delphi and is directly integrated with COM (Component Object Model), and it is the protagonist of NET Windows network framework.
Using C #, users can create traditional Windows client applications, XML Web Services, distributed components, client applications, server applications, database applications, etc.
C # has strong grammatical expression and is easy to learn. The curly brace syntax of C # is immediately available to anyone familiar with C, C + +, or Java. C # syntax provides many powerful functions, such as null value types, enumerations, delegates, lambda expression direct memory access, these are not available in Java language. C # provides better type safety and performance by supporting generic methods and types. C # also provides an iterator that allows the implementer of the collection class to define custom iterative behavior for easy use by client-side code. In C # 3.0, language integrated query (LINQ) expressions make strongly typed queries a 1-stream language construct.
As an object-oriented language, C # supports encapsulation, inheritance, and polymorphism. All variables and methods can implement any number of excuses. The various methods that override virtual methods in the parent class require the override keyword as a way to avoid accidental redefinitions. In C #, the structure is similar to a lightweight class, a stack-allocated type that implements interfaces but does not support inheritance.
In addition to these basic object-oriented principles, C # simplifies the development of software components with several innovative language constructs:

1. Encapsulated method signature (called "delegate"). Implement type-safe event notification. 2. Property, which acts as an accessor to private member variables. 3. Attributes, which provide declarative metadata about runtime types. 4. Inline XML document comments. 5. Language integrated query (LINQ), which provides built-in query function across various data sources.

In C #, if you have to interact with other Windows software, such as COM objects or native Win 32 DLL, you can do so through a process called "interoperability". Interoperability enables C # programs to do what native C + + applications can, and C # even supports pointer and "insecure" code implementations.
The C # generation process is simpler than C and C + + and more flexible than Java. It does not have a separate header file, does not require declaring methods and types in a specific order, and can define any number of classes, structures, interfaces, and events.
Unique features of C #:

1. Intermediate code.
2. Declarations in the namespace. When a program is created, one or more classes are created in one namespace, and there may be declaration interfaces, enumerated types, structures, and so on in this namespace (outside the classes). At this time, you must use the using keyword to reference the contents of other namespaces.
3. Basic data types. C # has a wider range of data types than C, C + + or Java. These data types are bool, byte, ubyte, short, ushort, int, uint, long, float, double, and decimal.
4. Two basic classes, one named objict is the base class of all other classes, and one named string is like object1, which is a part of this language.
5. Parameter passing. Method can be declared to accept a variable number of parameters. The default parameter passing method is to pass the value of the basic data type. The ref keyword can be used to make a variable accept a return value by reference passing, and the out keyword can declare the process of reference passing. Unlike ref, the out keyword indicates that an initial value is not required for a parameter.
6. Integration with COM. Perhaps the greatest feature of C # for Windows program is its seamless integration with COM, which is Microsoft's Win32 component technology. C # writes classes that can subclass an existing COM component, and the resulting class may be used as an COM component.
7. Index subscript. Using indexes is not to refer to class members using attribute names, but to refer anonymously to numbers in square brackets (just like using an array subscript of 1).
8. Agent and feedback. A proxy object contains the information needed to access a specific method of a specific object. The proxy object can be moved to another place and can then be accessed to make type-safe calls to existing methods. A feedback method is a special case of proxy. The event keyword is used for method declarations that will be called as proxies when an event occurs.
Program development supported by C # language:

1. Support DOS programs (console applications)
2. Support desktop Windows Forms applications
3. Support the development of game programs
4. Support the development of Web programs (educational administration management system, library query system, server service program, etc.)
5. Support the development of mobile phone applications (embedded systems, etc.)
6. Support the development of ASP.NET application.

The above is to learn C # introductory knowledge points summary, I hope to learn C # programming help.


Related articles: