Home »
MCQs »
C# MCQs
What is the correct syntax to define a C# constant?
24. What is the correct syntax to define a C# constant?
- const type constant_name;
- const type constant_name = value;
- const constant_name as type;
- const constant_name as type = value;
Answer: B) const type constant_name = value;
Explanation:
The correct syntax to define a C# constant is:
const type constant_name = value;
Note: A const field requires a value to be provided.