修复camelcase变量的名称违规(visual studio warning)

问题描述 投票:-2回答:1

当我读到关于在asp.net Here中命名对流时

将Camel Case用于变量和方法参数

所以我应该使用驼峰案例命名变量和方法参数,但我不知道为什么visual studio警告我这些名称:

public class Ad
    {
        public DateTime? startTimeLimitation { get; set; }
        public DateTime? endTimeLimitaion { get; set; }
        public Payment payment { get; set; }
    }

作为修复名称违规

那么我应该忽略这个警告还是我错过了一些关于命名约定的内容?

c# asp.net visual-studio naming-conventions naming
1个回答
1
投票

对于局部变量使用camel case,对类等级变量使用pascal case

public class MyClass
{
    public DateTime? StartTimeLimitation { get; set; }

    void MyMethod()
    {
        int localVariable = 0;
        //some other code
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.