Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand C # Namespace

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to understand C# Namespace". In daily operation, I believe many people have doubts about how to understand C# Namespace. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt of "how to understand C# Namespace"! Next, please follow the editor to study!

From the naming of the C # namespace, the division and naming of directories, we can see whether a programmer is experienced or not. A veteran programmer will never allow architectural chaos.

In .net development, the general directory name corresponds to the C # namespace name. The question of how to divide C # namespaces and how to classify directories seems simple, but it is actually quite complex, although it does not have a complete taxonomy like zoology and botany.

In the .net Bhand S architecture, it is generally divided into the following three main C# namespaces:

[company name / author name]. [project name]. Business [company name / author name]. [project name]. Data [company name / author name]. [project name] .Web

These three parts can be in a project, or they can be separated into three places.

The difficulty of catalogue classification and spatial naming is that the classification factor is two-dimensional, while the classification is only one-dimensional. Explain: classification is one-dimensional, which means that a word can only represent the meaning of one classification name, regardless of two meanings at the same time; classification factors are two-dimensional, which means that classification can be classified either horizontally or vertically.

Suppose I am developing an e-commerce book website, this business, according to the general rule, it has a user center, help center, payment center, merchandise center and so on. My project is divided into three project, as follows:

Sban.ZLBook.Business Sban.ZLBook.Data Sban.ZLBook.Web

In the Sban.ZLBook.Web project, I set up catalogs such as UserCenter, HelpCenter, PayCenter, ProductCenter, etc., which are classified horizontally by category.

In these categories, pictures must be used, and there are some css style files. Where do I put these files? I put them in the Images directory of the Web project (if there is no other image server). If there are too many files to manage, its subdirectories can be divided into UserCenter, HelpCenter, PayCenter, ProductCenter and so on. In this way, the directory division of Images is classified by vertical attributes.

There is no general way to name it. It depends on the specific project. If you do more projects, the architecture will be able to see the level. Uppercase is recommended for C # namespaces and directories.

When you don't know how to structure it, you might as well look through the official class library. In the btw:flex project, the package name (pakeage) and directory are lowercase, while the class name is uppercase.

At this point, the study on "how to understand C# namespaces" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report