

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to define character constants in C#?
Character literals are enclosed in single quotes. For example, 'x' and can be stored in a simple variable of char type. A character literal can be a plain character (such as 'x'), an escape sequence (such as '\t'), or a universal character (such as '\u02C0').
Let us see an example how to define a character constant in C# −
using System; namespace Demo { class Program { static void Main(string[] args) { Console.WriteLine("Welcome!\t\n\n"); Console.WriteLine("This is it!"); Console.ReadLine(); } } }
Above, we have used the \n and \t constants that are new-line and horizontal tab constants −
Console.WriteLine("Welcome!\t\n\n"); Console.WriteLine("This is it!");
- Related Questions & Answers
- How to define constants in C++?
- How to define integer constants in JavaScript?
- How do I define string constants in C++?
- Difference between C++ string constants and character constants
- What are C++ Character Constants?
- What is a constant and how to define constants in Java?
- Character constants vs String literals in C#
- What are Backslash character constants in C language?
- Data type of character constants in C and C++
- How to implement constants in java?
- How to declare string constants in JavaScript?
- PHP Constants
- How to create Variables and Constants in C++?
- How to create constants in JavaScript? Explain with examples.
- Decimal constants in C#
Advertisements