Java attack C # -- development environment,

Source: Internet
Author: User

Java attack C # -- development environment,

Before entering this chapter. I want to talk about it. There is no good or bad language for the author. Only applicable. When I posted my previous post to the homepage, I suddenly found that there may be disputes. This is what I am worried about and what I don't want to see. The reason I want to write this series is not to explain which language is good or bad. But to help those who may have been engaged in JAVA Development like me. Suddenly want to see C #. Or go out to start a business and find that C # applies to people in the current company. Hope readers can understand the author's purpose. At the same time, I am afraid of trouble, so I will not go to the home page for this series of articles. Will be sent to the homepage candidate area later. Don't even let the author publish this article. No.

Summary of this Chapter

In the previous chapter, I started this series and learned how to learn and how to use development tools. When I learn a new computer language, I usually ask what development tools are used in this language. So this chapter will take a look at the C # development tool Microsoft Visual Studio in the future. I would like to explain how to install Microsoft Visual Studio. But I think everyone should know how to install it. Microsoft Visual Studio software is installed on the network. Download is the next step. So the author's learning environment is on. NET Framework 4.0. I also explained the syntax of Version 4.0. The software tool is Microsoft Visual Studio 2013.

Development Environment

After the software is installed. When Microsoft Visual Studio is opened for the first time, the software will allow you to select the corresponding development language. Why should we choose? Microsoft Visual Studio is only a development platform of. NET. It has nothing to do with computer languages .. NET has several languages. Among them, F #, VB. NET, C #, C ++, and so on. Therefore, be sure to select C #. Next, let's take a look at the development interface of Microsoft Visual Studio. As follows:

NOTE: If Solution Explorer is not found, find it from the menu "View" at the top of Microsoft Visual Studio.

At the beginning, I didn't want to introduce Microsoft Visual Studio too much. I think there are two commonly used interfaces for development. One is the Toolbox view on the left (for WinForm development ). One is the solution resource manager on the right (most commonly used ). It is equivalent to the Project Explorer view in Eclipse. In addition, the "file" menu in the upper right corner is used as the portal for creating a project. Whatever it looks. Let's create a HelloExample project to learn about the development environment. Click file new to create a project. The "new project" selection box is displayed. As follows:

Let's take a look at the content in the "New Project" selection box. You can see the tree menu "template" on the left, which will let you choose the language menu for the new project. We mainly stay in the Visual C # part. Next, select the corresponding development type. Whether it is PC development or Web development. PC-side development is divided into the console, Winform, and Window services (I have a question: it is not counted as a PC-side service ). Give a column

Console: a typical CMD command window. (Equivalent to java project)

Winform: 360 guard software. (Equivalent to JAVA Awt and Swing programming)

Window service: Background Service of SQL Server 2008. (I have not developed it)

This is because I will use the console in the learning phase. That is. The following section of the "new project" selection box is used to enter the name (name) and save path (location) of the new project ). It is worth noting that the last name is the solution name. Enter the project name first. When entering the project name "HelloExample", readers should find that the solution name is also changed. Do not touch it first. Click "OK ". Okay! Created successfully. Lower

As I mentioned above, what is the solution? I do not know whether the readers have developed a project composed of multiple project projects? I use Eclipse more in JAVA development. I remember when I was developing a large website for medical schools. Therefore, a project is composed of many projects. Suddenly, the supervisor asked me to maintain the project of another group. At this time, the author's physical working directory is messy. In order to give the author a clear point. The author creates a folder about medical schools under the working directory. All the corresponding projects are pulled in. The same is true for projects in another group. This folder is similar to a solution. That is to say, the solution is a project container composed of multiple project projects. This is what I have defined. In addition, both projects are composed of multiple projects. The Eclipse Project Explorer view becomes messy. Sometimes it is unclear which project the current project belongs. There is no way for the author. You can only open two Eclipse instances. Of course, I have also tried whether Microsoft Visual Studio can open multiple solutions on a single development interface. Sorry! The author failed.

In fact, the solution can be created independently before creating a project. So what? Under the tree menu "Visual C #" in the "Create a project" selection box, there is a "other project type ". Click it to find the corresponding new solution. As follows:

After the solution is created successfully. What should I do if I want to add a project to the new solution? Select the new solution. It is also the name of the solution in the Solution Explorer view. That is, the Red Circle in the right figure above. Right-click "add" in current solution "to create a project. The" new project "selection box is displayed.

After the solution and project are created, let's take a look at what physical files they have generated? This facilitates future study. Let's take a look at the previous project "HelloExample.

The solution generates a file with the sln extension. At the same time, a root directory (HelloExmape) with the same solution name will be created ). If you want to view others' projects. Just click the file with the sln extension. If it is eclipse, It is import. I believe everyone understands this. The HelloExmape folder under the above root directory (HelloExmape) is the project. Let's take a look.

As shown above, there are class files, bin folders, obj folders, files with csproj extensions, and Propertise folders.

Class file: it is the corresponding source code file. For example, A. java file is the same as a sub-file. But here java becomes cs.

Bin folder and obj Folder: the former is the source of the file generated after running in Debug mode, and the latter is the source of the file generated after running in Release mode. It is equivalent to telling Microsoft Visual Studio whether to debug or publish. It is reflected in the middle position at the top of Microsoft Visual Studio and started together.

File With csproj Extension: the extension name of the JAVA project. For example,. project. Is used to record the project information. This is just the end of csproj.

Propertise Folder: Understand the MANIFEST. MF file. Is the JAVA inside the META-INF folder a little like. The AssemblyInfo file is equivalent to MANIFEST. MF.

After learning about the above development environment, we will try to start it. However, I still want to write a sentence to print Hello world.

 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5  6 namespace HelloExample 7 { 8     class Program 9     {10         static void Main(string[] args)11         {12             Console.WriteLine("Hello world");13         }14     }15 }

In addition to printing Hello world. It is written by the author, and others are generated. So the code is explained. We will discuss it later. This chapter mainly describes the development environment. Click Start at the top of Microsoft Visual Studio ". The default mode is Debug. You can also select shortcuts. Press F5. or Ctrl + F5. The difference between the two is that after Ctrl + F5 is run, the window will be closed after one click. F5 is disabled after running.

 

The preceding figure shows the file generated in the bin folder after the startup is successful. In fact, you only need to execute the exe file. The pdb file contains some information after compilation. Including the line number of the Code. Later, xxx.vshost.exe is related to Microsoft Visual Studio.

Summary

This chapter describes the development environment for further study. Of course, the environment is not just described by the author. It will only be available later. I am introducing it.

 

Related Article

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.