- C#使用Pascal规则命名,即首字母要大写。
- 类名,属性名,方法名统一使用Pascal命名方式。
- 局部变量,形参等使用驼峰命名法。
示例如下:
public class UsersEntity
{
/// <summary>
/// 用户ID
/// </summary>
[Key]
public long UserID { get; set; }
/// <summary>
/// 会员名
/// </summary>
public string UserName { get; set; } = string.Empty;
/// <summary>
/// 用户手机号码
/// </summary>
public string UserMobile { get; set; } = string.Empty;
}
最后
以上就是开放小蜜蜂最近收集整理的关于C#命名规范的全部内容,更多相关C#命名规范内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复