我需要帮助理解C#项目是如何在Visual Studio举办 [英] I need help understanding how C# projects are organized in Visual Studio

查看:93
本文介绍了我需要帮助理解C#项目是如何在Visual Studio举办的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在自学C#在过去的几个星期,并作为其人选择IDE的是记事本,我有困难,过渡到Visual Studio(我用2010速成)一点点。特别是,我不知道如何命名空间类方法层次的组织,在接口目视表现。我有一个很难做出它的意义,更重要的是如何使用界面有效地组织和跟踪我的项目。

I've been teaching myself C# for the past couple weeks, and as someone whose IDE of choice is Notepad, I'm having a little bit of difficulty transitioning to Visual Studio (I'm using 2010 express). In particular, I'm wondering how the organization of the Namespace-Class-Method hierarchy manifests itself VISUALLY in the interface. I'm having a hard time making sense of it, and, more importantly, how to use the interface to effectively organize and keep track of my projects.

有关情况,还有的解决方案资源管理,但有一个C#的解决方案(即我所知道的)没有这样的事。我怀疑这是微软的一个更通用的发展长期的营销说话,但我不能弄明白。我得到创造新的工程的选项。是项目的一个解决方案?

For instance, there's the "solution explorer", but there's no such thing as a C# "solution" (that I'm aware of). I suspect it's Microsoft's marketing speak for a more generic development term, but I can't figure it out. I get the option of creating New "projects". Is a "project" a "solution"?

我也命名空间有点模糊。我怀疑的命名空间在Java类库的等价物。什么是如何命名空间在现实世界中使用的例子吗?说,例如,我正在开发一个个人理财应用。我把在一个解决方案涉及到该应用程序一切吗?或者,我会创造的空间,比如说,现金账户和投资账户命名空间?

I'm also a little fuzzy on namespaces. I suspect that the namespaces are the equivalent of a class library in Java. What are some examples of how namespaces are used in the real world? Say, for instance, I'm developing a personal finance application. Would I put EVERYTHING related to that application in one solution? Or would I create as namespace for, say, cash accounts and a namespace for investment accounts?

命名空间内都是我*的.cs文件,但我似乎无法弄清楚如何在我的空间一个新的* cs文件。我期望的基础上,资源管理器的层次结构,即使用命名空间中的类将出现在列表中,我将能够使用它作为必要的。举例来说,我将能够创建enterDeposits.cs和enterWithdrawals.cs而无需创建一个新项目。

Within the namespaces are my *.cs files but I can't seem to figure out how to create a NEW *.cs file in my namespace. I would EXPECT, based on the explorer hierarchy, that any class using a namespace would appear in that list, and I would be able to use it as needed. For instance, I would be able to create enterDeposits.cs and enterWithdrawals.cs WITHOUT needing to create a new project.

我发现一对夫妇的在线教程,告诉我怎么做的事情(比如创建一个新的项目),但没有IDE的词汇的深刻理解,我不敢确定我保持组织以及我所能的一切。 !帮助

I've found a couple tutorials online that tell me how to do things (like creating a new project), but without a solid understanding of the IDE's vocabulary, I'm not really sure I'm keeping everything organized as well as I could. Help!

推荐答案

解决方案和项目在Visual Studio的方式来组织代码 - 他们使用的IDE发出命令来容器,编译器和其他需要构建组件

Solutions and projects in Visual Studio are ways to organize code - they are containers used by the IDE to issue commands to the compiler and other build components as needed.

解决方案包含的项目 - 项目包含代码文件。

Solutions contain projects - projects contain code files.

每个项目将编译到一个单独的DLL或EXE,中的部署

Each project will compile to a separate DLL or EXE, a unit of deployment.

命名空间可的价差的跨项目和解决方案,并在不同的DLL / EXE文件。他们是单位的逻辑的分离。

Namespaces can be spread across projects and solutions and be in different DLLs/EXEs. They are units of logical separation.

在Visual Studio中,您可以设置,在其属性每个项目基地命名空间。默认情况下,每次创建目录将获得附加到作为内部空间的一部分。在目录中创建的源代码文件默认情况下将得到该命名空间。

In Visual Studio, you can set a base namespace for each project in its properties. By default, every directory you create will get appended to that as part of the inner namespace. Any source code file created in a directory will by default get that namespace.

在一般情况下,命名空间是一个纯粹的代码构造。

In general, namespaces are a pure code construct.

在C#文件,你有一个的 命名声明 - 这可以是的任何的有效空间标识符,并且可以在的项目/解决方案/代码文件。

In a C# file, you have a namespace declaration - this can be any valid namespace identifier and can be in any project/solution/code file.

我不建议在MSDN考虑看看 - 这是什么C#和Visual Studio的一个很好的资源

I do suggest taking a look at MSDN - it is a good resource for anything C# and Visual Studio.

  • Solution and Project Basics
  • Creating Solutions and Projects

这篇关于我需要帮助理解C#项目是如何在Visual Studio举办的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆