
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
char vs string keywords in C#
string keyword
Use the string keyword to declare a string variable. The string keyword is an alias for the System.String class.
For example.
string name; name = "Tom Hanks";
Another example.
string [] array={ "Hello", "From", "Tutorials", "Point" };
char keyword
The char keyword is used to set array of characters.
For example.
char[] ch = new char[2]; ch[0] = 'A'; // Character literal ch[1] = 'B'; // Character literal
Another example.
char []letters= { 'H', 'e', 'l', 'l','o' };
- Related Articles
- Tokens vs Identifiers vs Keywords in C++
- CHAR vs VARCHAR in SQL
- How to convert an std::string to const char* or char* in C++?
- How to convert a std::string to const char* or char* in C++?
- Copy char array to string in Java
- Convert string to char array in Java
- Convert Char array to String in Java
- Convert string to char array in C++
- Difference between string and char[] types in C++
- String Literal Vs String Object in C#
- Copy characters from string into char Array in Java
- How to convert string to char array in C++?
- Java Program to convert Char array to String
- How to change a specific char in a MySQL string?
- PHP $string{0} vs. $string[0];

Advertisements