Maintain consistent naming patterns throughout your code to improve readability and maintainability. Follow these guidelines: 1. Use PascalCase for public methods and members
Maintain consistent naming patterns throughout your code to improve readability and maintainability. Follow these guidelines:
// Incorrect
public static int iCreateProcessInfo() { ... }
// Correct
public static int CreateProcessInfo() { ... }
// Misleading (doesn't return anything)
public static void GetExtendedHelp(ParseResult _) { ... }
// Better
public static void DisplayHelp(ParseResult _) { ... }
// Inconsistent
GetConnectionInfo(connection, out protocol, out cipherSuite, ref negotiatedAlpn, out alpnLength);
// Consistent
GetConnectionInfo(connection, out protocol, out cipherSuite, ref negotiatedAlpn, out negotiatedAlpnLength);
// Poor design (default value is meaningful)
public enum ExtendedLayoutKind
{
None = -1,
CStruct = 0 // This becomes the default!
}
// Better design
public enum ExtendedLayoutKind
{
None = 0, // Default is semantically "none"
CStruct = 1
}
// Unnecessarily verbose when platform uses "Nw" consistently
internal sealed class SafeNetworkFrameworkHandle : SafeHandleZeroOrMinusOneIsInvalid
// Better
internal sealed class SafeNwHandle : SafeHandleZeroOrMinusOneIsInvalid
When selecting names, consider how they’ll be read in context and their alignment with existing patterns in your codebase and the platform.
Enter the URL of a public GitHub repository