VB.NET 项目文件夹问题
因此,如果我正在 VB.net 中处理一个项目(实际上是任何 Visual Studio 项目),我就可以创建文件夹。我的项目变得相当笨拙(超过 30 个类),我认为将数据结构类存储在文件夹“ds”中并将用户控件存储在文件夹“uc”中是有益的。这样可以吗?它会影响我引用课程的方式吗?这些文件夹只是供我自己使用和结构还是它们实际上对我的整个项目有某种影响?
PS,以防您感到困惑,我指的是“解决方案资源管理器”中显示的结构。抱歉,如果这是一个愚蠢的问题或不清楚,但我以前从未参与过这样的大型项目。
So if I am working on a project in VB.net (really any visual studio project), I am able to create folders. My project is getting rather unweildy (over 30 classes) and I think it would be beneficial to store for example data structure classes in a folder "ds" and user controls in a folder "uc". Is this OK? Will it affect the way I reference the classes? Are the folders simply for my own use and structure or do they actually have some kind of impact on my project as a whole?
PS in case you are confused, I am referring to the structure shown in the "Solution Explorer". Sorry if this is a dumb question or not clear, but I have never worked on a large project like this before.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
不存在愚蠢的问题。 ;) 你可以这样做,但是帮自己一个忙,让你的命名空间与你的文件夹层次结构相同,否则你很快就会得到一个鸟巢。例如,如果项目的默认命名空间是 MyProject 并且文件夹是 Dc,则这些类应该位于
编辑中:只需包装您的类以镜像您的文件夹结构,如下所示:
There's no such thing as dumb questions. ;) You can do this, but do yourself a favor and keep your namespaces the same as your folder hierarchy or you can end up with a bird's nest pretty quickly. For example, if the project's default namespace is MyProject and the folder is Dc, those classes should be in
Edit: Just wrap your classes to mirror your folder structure like:
添加文件夹将默认将任何新添加的文件的命名空间包含到这些文件夹中,以包含文件夹名称。例如 MyApp.UC 或 MyApp.DS。
创建文件夹并移动用户控件、数据结构等应该不成问题。
您始终可以在新的测试项目上测试它 - 这是我通常的方式:)
Adding the folders will default the namespace of any newly added files into those folders to include the folder name. For example MyApp.UC or MyApp.DS.
Creating a folder and moving your user controls, data structures etc. shouldn't be a problem.
You can always test this on a new Test Project - that's my usual way :)
您可以使用文件夹来处理所有内容。我一直这样做,您只需要在访问它时包含文件夹名称即可。
因此,如果我想调用 Exceptions 文件夹中的某些内容,我会使用 Exceptions.DialogExceptionEdit 等。
You can use folders for everything. I do it all the time, you just need to include the folders name when accessing it.
So if I wanted to call something in the Exceptions folder, I would use Exceptions.DialogExceptionEdit, etc.
如果您小心它们所在的命名空间并且在使用其路径引用类文件时也小心的话,添加新文件夹不应更改项目中的任何内容。
Adding a new Folder shouldn't change anything in your project, if you are careful about the namespaces they are in and also being careful while referring to Class files using their path.