기본 콘텐츠로 건너뛰기

C# Namespace Naming Guidelines



The general rule for naming namespaces is to use the company name followed by the technology name and optionally the feature and design as follows.
CompanyName.TechnologyName[.Feature][.Design]
For example:
Microsoft.Media
Microsoft.Media.Design
Prefixing namespace names with a company name or other well-established brand avoids the possibility of two published namespaces having the same name. For example, Microsoft.Office is an appropriate prefix for the Office Automation Classes provided by Microsoft.
Use a stable, recognized technology name at the second level of a hierarchical name. Use organizational hierarchies as the basis for namespace hierarchies. Name a namespace that contains types that provide design-time functionality for a base namespace with the .Design suffix. For example, the System.Windows.Forms.Design Namespace contains designers and related classes used to design System.Windows.Forms based applications.
A nested namespace should have a dependency on types in the containing namespace. For example, the classes in the System.Web.UI.Design depend on the classes in System.Web.UI. However, the classes in System.Web.UI do not depend on the classes in System.Web.UI.Design.
You should use Pascal case for namespaces, and separate logical components with periods, as in Microsoft.Office.PowerPoint. If your brand employs nontraditional casing, follow the casing defined by your brand, even if it deviates from the prescribed Pascal case. For example, the namespaces NeXT.WebObjects and ee.cummings illustrate appropriate deviations from the Pascal case rule.
Use plural namespace names if it is semantically appropriate. For example, use System.Collections rather than System.Collection. Exceptions to this rule are brand names and abbreviations. For example, use System.IO rather than System.IOs.
Do not use the same name for a namespace and a class. For example, do not provide both a Debug namespace and a Debug class.
Finally, note that a namespace name does not have to parallel an assembly name. For example, if you name an assembly MyCompany.MyTechnology.dll, it does not have to contain a MyCompany.MyTechnology namespace.

댓글

이 블로그의 인기 게시물

Directory FileName Sort

C#에서 Directory.GetFiles(<Path>) 에서 파일명으로 Sort를 할필요성이 있다. Files 배열을 받아서 Sort를 할수도 있지만, Directory class 에서 Sort 기능도 제공을 하는데, LINQ에 Sort 기능을 제공한다. To sort by name, var sorted = Directory . GetFiles ( "." ). OrderBy ( f => f ); To sort by size, var sorted = Directory . GetFiles ( "." ). OrderBy ( f => new FileInfo ( f ). Length ); 참고   http://stackoverflow.com/questions/6294275/sorting-the-result-of-directory-getfiles-in-c-sharp

MongoDB 백업 및 복구방법

MongoDB 백업 및 복구방법 MongoDB 데이터 저장 디렉토리 설정(Windows) -> 보통 Default 로 "C:\data\db\" 로 지정되나, 혹시 디렉토리 설정을 바꿔서 모를경우에는 아래와 같이 명령어를 통해서 확인한다. mongodb --dbpath [arg-path] mongodb -v 명령어를 통해서 dbpath 경로를 확인할수 있다. local dump # mongodump -d [dbname] -o [dirname] Remote dump # mongodump --host mongodb1.example.net --port 37017 --username user --password pass /opt/backup/mongodump-2011-10-24 Mongorestore # mongorestore -h 127.0.0.1 "D\mongoDB\"