search
HomeBackend DevelopmentC#.Net TutorialC# basic knowledge compilation: .NET knowledge

1. What is .NET Framework
The so-called .NET FrameWork is a platform, and its purpose is for cross-operating system programming. It contains many modules, such as Windows application components, Web development modules, etc. Different operating systems support some of these modules according to their own characteristics. NET framework is a programming platform that runs on a virtual machine. It is based on the Common Language Runtime and supports the development of multiple languages ​​(C#, VB.NET, C++, etc.). Can develop desktop applications (WinForm, WPF, SilverLight, Office), Web applications (Asp.NET, ASP.NET MVC, SilverLight), Windows Service, and mobile embedded development. Currently commonly used versions are: 2.0, 3.0, 3.5, 4.0;
2. Several concepts in .NET
(1), CLR concept?
Details: CLR is the common language runtime. (Common Language Runtime) is also a runtime environment like the Java virtual machine. It is responsible for resource management (memory allocation and garbage collection), and ensures that applications and the underlying operating system necessary separation.
(2) What are the advantages of managed code?
Details: http://www.php.cn/
(3), the true meaning and form of language interoperability?
Details: A class written in one language should be able to inherit a class written in another language
A class can contain instances of another class, regardless of what language they are written in. A Objects should be able to directly call methods of objects written in other languages
Objects (or object references) should be passed between methods
When calling methods between different languages, they should be able to be used in the debugger Debugging the calls of these methods, that is, debugging codes written in different languages

(4). In .NET, what is the program compilation process?
Details: http://www.php.cn/
(5) What are the main features of intermediate language?
Can be compiled by different compilers in real time and run on different structures, eliminating language disputes. Intermediate language or high-level language.
(6) What is the conceptual distinction between dynamic language and static language, strongly typed definition language and weakly typed definition language?
Dynamically typed language: A language that checks data types during runtime.
Static typed language: Data types are checked during compilation.
Strongly typed definition language: a language that forces data type definition.
Weakly typed definition language: a language in which data types can be ignored. It is the opposite of a strongly typed definition language, in which a variable can be assigned values ​​of different data types.

(7) Compiled type and interpreted type (refer to the blog)
Let’s look at the compiled type first. In fact, it is the same as assembly language: there is also a program responsible for translation. Our source code is converted to generate corresponding executable code. To put it more professionally, this process is called compilation, and the program responsible for compilation is naturally called a compiler. If the program code we write is contained in a source file, then usually an executable file will be generated directly after compilation, and we can run it directly. But for a more complex project, in order to facilitate management, we usually disperse the code in various source files and organize it as different modules. At this time, when compiling each file, an object file will be generated instead of the executable file mentioned earlier. Generally, the compilation of a source file will correspond to a target file. The content in these target files is basically executable code, but since it is only the entire project part, so we can't run it directly yet. After all the source files are compiled, we can finally "package" these semi-finished target files into an executable file. This work is completed by another program, because this process seems to include the executable code. The target files are connected and assembled, so it is also called a link, and the program responsible for linking is called...it is called a linker. In addition to linking target files, the linker may also have various resources, such as icon files, sound files, etc., and is also responsible for removing redundant duplicate codes between target files. After the link is completed, we can generally get the executable file we want.
Look at the explanation type again. "Compilation" and "interpretation" do both mean "translation", but the difference lies in the timing of translation. For example: If you plan to read a foreign book and you don’t know the foreign language, then you can find a translator and give him enough time to translate the entire book from beginning to end, and then translate the book The native language version is given to you to read; or, you can immediately ask the translator to assist you in reading, and let him translate for you sentence by sentence. If you want to go back to a certain chapter, he will have to translate it for you again.
Of the two methods, the former is equivalent to the compiled type we just mentioned: converting all the code into machine language at once and then writing it into an executable file; and the latter is equivalent to the interpreted type we are talking about: just before the program runs , there is only a source program but no executable program; and every time the program executes a certain instruction of the source program, there will be a shell program called an interpreter to convert the source code into binary code for execution. In short, It means constant interpretation, execution, interpretation, execution... Therefore, interpreted programs are inseparable from interpreting programs. For example, early BASIC is a classic interpreted language. To execute a BASIC program, you have to enter the BASIC environment, and then you can load the program source file and run it. In an interpreted program, since the program always appears in the form of source code, transplantation is almost no problem as long as there is a corresponding interpreter. Although the source code of compiled programs can also be transplanted, the prerequisite is that they must be compiled separately for different systems. For complex projects, it is indeed a huge time-consuming task, and it is very likely that the source code still needs to be modified in some details. Moreover, interpreted programs save the compilation step, and are very convenient for modification and debugging. They can be run immediately after editing. Unlike compiled programs, you do not have to wait patiently for the long Compiling...Linking...compilation every time you make small changes. linking process. However, everything has pros and cons. Since interpreted programs put the compilation process into the execution process, this determines that interpreted programs are destined to be much slower than compiled programs. It is not surprising that the speed difference is hundreds of times. of.
Compiled type and interpreted type, both have advantages and disadvantages. The former has fast program execution speed and lower system requirements under the same conditions. Therefore, it is used when developing operating systems, large-scale applications, database systems, etc., such as C/C++, Pascal/Object Pascal (Delphi), VB and other basic programs. All can be regarded as compiled languages, while some programs such as web scripts, server scripts and auxiliary development interfaces that do not have high speed requirements and have certain requirements for compatibility between different system platforms usually use interpreted languages, such as Java and JavaScript. , VBScript, Perl, Python, etc.
But since compiled and interpreted languages ​​have their own advantages and disadvantages and are in opposition to each other, a number of emerging languages ​​tend to compromise the two. For example, although the Java language is closer to the characteristics of an interpreted language, it does not have the characteristics of an interpreted language before execution. It has been precompiled in advance, and the generated code is an intermediary code between the machine code and the Java source code. When running, it is interpreted and executed by the JVM (Java's virtual machine platform, which can be regarded as an interpreter). It not only retains the high abstraction and portability characteristics of the source code, but also has completed most of the pre-compilation of the source code, so it executes much faster than "purely interpreted" programs. For languages ​​like VB6 (or previous versions) and C#, although on the surface they generate .exe executable program files, what is actually generated after VB6 is compiled is also an intermediate code, but the compiler inserts a paragraph in front of it. Automatically call an external The code of the internal interpreter (this interpreter is independent of the program written by the user and is stored in a DLL file of the system. All executable programs compiled with VB6 must use it) to interpret and execute the actual program body. C# (and other .net language compilers) generates .net target code, which is actually executed by the .net interpretation system (just like JVM, it is also a virtual machine platform). Of course, the .net target code is already quite "low-level" and is closer to machine language, so it is still regarded as a compiled language, and its portability is not as powerful as Java claims. Java claims to be "compile once, execute everywhere". And .net is "encode once, compile everywhere". In short, with the continuous development of design technology and hardware, compiled and interpreted types The boundaries between approaches are becoming increasingly blurred.

The above is the compilation of C# basic knowledge: .NET knowledge. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Developing with C# .NET: A Practical Guide and ExamplesDeveloping with C# .NET: A Practical Guide and ExamplesMay 12, 2025 am 12:16 AM

C# and .NET provide powerful features and an efficient development environment. 1) C# is a modern, object-oriented programming language that combines the power of C and the simplicity of Java. 2) The .NET framework is a platform for building and running applications, supporting multiple programming languages. 3) Classes and objects in C# are the core of object-oriented programming. Classes define data and behaviors, and objects are instances of classes. 4) The garbage collection mechanism of .NET automatically manages memory to simplify the work of developers. 5) C# and .NET provide powerful file operation functions, supporting synchronous and asynchronous programming. 6) Common errors can be solved through debugger, logging and exception handling. 7) Performance optimization and best practices include using StringBuild

C# .NET: Understanding the Microsoft .NET FrameworkC# .NET: Understanding the Microsoft .NET FrameworkMay 11, 2025 am 12:17 AM

.NETFramework is a cross-language, cross-platform development platform that provides a consistent programming model and a powerful runtime environment. 1) It consists of CLR and FCL, which manages memory and threads, and FCL provides pre-built functions. 2) Examples of usage include reading files and LINQ queries. 3) Common errors involve unhandled exceptions and memory leaks, and need to be resolved using debugging tools. 4) Performance optimization can be achieved through asynchronous programming and caching, and maintaining code readability and maintainability is the key.

The Longevity of C# .NET: Reasons for its Enduring PopularityThe Longevity of C# .NET: Reasons for its Enduring PopularityMay 10, 2025 am 12:12 AM

Reasons for C#.NET to remain lasting attractive include its excellent performance, rich ecosystem, strong community support and cross-platform development capabilities. 1) Excellent performance and is suitable for enterprise-level application and game development; 2) The .NET framework provides a wide range of class libraries and tools to support a variety of development fields; 3) It has an active developer community and rich learning resources; 4) .NETCore realizes cross-platform development and expands application scenarios.

Mastering C# .NET Design Patterns: From Singleton to Dependency InjectionMastering C# .NET Design Patterns: From Singleton to Dependency InjectionMay 09, 2025 am 12:15 AM

Design patterns in C#.NET include Singleton patterns and dependency injection. 1.Singleton mode ensures that there is only one instance of the class, which is suitable for scenarios where global access points are required, but attention should be paid to thread safety and abuse issues. 2. Dependency injection improves code flexibility and testability by injecting dependencies. It is often used for constructor injection, but it is necessary to avoid excessive use to increase complexity.

C# .NET in the Modern World: Applications and IndustriesC# .NET in the Modern World: Applications and IndustriesMay 08, 2025 am 12:08 AM

C#.NET is widely used in the modern world in the fields of game development, financial services, the Internet of Things and cloud computing. 1) In game development, use C# to program through the Unity engine. 2) In the field of financial services, C#.NET is used to develop high-performance trading systems and data analysis tools. 3) In terms of IoT and cloud computing, C#.NET provides support through Azure services to develop device control logic and data processing.

C# .NET Framework vs. .NET Core/5/6: What's the Difference?C# .NET Framework vs. .NET Core/5/6: What's the Difference?May 07, 2025 am 12:06 AM

.NETFrameworkisWindows-centric,while.NETCore/5/6supportscross-platformdevelopment.1).NETFramework,since2002,isidealforWindowsapplicationsbutlimitedincross-platformcapabilities.2).NETCore,from2016,anditsevolutions(.NET5/6)offerbetterperformance,cross-

The Community of C# .NET Developers: Resources and SupportThe Community of C# .NET Developers: Resources and SupportMay 06, 2025 am 12:11 AM

The C#.NET developer community provides rich resources and support, including: 1. Microsoft's official documents, 2. Community forums such as StackOverflow and Reddit, and 3. Open source projects on GitHub. These resources help developers improve their programming skills from basic learning to advanced applications.

The C# .NET Advantage: Features, Benefits, and Use CasesThe C# .NET Advantage: Features, Benefits, and Use CasesMay 05, 2025 am 12:01 AM

The advantages of C#.NET include: 1) Language features, such as asynchronous programming simplifies development; 2) Performance and reliability, improving efficiency through JIT compilation and garbage collection mechanisms; 3) Cross-platform support, .NETCore expands application scenarios; 4) A wide range of practical applications, with outstanding performance from the Web to desktop and game development.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Clair Obscur: Expedition 33 - How To Get Perfect Chroma Catalysts
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft