Home > Common Problem > Which programming language is suitable for developing desktop software?

Which programming language is suitable for developing desktop software?

Guanhui
Release: 2020-06-03 15:58:29
Original
9742 people have browsed it

Which programming language is suitable for developing desktop software?

Which programming language is suitable for developing desktop software?

The programming language suitable for developing desktop software is C#. C# is an object-oriented programming language derived from C and C released by Microsoft. It runs on ".NET Framework" and ".NET Framework". NET Core" and has powerful operational capabilities, elegant syntax and innovative language features.

C# Language Structure

Class: A basic C# class contains data members, properties, constructors and methods. Properties can be static or instance members. Class declaration in C# is very similar to C and Java. However, unlike C, C# structures and classes do not support inheritance from multiple parent classes. However, like Java, a structure can implement an interface. The Java keyword import has been replaced by using, which serves the same purpose.

Classes can be abstract and non-inheritable: a class declared as abstract cannot be instantiated, it can only be used as a base class, the C# keyword lock is like the Java keyword final, it Declares that a class is not abstract, but it cannot be used as a base class interface for another class: just like in Java, an interface is an abstract definition of a set of methods. When a class or structure implements an interface, it must implement all methods defined in the interface. A single class can implement several interfaces, and there may be some subtle differences in the future, but this feature seems to be unchanged from Java.

Boolean operation: The result of the conditional expression is a Boolean data type. The Boolean data type is an independent data type in this language. There is no direct conversion process from the Boolean type to other types. The Boolean constant true and false is a keyword in C#. Error handling: As in Java, the error handling process is managed by throwing and catching exception objects.

Memory management: Automatic memory garbage collection by the underlying .NET framework.

Interface: It is a reference type that other types implement to ensure that they support certain operations. Interfaces are never created directly and have no actual representation; other types must be converted to interface types.

An interface defines a contract. A class or structure that implements an interface must adhere to its contract. Interfaces can contain methods, properties, indexers, and events as members.

Strong type: C# is a strongly typed language. Some of its numerical types can be implicitly converted, while others must be explicitly converted. Implicitly converted types can only be converted to long types with short lengths. Type, int can be converted to long, float, double, decimal, otherwise it must be converted explicitly.

Compilation: The program is directly compiled into a standard binary executable form. However, the C# source program is not compiled into a binary executable form, but 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.

C# program cannot be directly compiled into a standard binary executable form. Similar to Java, it is compiled into intermediate code (Microsoft Intermediate Language), and then passed through the virtual machine of the .NET Framework - called universal Language execution layer (Common Language Runtime, CLR) - execution.

A C# structure is similar to a C structure in that it can contain data declarations and methods. However, unlike C, C# structures are distinct from classes and do not support inheritance. However, Like Java, a structure can implement an interface.

Precompilation: There are precompilation directives in C# to support conditional compilation, warnings, error reporting and compile line control. The available precompilation directives are: #define, #undef, #if, #elif, #else, #endif, #warning, #error, #line.

Without the #include directive, the #define statement can no longer be used to assign values ​​to symbols, so there is no concept of source code replacement - these symbols can only be used in the #if and #elif directives. In The number (and optional name) in the #line directive can modify the line number and 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 unary operators that can be overloaded are: - ! ~ -- true false The binary operators that can be overloaded are: , - , *, /, %, &, |, ^, <<, >>, ==, !=, >, < , >= , <=.

Type: Types in C# are divided into two categories, one is value type (Value Type) and the other is reference type (Reference Type). Value types and reference types are distinguished by how they are allocated in computer memory. Value types include structures and enumerations, and reference types include classes, interfaces, delegates, etc. There is also a special value type called a simple type (Simple Type), such as byte, int, etc. These simple types are actually aliases of FCL class library types. For example, declaring an int type is actually declaring a System. Int32 structure type. Therefore, operations defined in the Int32 type can be applied to the int type, such as "123.Equals(2)".

All value types implicitly inherit from the System.ValueType type (note that System.ValueType itself is a class type). System.ValueType and all reference types inherit from the System.Object base class. You cannot explicitly let a structure inherit from a class because C# does not support multiple inheritance, and structures already implicitly inherit from ValueType.

NOTE: The stack is a last-in-first-out data structure. In memory, variables will be allocated on the stack for operations. The heap is a memory area used to allocate space for type instances (objects). When an object is created on the heap, the address of the object is passed to the variable on the stack (in turn, the variable points to this object, or the variable refers to this object).

Intermediate code: Microsoft leaves a lot of leeway when users choose when MSIL should be compiled into machine code. Microsoft is careful to claim that MSIL is not interpretive, but is compiled into machine code. It also understands that many - if not most - programmers believe that Java programs are inevitably slower than anything written in C. This implementation determines the Programs (meaning programs written in C#, Visual Basic, "Managed C" - a CLS-compliant version of C - etc.) will outperform "interpreted" Java code. Of course, this is not the case. This needs to be proven because C# and other MSIL-generating compilers have not yet been released. But the ubiquity of Java JIT compilers makes Java and C# relatively equivalent in performance. Like "C# is a compiled language and Java is interpreted," Statements like this are just business techniques. Java's intermediate code and MSIL are both intermediate assembly-form languages ​​that are compiled into machine code at runtime or other times.

Recommended tutorial: "

C

#"

The above is the detailed content of Which programming language is suitable for developing desktop software?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
c
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template