Skip to content

EN CSharp Syntax

Codex edited this page Oct 11, 2026 · 2 revisions

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

Syntax, comments and names

Manual C# · Examples UO

The names are case sensitive: value and Value are different identifiers. The keyword can be used as a name with @, for example @event. Spaces typically separate tokens, and { } defines a block. Comments // continue to the end of the line, /* */ span several lines.

Simple example (Example.cs)

Save this example separately as Example.cs. Run it independently of the other examples on this page.

Example.cs:

// PROJECT-EXAMPLE
// A statement ends with a semicolon.
int count = 3;
System.Console.WriteLine(count);

Result:

3
// A short local report.
int @event = 1;
/* This block does not execute. */
UO.Print($"Event number: {@event}");

Literals specify numbers, strings, characters, true, false, and null. Unicode is acceptable in strings and names. Don't confuse the character 'A' with the string "A".

int graphic = 0x0EED;
int mask = 0b0011;
long large = 1_000_000L;
char letter = 'A';
bool ready = true;
UO.Print($"{graphic}, {mask}, {large}, {letter}, {ready}");

Official documentation: Syntax, comments and names - Microsoft Learn.

Clone this wiki locally