In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
In this article, the editor introduces in detail "how to output the first program with C#". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to output the first program with C#" can help you solve your doubts. Let's follow the editor's ideas to learn new knowledge.
1. Basic overview of C# 1. What is C#?
C # (pronounced See Sharp) is a new programming language derived from CAccord programming +, which is not only object-oriented, but also type-safe. Developers can use C # to generate multiple secure and reliable applications that run in .net.
C # is an object-oriented and component-oriented programming language. It provides language constructs to directly support these concepts, making C # a very natural language that can be used to create and use software components. C # is essentially an object-oriented language.
2. What can C # do?
(1) play games
U3D and UE4 are two popular game engines on the market. Among them, the games based on U3D are basically written in C # language.
(2) Windows forms application
(3) Web service
(4) client-server application
(5) Mobile applications
And so on...
3. NET architecture
All programming languages need the appropriate environment to run. For example, Java is a cross-platform language because it comes with a Java virtual machine that can run under operating systems such as Windows and Linux as long as it is configured. The same is true for C #, which requires a running environment that can host programs to run, and the running environment is .NET.
In general, the .NET environment is installed in Windows systems, because most of the software in Windows is based on the C language series, so it needs to be run in a .NET environment. So after installing the appropriate software on Windows, you can start to output Hello World!
.net is a virtual execution system called the common language runtime (CLR) and a set of class libraries.
CLR is Microsoft's implementation of the common language infrastructure (CLI) international standard.
CLI is the foundation for creating execution and development environments in which languages and libraries can work together seamlessly.
Second, output the first program
Next, through the first step of learning all programming languages, use the program to output Hello World. Through this small program, to understand the structure of the C# program.
Using System;namespace Study001 {class Program {static void Main (string [] args) {Console.WriteLine ("Hello World!");}
Program output:
Structural analysis:
1. The parts of the above C# program:
(1) using System; references the namespace.
(2) namespace Study001 namespace declaration.
(3) class Program class.
(4) the entry method of static void Main (string [] args) program.
(5) Console.WriteLine ("Hello World!"); program statement.
2. Analysis of each part (tried)
The following program corresponds to a red box in the diagram.
(1) there can be multiple using statements in a program. Somewhat similar to import in the Python language, import the appropriate namespace and you can use the types in that namespace.
(2) multiple namespace can be used to name multiple namespaces in a program.
(3) multiple classes can be declared in a program.
Using System;namespace Study001 {class Program {static void Main (string [] args) {Console.WriteLine ("I am king!");}} class ClassTwo {static void printwho () {Console.WriteLine ("I belong to ClassTwo");} namespace Study002 {class ClassThree {static void printme () {Console.WriteLine ("I belong to ClassThree") }}}
The above programs can successfully output the results:
(4) there can be only one Main main method in a program. If more than one main method is defined, the following compilation error occurs.
Read here, this article "how to use C# output the first program" article has been introduced, want to master the knowledge of this article also need to practice and use to understand, if you want to know more about the article, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.