Prompt
Maintain consistent naming patterns throughout your code to improve readability and maintainability. Follow these guidelines:
- Use PascalCase for public methods and members
// Incorrect public static int iCreateProcessInfo() { ... } // Correct public static int CreateProcessInfo() { ... } - Method names should accurately reflect their purpose
// Misleading (doesn't return anything) public static void GetExtendedHelp(ParseResult _) { ... } // Better public static void DisplayHelp(ParseResult _) { ... } - Match related parameter names for clarity
// Inconsistent GetConnectionInfo(connection, out protocol, out cipherSuite, ref negotiatedAlpn, out alpnLength); // Consistent GetConnectionInfo(connection, out protocol, out cipherSuite, ref negotiatedAlpn, out negotiatedAlpnLength); - Design enums with meaningful defaults
// 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 } - Use consistent abbreviations based on platform conventions
// 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.