Microsoft VB.NET naming convention

穿精又带淫゛_ 提交于 2019-12-03 10:20:06

问题


Is there any standard naming convention for VB.NET ?

Based your programming experiences, would like to share your naming convention for VB.NET ?

Are there any guides for this kind of good practice besides patterns & practices Guidance Explorer and Guidance Share ?

Thanks. Happy Weekend.


回答1:


As Mehrdad said, VB.NET follows the General .NET naming conventions. More specificly:

  • Types, events, read-only static fields, methods, namespaces, properties: PascalCase
  • Parameters: camelCase
  • Acronyms of two characters: DB, with the exception of Id and Ok
  • Acronyms of three or more characters: Html or html, depending on context, but never HTML
  • Compound words: Hashtable, not HashTable, except for some common terms like FileName
  • Do not use separators like hyphens (-) or underscores (_) between words
  • Do not use Hungarian notation



回答2:


I use this guide on "net Naming Conventions and Programming Standards - Best Practices": http://10rem.net/articles/net-naming-conventions-and-programming-standards---best-practices




回答3:


VB.NET shares the naming convention of the .NET Framework. PascalCase for types and public stuff, camelCase otherwise.




回答4:


Enable Visual Studio "Code Analysis" to check your code against several Microsoft-sanctioned naming conventions.




回答5:


Take a peek at this question. It is essentially the same question regarding C#, however most of of the links and answers provided apply to both languages.



来源:https://stackoverflow.com/questions/668157/microsoft-vb-net-naming-convention

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!