You are on page 1of 1

C# basics:

totally OOP, like java

'using' command to import classes


'System' class imported at the start of each program
namespace(collection of classes) command is the used with name of the program after
the 'using' command and global variables
after the namespace, the main class of program is defined using 'class' command
static void main(string[] args)

data types:
bool: true or false
string: for storing text with indefinite amount of characters
int: for integers
char: for single character
float: for decimals
all have their classes(class int, etc) for Parse and other commands, eg:
int.Parse(String)

defining variables:
<private/public(default)> <data type> <variable name>
or
<private/public(default)> <data type> <variable name>=value

if(condition),if(condition) else,switch(int) statemnents


for(var;condition;increment), foreach(var in array), while(condition),
do(condition) loops

Console class for accessing console:


Writeline(String) (for writing something to the console)
Readline(void) (for reading a line on the console(input command))

You might also like