简体   繁体   English

.Net命名约定与W3C规范

[英].Net naming conventions vs W3C specifications

I'm having a hard time resolving a naming convention conflict I'm having with implementing part of the W3C HTML5 specification using .Net. 我很难解决使用.Net实现W3C HTML5规范的部分内容时遇到的命名约定冲突。

The issue is that I like to conform to standard .Net naming conventions, which use UpperCamelCasing, but the W3C specifications indicate that the naming conventions should use lowerCamelCasing. 问题是我喜欢遵守使用UpperCamelCasing的标准.Net命名约定,但是W3C规范指出命名约定应使用lowerCamelCasing。

Should I deviate from the specification in order to write code that is friendly and familiar to the .Net community, or should I use the W3C-recommended conventions in order to stick to the specification as closely as possible, even though this will make my Code.notVeryPretty()? 我应该偏离规范是为了编写对.Net社区友好而熟悉的代码,还是应该使用W3C推荐的约定以便尽可能严格地遵循规范,即使这样做会使我的代码.notVeryPretty()?

EDIT 编辑

Example: 例:

The W3C defines an interface IDOMImplementation with a member hasFeature() . W3C使用成员hasFeature()定义接口IDOMImplementation If I were writing .Net code without a W3C specification guiding the implementation, these would be named IDomImplementation and HasFeature() , but the W3C defines naming conventions as specified above. 如果我编写的.Net代码没有W3C规范来指导实现,则它们将被命名为IDomImplementationHasFeature() ,但是W3C定义了如上所述的命名约定。

EDIT 编辑

To ask this question a completely different way, is there any downside to deviating from the W3C-recommended casing conventions when implementating their specification using .Net? 以完全不同的方式提出这个问题,在使用.Net实现规范时,是否有偏离W3C推荐的大小写约定的缺点?

Use UpperCamelCasing for .NET code and lowerCamelCasing for your HTML/CSS/Javascript/other W3C stuff. UpperCamelCasing用于.NET代码,将lowerCamelCasing用于您的HTML / CSS / Javascript /其他W3C产品。

In what situation would you code .NET code using W3C recommended naming conventions? 在什么情况下,您将使用W3C建议的命名约定对.NET代码进行编码?

Edit: 编辑:

Now that you have clarified exactly what you mean, I would say that since your code is to be consumed within .NET, you should stick with .NET conventions, even when implementing an interface defined by W3C. 现在你已经正是你的意思明确,我会说,既然你的代码,须在.NET 消耗 ,你应该使用.NET约定坚持,落实W3C定义的接口也是如此。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM