C#语言私有字段
示例
私有字段有两种常用约定:camelCase和_camelCaseWithLeadingUnderscore。
骆驼香烟盒
public class Rational
{
private readonly int numerator;
private readonly int denominator;
public Rational(int numerator, int denominator)
{
// "this" keyword is required to refer to the class-scope field
this.numerator= numerator;
this.denominator= denominator;
}
}带下划线的驼色表壳
public class Rational
{
private readonly int _numerator;
private readonly int _denominator;
public Rational(int numerator, int denominator)
{
// Names are unique, so "this" keyword is not required
_numerator = numerator;
_denominator = denominator;
}
}
热门推荐
10 跟女生道别祝福语简短
11 男老乡生日祝福语简短
12 希望生产顺利祝福语简短
13 高中送红包祝福语简短
14 珠宝顾问生日祝福语简短
15 企业国庆问候祝福语简短
16 感谢母校寄语简短祝福语
17 朋友被录取祝福语简短
18 旅行前祝福语简短英语