Our first example demonstrates strings and runes in C#. In C#, strings are immutable sequences of Unicode characters. The concept of a rune in C# is represented by the char type, which is a 16-bit Unicode character.
To run the program, save it as StringsAndRunes.cs and use the C# compiler:
This C# example demonstrates how to work with strings and characters (equivalent to runes in Go). Note that C# uses UTF-16 encoding for strings internally, which is different from Go’s UTF-8 encoding. This can lead to some differences in how characters are handled, especially for characters outside the Basic Multilingual Plane.