문제

Let's say I own a domain called www.john-doe.com. How would I write an appropriate namespace in C#?

Is it Com.John_Doe.<product-name> ?

All I read about C# namespace convetions is that it should use PascalCase. But what about the minus sign? Is it appropriate to write an underscore for it?

도움이 되었습니까?

해결책

According to .NET namespace conventions, you should use pascal casing in namespaces (unless that goes against non-standard casing your company/brand/product uses). And according to capitalization conventions, pascal casing should not include underscores. General naming conventions also tell you to not use hyphen (which will actually produce compiler errors in C# anyway).

Unless Com is intended to be replaced with your company name (from the context, "John Doe" sounds like the company) You should just go with:

JohnDoe.<ProductName>

다른 팁

I think it is personal preference. E.g. my preference is JohnDoe.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top