Follow variable naming conventions
TRY THIS RULE ID: csharp-code-style/variable-naming-conventions
Language: C#
Severity: Notice
Category: Code Style
Description Variable names should follow the camelCase
pattern and start with a lowercase letter, except for private and protected fields that should start with _
.
Learn More Non-Compliant Code Examples class My_Class {
int MyVariable = 10 ;
public void foo () {
int FooBar = 14 ;
DateTimeOffset t1 = TimeZoneInfo . ConvertTime ();
}
}
Compliant Code Examples public class CertificateHelperTests {
private const string PemCertPublic = "" ;
}
class My_Class {
int _myVariable = 10 ;
[TestMethod]
public void BooleanToIntegerConverterTest ()
{
var converter = new BooleanToIntegerConverter
{
ValueOnTrue = 1 ,
ValueOnFalse = 2
};
Assert . AreEqual ( 1 , converter . Convert ( true , typeof ( int ), null , null ));
Assert . AreEqual ( 2 , converter . Convert ( false , typeof ( int ), null , null ));
}
}
class My_Class {
int myVariable = 10 ;
}
Seamless integrations. Try Datadog Code Analysis