1. What is C #?
C # Is a new programming language developed by Microsoft. Because it is derived from C and C ++, it has C ++ functions. At the same time, because it is a Microsoft product, it is as simple as VB. For web development, C # is similar to Java and has some advantages of Delphi. Microsoft claims that C # is the best language for developing. NET Framework applications.
Ii. Java and C #
To learn C #, you must first take a look at the Java language.
Compared with other programming speech, Java has the following advantages: Users and compilers do not have to understand the specific CPU details for generating executable code for the first time. Java introduces a compilation code middle layer called byte code, and uses a virtual abstract machine instead of a real machine. After the Java compiler finishes compiling a source file, what you get is not the code that can be run on a given platform immediately, but the byte code that can be run on any real platform, the only condition is that the platform must understand and support Java. These developments include cultural changes. As a developer, you only need to determine the abstraction layer provided by the Java Virtual Machine (JVM). Different OS vendors are responsible for executing the code layer, in this way, the byte code neutral to the platform is mapped to the organization of the host platform. In this case, Java seems to be the leader in the unified Distributed Computer World. "Writing once, always running" (and wherever it is) once became an attractive but real slogan of Java.
So why is Java just "seems" a good thing? The development of cross-platform theory proves this point well. We can see that porting Java code from one platform to another-the most important and popular features of the Java language-is not as easy as being advertised. Any Java platform has its own virtual machine. It can understand common byte code and timely compile it into local code. Conflicts arise, and the execution of different virtual machines is also quite different. This is enough to make code porting much longer than expected, and it is basically not automatic.
So what are the benefits of the Java model? First of all, Java is an advanced and object-oriented language that includes built-in functions to prevent common errors and carries many frequently used functions in only one or two objects. Compared with C ++, Java is easier to read and write, not prone to errors, and more beautiful, but its speed is slow and not flexible. To achieve virtual porting on any software and hardware platform, Java uses the public denominator model as little as possible, that is, it gives up the ability to develop each platform to the limit. Second, the concept of virtual machines is portable and shared, so it is ideal for distributed environments. Java is the best language for developing code for non-Windows platforms.
So what about Java for Windows? It is impossible to adapt Java to Windows. This is due to Sun's licensing constraints. However, Java is so attractive that Microsoft knows this better than anyone else. As a result, Microsoft once again adopted the "come-first" technique, which makes good use of many Java features and grand launch of the new power of the Windows platform, it is a simple but powerful object-oriented C # programming language. When C # exceeds C ++, it naturally contains all classes in the. NET Framework class library and simplifies the syntax.
It can be said that C # can or will have all the advantages of Java!
Iii. main features of c #
C # is a key language of. NET. It is the foundation of the entire. NET platform. Compared with C #, other languages supported by. NET are obviously supporting roles. For example, the existence of VB. NET is mainly responsible for tens of millions of VB developers. The same can be said for JScript. NET and Managed C ++. The latter only adds the C ++ language that calls the. NET class. C # is the only new thing that does not include the predecessor's language in the design idea.
The. NET platform uses C # as its inherent language and relives many Java technical rules. C # also has a virtual machine called the Common Language Runtime Environment (CLR), whose objects have the same level. However, C # is designed to use all Win32 APIs or even more. Because C # is similar to the Windows architecture, C # is easy to be familiar to developers.
Java aims to save the distributed computing world. C # is different. C # is essentially the product of C ++ evolution. It uses many C ++ features including declarations, expressions, and operators, but C # has more enhancements, for example, type-Safe, event processing, shard set, and code security. In C #, apart from using many APIs, the. NET class is more usable. In particular, we can handle COM automation and C-type functions.
C # also allows you to call unmanaged code, that is, code beyond the control of the CLR engine. This insecure mode allows you to operate the original pointer to read and write memory other than the built-in shard set control.
4. Install the runtime environment
Installing. net sdk is the first step to run C # on a machine .. . Net sdk can be installed on Windows ME, Windows NT, or Windows 2000, but the best option is Windows 2000. After selecting the operating system, perform the following steps:
● Install IE 5.5
● Install the Microsoft. NET Framework SDK. It is free of charge and can be downloaded from the following sites. NET Framework SDK.
● After the above installation, you can write code in any text editor, and finally save the file with the extension. cs