21Oct/090
CatalinZ.NamingConventions
// Using statements are outside namespace declarations
using System;
namespace CatalinZ.NamingConventions
{
// Enums are PascalCased and singular
public enum Alignment
{
// Enum members are PascalCased
Top,
TopRight,
Right,
BottomRight
Bottom,
BottomLeft,
Left,
TopLeft,
}
// Flag enums are PascalCased and plural
[Flags]
public enum Alignments
{
// Enum members are PascalCased
None = 0x00,
Top = 0x01,
Right = 0x02,
Bottom = 0x04,
Left = 0x08,
}
// Class names are PascalCased
public class ThisIsAClass
{
// Members are grouped by type:
// * Types (nested classes, enums, structures)
// * Fields
// * Constructors
// * Properties
// * Methods
//
// Within these groups the elements are grouped by functionality,
// and inside the functionality groups they are ordered by accessibility,
// from public to private:
// * public
// * internal
// * internal protected
// * protected
// * private
// Nested classes are PascalCased
class NestedClass : IDisposable
{
public void Dispose()
{
}
}
// Publc Fields and constants are PascalCased
public const float ABitOfPi = 3.14f;
// Fields are camelCased
// NOTE: C# type aliases are used
internal string internalField;
// Fields are camelCased
protected int protectedField;
// Fields are camelCased
// NOTE: C# type aliases are used
private readonly object privateMember;
// Properties are PascalCased
// NOTE: Acronyms longer than 2 characters are PascalCased (e.g.
// Html, Xml)
public int HtmlLength { get; set; }
// Properties are PascalCased
// NOTE: Acronyms of 2 characters are UPPERCASED (e.g. UI, IO)
public string UIElementName { get; }
// Properties are PascalCased
protected string ProtectedProperty { get; }
// Private Properties are camelCased
private string privateProperty { get; }
// Methods are PascalCased
public int Add(int oneValue, int anotherValue)
{
// local variables are camelCased
double result = oneValue * anotherValue;
return result;
}
// Methods are PascalCased
// NOTE: Abbreviations are not treated as Acronyms (so
// _Id_entification is Id, not ID).
protected void AlignObjectById(string id, Alignment alignment)
{
}
}
}
Idea by the Joy of Code.
20Oct/090
Conkerjo.NamingConventions
// Using statements are outside namespace declarations
using System;
namespace Conkerjo.NamingConventions
{
// Enums are PascalCased and singular
public enum Alignment
{
// Enum members are PascalCased
Top,
TopRight,
Right,
BottomRight
Bottom,
BottomLeft,
Left,
TopLeft,
}
// Flag enums are PascalCased and plural
[Flags]
public enum Alignments
{
// Enum members are PascalCased
None = 0x00,
Top = 0x01,
Right = 0x02,
Bottom = 0x04,
Left = 0x08,
}
// Class names are PascalCased
public class ThisIsAClass
{
// Members are grouped by type:
// * Types (nested classes, enums, structures)
// * Fields
// * Constructors
// * Properties
// * Methods
//
// Within these groups the elements are ordered by accessibility,
// from public to private:
// * public
// * internal
// * internal protected
// * protected
// * private
// Nested classes are PascalCased
class NestedClass : IDisposable
{
public void Dispose()
{
}
}
// Publc Fields and constants are PascalCased
public const float ABitOfPi = 3.14f;
// Fields are camelCased
// NOTE: C# type aliases are used
internal string internalField;
// Fields are camelCased
protected int protectedField;
// Fields are camelCased
// NOTE: C# type aliases are used
private readonly object privateMember;
// Properties are PascalCased
// NOTE: Acronyms longer than 2 characters are PascalCased (e.g.
// Html, Xml)
public int HtmlLength { get; set; }
// Properties are PascalCased
// NOTE: Acronyms of 2 characters are UPPERCASED (e.g. UI, IO)
internal string UIElementName { get; }
// Properties are PascalCased
protected string ProtectedProperty { get; }
// Private Properties are camelCased
private string privateProperty { get; }
// Methods are PascalCased
public int Add(int oneValue, int anotherValue)
{
// local variables are camelCased
double result = oneValue * anotherValue;
return result;
}
// Methods are PascalCased
// NOTE: Abbreviations are not treated as Acronyms (so
// _Id_entification is Id, not ID).
protected void AlignObjectById(string id, Alignment alignment)
{
throw new NotImplementedException();
}
}
}
Idea by the Joy of Code.
15Sep/090
Bnoerj.NamingConventions
// Namespaces are PascalCased
namespace Bnoerj.NamingConventions
{
// Using statements are inside namespace declarations
using System;
// Enums are PascalCased and singular
public enum Alignment
{
// Enum members are PascalCased
Top,
TopRight,
Right,
BottomRight
Bottom,
BottomLeft,
Left,
TopLeft,
}
// Flag enums are PascalCased and plural
[Flags]
public enum Alignments
{
// Enum members are PascalCased
None = 0x00,
Top = 0x01,
Right = 0x02,
Bottom = 0x04,
Left = 0x08,
}
// Class names are PascalCased
public class ThisIsAClass
{
// Members are grouped by type:
// * Types (nested classes, enums, structures)
// * Fields
// * Constructors
// * Properties
// * Methods
//
// Within these groups the elements are ordered by accessibility,
// from public to private:
// * public
// * internal
// * internal protected
// * protected
// * private
// Nested classes are PascalCased
class NestedClass : IDisposable
{
public void Dispose()
{
throw new NotImplementedException();
}
}
// Publc Fields and constants are PascalCased
public const float ABitOfPi = 3.14f;
// Fields are camelCased
// NOTE: C# type aliases are used
internal string internalField;
// Fields are camelCased
protected int protectedField;
// Fields are camelCased
// NOTE: private accessibility modifier is omitted
// NOTE: C# type aliases are used
readonly object privateMember;
// Properties are PascalCased
// NOTE: Acronyms longer than 2 characters are PascalCased (e.g.
// Html, Xml)
public int HtmlLength { get; set; }
// Properties are PascalCased
// NOTE: Acronyms of 2 characters are UPPERCASED (e.g. UI, IO)
internal string UIElementName { get; }
// Properties are PascalCased
protected string ProtectedProperty { get; }
// Properties are PascalCased
// NOTE: private accessibility modifier is omitted
string PrivateProperty { get; }
// Methods are PascalCased
// NOTE: private accessibility modifier is omitted
public int Add(int oneValue, int anotherValue)
{
// local variables are camelCased
double result = oneValue * anotherValue;
return result;
}
// Methods are PascalCased
// NOTE: Abbreviations are not treated as Acronyms (so
// _Id_entification is Id, not ID).
protected void AlignObjectById(string id, Alignment alignment)
{
throw new NotImplementedException();
}
}
}
}
Idea by the Joy of Code.