0
0
C Sharp (C#)programming~5 mins

Naming conventions in C# - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the recommended naming style for classes in C#?
Classes should use PascalCase, where each word starts with a capital letter and no underscores are used. Example: CustomerOrder.
Click to reveal answer
beginner
How should private fields be named in C#?
Private fields typically use camelCase with a leading underscore. Example: _totalAmount.
Click to reveal answer
beginner
What naming convention is used for methods in C#?
Methods should use PascalCase. Each word starts with a capital letter and no underscores. Example: CalculateTotal().
Click to reveal answer
intermediate
How are constants named in C#?
Constants use PascalCase without underscores. Example: MaxItems. Avoid all uppercase with underscores.
Click to reveal answer
beginner
What is the naming style for interfaces in C#?
Interfaces use PascalCase and start with the letter I. Example: IShape.
Click to reveal answer
Which naming style is recommended for C# method names?
AALL_CAPS
BcamelCase
Csnake_case
DPascalCase
How should private fields be named in C#?
APascalCase without underscore
BcamelCase with leading underscore
CALL_CAPS with underscores
Dsnake_case
What prefix is used for interface names in C#?
AI
BC
CM
DNo prefix
Which naming style is NOT recommended for constants in C#?
AALL_CAPS with underscores
BcamelCase
CPascalCase
DPascalCase without underscores
Which of these is a correct class name in C#?
AcustomerOrder
BCustomer_Order
CCustomerOrder
D_customerOrder
Explain the naming conventions for classes, methods, and private fields in C#.
Think about how each type of identifier looks and starts.
You got /3 concepts.
    Describe how interfaces and constants should be named in C# and why.
    Consider the special prefix for interfaces and the style for constants.
    You got /3 concepts.