Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find character constants in C#?

Tags:

c#

I currently have this code:

if (e.KeyChar == (char)8)
{

}

What I would like is the C# equivalent of the vbBackspace constant. Is there such a thing in C#?

Example:

if (e.KeyChar == SomeNameSpace.Something.Backspace)
{

}
like image 677
Greg Finzer Avatar asked Sep 17 '09 12:09

Greg Finzer


People also ask

Where do you define constants in C?

Variables can be declared as constants by using the “const” keyword before the datatype of the variable. The constant variables can be initialized once only. The default value of constant variables are zero.

What is string character constant in C?

String Literals. A String Literal, also known as a string constant or constant string, is a string of characters enclosed in double quotes, such as "To err is human - To really foul things up requires a computer." String literals are stored in C as an array of chars, terminted by a null byte.

Which is not character constant in C?

Answer: 6 isn't a constant character. As long as the character is enclosed in quotation marks (“), it is considered to be an enclosing character constant. During the execution of a programme, characters in the character set are represented by character constants.


1 Answers

if (e.KeyChar == Keys.Back)
{

}

Look here for more info

like image 121
Seth Moore Avatar answered Oct 08 '22 01:10

Seth Moore