# Unicode Characters In Strings
Notice the 🍇 in the line 7 of the program. Do you think this program will compile and run?
using System;
class MainClass
{
public static void Main ()
{
Console.WriteLine("I like 🍇");
}
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Try running this program in your IDE.
Did it work?
You can use emoji in your strings. It is because unlike C and C++, C# strings are Unicode characters.
These lines are valid code.
Console.WriteLine("🍔 🍟");
Console.WriteLine("I ❤️ reading 📚.");
Console.Write("I am from 🇵🇰 \n");
1
2
3
2
3
You can also write text in languages other than English.
Console.WriteLine("اِنَّا لِلّٰہِ وَاِنَّآ اِلَیْہِ رَاجِعُوْنَ"); // Arabic
Console.Write("یہ تو ہوگا!"); // Urdu
1
2
2
Remember, C# strings are Unicode characters.
What is Unicode?
We will learn Unicode in detail later. For now, you only need to understand you can use C# strings to write emoji and text in any language of the world.
# Exercise 1
Will this code compile and run? Do not use IDE to answer this question.
string name = "محمد طلحہ منضور";
Console.WriteLine(name);
1
2
2