In: Computer Science
Question 1: What are the requirements when choosing an identifier for a C# class?
Question 2: What are the types of comments supported by C#?
Solution for the given questions are as follows -
Question 1 : What are the requirements when choosing an identifier for a C# class?
Answer :
Following are requirements for when choosing an identifier for a C# class
- An identifier must start with a letter or an underscore
- After the first character, it may contain numbers, letters, connectors, etc
- If the identifier is a keyword, it must be prepended with “@”
- Identifiers should not contain white spaces.
- identifers allow Unicode Characters.
- identifiers are case-sensitive.
- identifers cannot contain more than 512 characters.
Question 2: What are the types of comments supported by C#?
Answer :
Following are 2 types of comments supported in C#
1) Single Line Comments : It is used to comment
a single line. These comment can be written in a separate line or
along with the codes in the same line.
Syntax :
// Single Line Comments
2) Multiline Comments : It is used to comment more than one line. This is used to comment out an entire block of code statements.
Syntax :
/* Multiline Comment */