Programming in C# language

The most important commands from C# programming language in one place, a unique comparison and each command-operator is shown using a piece of program. Statements-operators of these sample programs are clickable, so with a simple click we have more information available.

Programming language C#:


lexical elements

Lexical elements are numeric, string constants and comments in the code.

types and variables

Types and variables are closely related because variables are the most important elements of our program in which we store data, partial results of our calculations. Types tell us what data can be stored in variables.

program structure


operators

Operators perform an operation between the operands, this operation can be mathematical, logical, or bitwise.
parenthesis operator: ( )

statements

Statements are important elements for writing programs. Generally one statement line corresponds to one line program. The main group of the statements are: cycles, program branching and flow control.

C#

 i = x * 5;
 while (i>0)
   if (i==10)
     break;
   else 
   {
     i--;
   }

Examples - C#

C#

if (i > 10)
{
i =10;            i = i - 1;   i++;
}
if (i < 10) i = 10; else i=1;

C#

a = 5 < 10;       // a = true 
b = 8 < x; 
if (y < 100)  
  x++; 

C#

Other pieces of example codes:
if (i==10)
     break;
   else 
   {
     i--;
   }
if (y < 100)  
  x++;
while ( y >= 0 )  
      --y;
(float)50 / i
y =(double)(x * y)
int x= -12345;
Languages: en hu cz sk