"C # Introduction and improvement"

Source: Internet
Author: User
Tags class definition garbage collection header variables range web services

C # Introduction
We know that C and C + + have become widely used in commercial software development in the development of language. But C and C + + flexibility is at the expense of development efficiency. If compared to other development languages (such as Vb,delphi), C + + software with the same functionality typically requires longer development cycles and more code to write. It is because of the complexity of C + + development and the need for a longer development cycle that many C + + developers are looking for a development language that can increase the balance between functionality and development efficiency. So Microsoft thought of C # (pronounced C Sharp) and launched C #. June 2000 Microsoft releases the C # language and. NET platform. C # language is a strong type, object-oriented language, it has a simple syntax, strong expression of the characteristics; NET platform is composed of Microsoft. NET Plan "the cornerstone of. The core of the net platform includes two aspects, one is the famous common language running machine (Common Language Runtime) Although the noun is obscure but you can compare it to a Java virtual machine, which accomplishes the same task, The other is a bunch of general-purpose library functions that can be invoked in multiple languages, and compile all produce a common intermediate language (intermediate Language), which can also be likened to Java bytecode, although in some different ways. C # is an advanced, object-oriented language that enables developers to quickly build a wide range of applications based on MS Network platforms, and provides a wealth of development tools and services to help developers develop applications based on computing and communications. Because C # is an object-oriented development language, C # can be used in a wide range of high-level commercial applications and the development of the underlying system. Even through Simple C # constructs, various components can be easily transformed into web-based applications, and can be invoked via the Internet by applications developed by various systems or other development languages.
It has the following characteristics: development efficiency and security
Current web-based software development challenges traditional business application development, where developers are organized to develop applications with shorter development cycles and need to be able to provide better scalability rather than building a software system that can be used for a long time.
C # is designed to fully consider these factors. C # helps developers achieve the same functionality with fewer code, and can better avoid errors.
Combined with web development
The new development model means that you need to make better use of the various existing web standards, such as HTML,XML,SOAP (Simple Object Access Protocol). Existing development tools are present before or before the advent of the Internet, so they are not well adapted to the current development needs of web technologies.
C # developers can easily expand their applications on the M$ network platform. C # can transform any component into a Web service and can be invoked by any application that is running on any platform on the Internet, and it is important that C # provides built-in support for this feature.
More importantly, the Web services framework makes it possible for any Web service to look like a C # built-in object, so developers can continue to use the object-oriented development methods and techniques they already have in the development process.
In addition, C # has many other features that make it the most outstanding Internet development tool. For example, XML is now the standard for data structure transfer in a network, and in order to improve efficiency, C # will allow direct mapping of XML data into structures. In this way, it is possible to deal with various data effectively.
Reduce errors in development
Even a good C + + developer can avoid some common errors in the coding process, such as initializing a variable incorrectly, which can cause unpredictable errors and be difficult to discover. If errors are put into the production environment before they are discovered, it will be costly to eliminate these errors. And the advanced design idea of C # can eliminate many common mistakes in the C + + development, such as:
The garbage collection mechanism will ease the developer's management burden on memory. Variables in C # are automatically initialized to the environment. Variables are type-safe. Using C # will make it easier for developers to develop and maintain a variety of business applications.
Provides built-in version support to reduce development costs
Updating components (modules) in a software system can be an error-prone task that may have an impact on existing software during code modification. To help developers deal with these issues, C # has built-in versioning capabilities in the language. For example, a function overload must be explicitly declared (a situation that occurs frequently in C + + and Java), which prevents code-level errors and features that preserve versioning. Another related feature is support for interface and interface inheritance. These features ensure that complex software can be easily developed and upgraded.
To sum up, these features can help develop stronger software successors and mitigate development costs.
Strong function, easy performance, flexible
Better integration of process and software implementations in business applications
In order to better realize the company's various business plans, in the software system must have a close relationship between the business process and software implementation. But most development languages cannot easily relate the various application logic to the code. For example, developers use various annotations to identify the abstract business objects that each class represents. C # allows you to use predefined data or extended metadata on any object. Zone attributes can be used in the system structure (translator: A network domain structure similar to NT), and these attributes are added to classes, interfaces, or other elements. Developers can independently test attributes on a variety of elements. This will make it easy to do something similar to whether the interface is properly defined, as in the collection of object attributes in the zone, or in areas where automatic tools are written.
Scalable collaboration Capabilities
Although the management is strong, the transparent type is good, the type safe development environment is suitable for the most commercial application, but the reality experience tells us some applications for the execution efficiency or with the existing application interface API combination reason needs to use the original development method to encode. It is also true that many C + + developers prefer to forgo the development tools that can improve development efficiency. C # solves these problems by using the following methods:
Built-in support for COM models and Windows platform APIs.
Allow restricted use of pointers.
Any object in C # will automatically become a COM object, and developers no longer need to explicitly implement IUnknown and other COM interfaces, while also making it easy and natural to use existing COM objects without caring whether or not these COM objects are developed using C #.
For developers using C #, C # allows developers to invoke the APIs provided by the OS. Use pointers in the tagged area of code and manually manage memory allocations. This can make C + + developers become more familiar with and shift to C # and do not need to discard the development habits that were developed in the previous development, and the previous C + + code can still be reused. Support for both COM and API calls is designed to provide developers with sufficient development control capabilities.


C # and Java
Both are compiled into Cross-platform, Cross-language code, and the code can only run in a controlled environment
Automatically reclaims garbage memory and eliminates pointers (pointers can be used in C #, but must be marked with unsafe keywords)
Do not require a header file, all code is limited to a scope by "package (Package)", and because there is no header file, it eliminates the cyclic dependency of the class definition
All classes are derived from objects, and memory must be allocated using the New keyword
Use object locking to support multithreading
Has the concept of an Interface (interface)
Inheriting a class does not inherit with a specific access right??
No global function or constant, everything must belong to the class??
Arrays or strings have their own length calculations and boundary checks??
Use only "." operator, no "->" and ":"?
"Null", "Boolean" and "bool" become keywords??
Any variables are initialized before they are used??
You cannot use integers to return to an IF condition statement, you must use a Boolean value??
"Try" module can have "finally"??


In short, C # is an advanced, object-oriented development language, and can be a convenient and efficient MS network platform for the establishment of a variety of applications and to establish a network of calls between the Web services. From a development language perspective, C # can help developers avoid errors, improve productivity, and also have the power of C + +.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.