Post: The guide to basic C# programming!
10-04-2011, 08:05 PM #1
Correy
I'm the Original
(adsbygoogle = window.adsbygoogle || []).push({}); C# - About CSharp!
C# - pronounced see sharp is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines. It was developed by Microsoft within its .NET initiative and later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270). C# is one of the programming languages designed for the Common Language Infrastructure.
CSharp is intended to be a simple, modern, general-purpose, object-oriented programming language. Its development team is led by Anders Hejlsberg.

CSharp is known as the most common programming language to this day.
now, lets get onto the most important part of this thread..

To start the tutorial, use the multipages to Navigate through the tutorial, or use the quick navigation below
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.

This thread is brought to you by
- You must login or register to view this content.
- You must login or register to view this content.
[multipage=Arrays]
C#- Arrays
Now if you do not know what a array is or used for read the spoiler below.
- A array is used the set more then one value to a variable.
- Arrays are used highly in encryption & decryption scripts.
- Arrays can be used for the application to add its self multiple variables depending on a file etc.

How to make and set values to an array:
A array is set as any other variable just with [] at the end.
    Int[] ArrayName[COLOR=Red][/COLOR];

In the [] is where you set the amount of values you would like the variable to store.
    Int[COLOR=Red][[B]3[/B]][/COLOR] ArrayName;

To set a value in each array you will do this.
NOTE: the system counts from 0 not 1 so always stay one behind.
    Int ArrayName[COLOR=Red][[B]3[/B]][/COLOR];
ArrayName[COLOR=Red][[B]0[/B]][/COLOR] = 40;
ArrayName[COLOR=Red][[B]1[/B]][/COLOR] = 37;
ArrayName[COLOR=Red][[B]2[/B]] [/COLOR]= 86;

This is a faster way i use to set values.

    Int ArrayName[COLOR=Red][[B]3[/B]][/COLOR] = [COLOR=Red]{[B]40, 37, 86[/B]}[/COLOR];


How to set a number of values though a variable:

There is not much needed to explain how this works,
with basic knowledge of C# you will understand.
    Int ArrayName[] = [COLOR=Red]{[B]37, 43, 54[/B]}[/COLOR];
int i;
for([COLOR=Red][B]i[/B]=0;[B] i<3[/B]; [B]i[/B]++[/COLOR])
{
String Summary = "This Is Generated : " + ArrayName[COLOR=Red][[B]i[/B]][/COLOR];
}



Qucik Navigation

- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.

[multipage=Arguments]
C# - Arguments
For the first part of this tutorial i'll be teaching you the basic of an argument used in a void.
a void is a custom statement, also known as a thread.
here's an example of what an void is if you did not already know.
    
void Tutorial()
{
//A command would go here
}


now onto the argument part, an argument will declare a variable within the thread statement.
an argument takes place within the ( ), but remember.. you need to declare the variable, it may be a string, int or bool.

heres another example to show you..
    
void Tutorial( string Argument )
{
//A command would go here
}


you can have more than one argument, it doesn't have to be the same variable type either.. just like this.
    
void Tutorial( string Argument, int Number, byte aByte )
{
//A command would go here
}


so, some of you will not understand the actually reason for this.. or you'll be baffled, but the whole purpose of an argument is to change a variaty amount of variables to match the command within the void.
here is a little example showing a message box from a void.
- This will get put anywhere in your .cs sheet (form coding)
    
void Tutorial(string Text, int Number)
{
MessageBox.Show(Text + "\nint Number is : " + Number);
}


This would simple get put into a button.
    
Tutorial("This is text which will show..", 10);


and there we have it.
[multipage=For Loop]
The for loop/ statement counts from one number to another number. You start a for loop with the for keyword which is followed by brackets. The first section inside the brackets is where you set the starting value of the loop counter variable. The second section is the loop end condition. The third is where the loop counter is incremented. The code to run for the loop goes after the brackets.

the explanation of the for statement
    
[COLOR="#0000CD"]for ([/COLOR] for-initializeropt [COLOR="#0000CD"];[/COLOR] for-conditionopt [COLOR="#0000CD"];[/COLOR] for-iteratoropt [COLOR="#0000CD"])[/COLOR]


a basic for loop looks something like this.
    
[COLOR="#0000CD"]for (int[/COLOR] i [COLOR="#0000CD"]=[/COLOR] 0; i [COLOR="#0000CD"]<=[/COLOR] 10; i[COLOR="#0000CD"]++[/COLOR] [COLOR="#0000CD"])[/COLOR]


this basically means, this.
you declare the int 'i' as a statement, this means you are inputting the value of 'i', as you can see we have set the value of that with the 'i = 0' so that declares the 'i' represents the value 0.

for the next statement
    
i [COLOR="#0000CD"]<=[/COLOR] 10[COLOR="#0000CD"];[/COLOR]

this statement means the when 'i' is lower or equal to '10' the statement will stop looping, which takes you to the next statement.

    
i[COLOR="#0000CD"]++;[/COLOR]

this part means, if the statement before is false.. other words 'i' Is Not higher or equal to '10' it will add '1' value to 'i'
so, for every loop take place if 'i' is smaller than '10' it will add '1' until it reaches '10'

so, here's the for loop put together to make a function.
    
[COLOR="#0000CD"]for (int[/COLOR] i [COLOR="#0000CD"]=[/COLOR] 0[COLOR="#0000CD"];[/COLOR] i [COLOR="#0000CD"]<=[/COLOR] 10[COLOR="#0000CD"];[/COLOR] i[COLOR="#0000CD"]++)[/COLOR]
[COLOR="#0000CD"]{[/COLOR]
console.Write(i);
[COLOR="#0000CD"]}[/COLOR]


this will then make a console application write separate lines, from '1' to '10', when it reaches '10' it will stop looping until that specific function is called again.
you can change the 'i<=10' to something else, use different symbols to make it loop if it's lower or if it's higher.
you can also set the value of 'int i' to anything you want, this is just the starting point of 'i'

but, if you wanted to make a continuous loop which does not stop you simple add no functions in the for statement.
like this
    
[COLOR="#0000CD"]for([/COLOR];;[COLOR="#0000CD"])[/COLOR]
{
[COLOR="#00cc00"]//Function Here[/COLOR]
}


this will not end until it is returned or ended.


Qucik Navigation

- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.

[multipage=Operators]
C# - Main Operators

here's a quick list of the main operators.. i will then explain then one by one.
    
=
==
!=
||
&&
<
<=
>
>=
!


right, so i'll explain from the list; top to bottom.

C# = '='
the first one is the '=', this Operator is used for setting variables to a certain value.
it's pretty easy, you will have your initial variable, such as a string, int ect.
    
string Tutorial = "Tutorial's Value now equals this text";


C# - '==' Operator
the next operator is the '==', this is always used in a if statement.
this operator will go within you if statement something like this below
    
if ( myVeriable == "Tutorial")


so, basically you have you if..
this statement will check if 'myVeriable' Is equal to 'Tutorial' then something will happen.

C# - '!=' Operator
the next operator is the '!=' this is basically the same as the '==' but the opisate,
if the veriable is Not equal to your value then your function will happen.

C# - '||' Operator
this statement is an 'or' function, it will get your two statements and compare them..
so if i was to have something like..
    
if ( myName == "Corey" || myName == "Badman" )


it will then detect and look for the one which is true ( equal to ) then it will bring out you function depending on your variable or statement value.

C# - '&&' Operator
this is basiscally what you would expect, the && means if these two statements are, then do a command.
it's pretty basic, shouldn't need too much explaining.

C# - < Operator

this statment is used for a int, and int is a numberic only veriable.
this will also be commanded into an if statement such as..
    
if ( int i < 10 )
{
Console.Write( "int i is lower than 10" );
}


C# - <= Operator
this is the same as it's previous '<' but it just means if it's lower or equal to

C# - > Operator
this is exactly like the '<' but the oppisate.
this will also be commanded into an if statement such as..
    
if ( int i < 10 )
{
Console.Write( "int i is higher than 10" );
}


C# - >= Operator
this is the same as it's previous '<' but it just means if it's higher or equal to

C# '!' Operator
now, this one is like the '!=' method but used for one word equastions.
here is an example.
    
bool Tutorial = false;
if (!Tutorial)
{
Console.Write( "Tutorial = false" );
}

this is just like using the '==' statement


Qucik Navigation

- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.

[multipage=Update Log]
04 Septemeber '11
- Started the thread with arguments and the for statement
- Added Arrays thanks to BAdmaNgLiTcHa allowing me to put it in
- Added Most Common Operators

Qucik Navigation

- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
Last edited by Correy ; 10-04-2011 at 11:49 PM.

The following 3 users say thank you to Correy for this useful post:

Curt, xVz

The following user groaned Correy for this awful post:

Epic?
10-05-2011, 10:34 AM #11
Woof
...hmm
Originally posted by Sublimity View Post
Very useful information. You going to add to this?

Both him and me are writting out these in the best form we can Winky Winky - mainly him though, I just help him :p

The following user thanked Woof for this useful post:

tylerallmighty
10-05-2011, 10:48 AM #12
Correy
I'm the Original
Originally posted by Sublimity View Post
Very useful information. You going to add to this?


yes, alot still to come..
10-05-2011, 01:42 PM #13
Pichu
RIP PICHU.
Originally posted by BAdmaNgLiTcHa View Post
Both him and me are writting out these in the best form we can Winky Winky - mainly him though, I just help him :p


Originally posted by Correy View Post
yes, alot still to come..


Alright, cool, although I do have a full C# EBook lol.
10-05-2011, 06:01 PM #14
tylerallmighty
Human After All
Originally posted by Sublimity View Post
Alright, cool, although I do have a full C# EBook lol.


:lol: I have the Home And Learn.co.uk eBook.
10-05-2011, 10:11 PM #15
Pichu
RIP PICHU.
Originally posted by bananaman
:lol: I have the Home And Learn.co.uk eBook.


Nice. Smile Do you have a C++ book? I want to learn C++ as well. :P
10-06-2011, 12:20 AM #16
tylerallmighty
Human After All
Originally posted by Sublimity View Post
Nice. Smile Do you have a C++ book? I want to learn C++ as well. :P


Nope. Haven't gotten that far yet. :P
10-15-2011, 08:49 AM #17
MelestedRabbit
Ultimate Sex God
Originally posted by Correy View Post
C# - About CSharp!
C# - pronounced see sharp is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines. It was developed by Microsoft within its .NET initiative and later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270). C# is one of the programming languages designed for the Common Language Infrastructure.
CSharp is intended to be a simple, modern, general-purpose, object-oriented programming language. Its development team is led by Anders Hejlsberg.

CSharp is known as the most common programming language to this day.
now, lets get onto the most important part of this thread..

To start the tutorial, use the multipages to Navigate through the tutorial, or use the quick navigation below
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.

This thread is brought to you by
- You must login or register to view this content.
- You must login or register to view this content.
[multipage=Arrays]
C#- Arrays
Now if you do not know what a array is or used for read the spoiler below.
- A array is used the set more then one value to a variable.
- Arrays are used highly in encryption & decryption scripts.
- Arrays can be used for the application to add its self multiple variables depending on a file etc.

How to make and set values to an array:
A array is set as any other variable just with [] at the end.
    Int[] ArrayName[COLOR=Red][/COLOR];

In the [] is where you set the amount of values you would like the variable to store.
    Int[COLOR=Red][[B]3[/B]][/COLOR] ArrayName;

To set a value in each array you will do this.
NOTE: the system counts from 0 not 1 so always stay one behind.
    Int ArrayName[COLOR=Red][[B]3[/B]][/COLOR];
ArrayName[COLOR=Red][[B]0[/B]][/COLOR] = 40;
ArrayName[COLOR=Red][[B]1[/B]][/COLOR] = 37;
ArrayName[COLOR=Red][[B]2[/B]] [/COLOR]= 86;

This is a faster way i use to set values.

    Int ArrayName[COLOR=Red][[B]3[/B]][/COLOR] = [COLOR=Red]{[B]40, 37, 86[/B]}[/COLOR];


How to set a number of values though a variable:

There is not much needed to explain how this works,
with basic knowledge of C# you will understand.
    Int ArrayName[] = [COLOR=Red]{[B]37, 43, 54[/B]}[/COLOR];
int i;
for([COLOR=Red][B]i[/B]=0;[B] i<3[/B]; [B]i[/B]++[/COLOR])
{
String Summary = "This Is Generated : " + ArrayName[COLOR=Red][[B]i[/B]][/COLOR];
}



Qucik Navigation

- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.

[multipage=Arguments]
C# - Arguments
For the first part of this tutorial i'll be teaching you the basic of an argument used in a void.
a void is a custom statement, also known as a thread.
here's an example of what an void is if you did not already know.
    
void Tutorial()
{
//A command would go here
}


now onto the argument part, an argument will declare a variable within the thread statement.
an argument takes place within the ( ), but remember.. you need to declare the variable, it may be a string, int or bool.

heres another example to show you..
    
void Tutorial( string Argument )
{
//A command would go here
}


you can have more than one argument, it doesn't have to be the same variable type either.. just like this.
    
void Tutorial( string Argument, int Number, byte aByte )
{
//A command would go here
}


so, some of you will not understand the actually reason for this.. or you'll be baffled, but the whole purpose of an argument is to change a variaty amount of variables to match the command within the void.
here is a little example showing a message box from a void.
- This will get put anywhere in your .cs sheet (form coding)
    
void Tutorial(string Text, int Number)
{
MessageBox.Show(Text + "\nint Number is : " + Number);
}


This would simple get put into a button.
    
Tutorial("This is text which will show..", 10);


and there we have it.
[multipage=For Loop]
The for loop/ statement counts from one number to another number. You start a for loop with the for keyword which is followed by brackets. The first section inside the brackets is where you set the starting value of the loop counter variable. The second section is the loop end condition. The third is where the loop counter is incremented. The code to run for the loop goes after the brackets.

the explanation of the for statement
    
[COLOR="#0000CD"]for ([/COLOR] for-initializeropt [COLOR="#0000CD"];[/COLOR] for-conditionopt [COLOR="#0000CD"];[/COLOR] for-iteratoropt [COLOR="#0000CD"])[/COLOR]


a basic for loop looks something like this.
    
[COLOR="#0000CD"]for (int[/COLOR] i [COLOR="#0000CD"]=[/COLOR] 0; i [COLOR="#0000CD"]<=[/COLOR] 10; i[COLOR="#0000CD"]++[/COLOR] [COLOR="#0000CD"])[/COLOR]


this basically means, this.
you declare the int 'i' as a statement, this means you are inputting the value of 'i', as you can see we have set the value of that with the 'i = 0' so that declares the 'i' represents the value 0.

for the next statement
    
i [COLOR="#0000CD"]<=[/COLOR] 10[COLOR="#0000CD"];[/COLOR]

this statement means the when 'i' is lower or equal to '10' the statement will stop looping, which takes you to the next statement.

    
i[COLOR="#0000CD"]++;[/COLOR]

this part means, if the statement before is false.. other words 'i' Is Not higher or equal to '10' it will add '1' value to 'i'
so, for every loop take place if 'i' is smaller than '10' it will add '1' until it reaches '10'

so, here's the for loop put together to make a function.
    
[COLOR="#0000CD"]for (int[/COLOR] i [COLOR="#0000CD"]=[/COLOR] 0[COLOR="#0000CD"];[/COLOR] i [COLOR="#0000CD"]<=[/COLOR] 10[COLOR="#0000CD"];[/COLOR] i[COLOR="#0000CD"]++)[/COLOR]
[COLOR="#0000CD"]{[/COLOR]
console.Write(i);
[COLOR="#0000CD"]}[/COLOR]


this will then make a console application write separate lines, from '1' to '10', when it reaches '10' it will stop looping until that specific function is called again.
you can change the 'i<=10' to something else, use different symbols to make it loop if it's lower or if it's higher.
you can also set the value of 'int i' to anything you want, this is just the starting point of 'i'

but, if you wanted to make a continuous loop which does not stop you simple add no functions in the for statement.
like this
    
[COLOR="#0000CD"]for([/COLOR];;[COLOR="#0000CD"])[/COLOR]
{
[COLOR="#00cc00"]//Function Here[/COLOR]
}


this will not end until it is returned or ended.


Qucik Navigation

- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.

[multipage=Operators]
C# - Main Operators

here's a quick list of the main operators.. i will then explain then one by one.
    
=
==
!=
||
&&
<
<=
>
>=
!


right, so i'll explain from the list; top to bottom.

C# = '='
the first one is the '=', this Operator is used for setting variables to a certain value.
it's pretty easy, you will have your initial variable, such as a string, int ect.
    
string Tutorial = "Tutorial's Value now equals this text";


C# - '==' Operator
the next operator is the '==', this is always used in a if statement.
this operator will go within you if statement something like this below
    
if ( myVeriable == "Tutorial")


so, basically you have you if..
this statement will check if 'myVeriable' Is equal to 'Tutorial' then something will happen.

C# - '!=' Operator
the next operator is the '!=' this is basically the same as the '==' but the opisate,
if the veriable is Not equal to your value then your function will happen.

C# - '||' Operator
this statement is an 'or' function, it will get your two statements and compare them..
so if i was to have something like..
    
if ( myName == "Corey" || myName == "Badman" )


it will then detect and look for the one which is true ( equal to ) then it will bring out you function depending on your variable or statement value.

C# - '&&' Operator
this is basiscally what you would expect, the && means if these two statements are, then do a command.
it's pretty basic, shouldn't need too much explaining.

C# - < Operator

this statment is used for a int, and int is a numberic only veriable.
this will also be commanded into an if statement such as..
    
if ( int i < 10 )
{
Console.Write( "int i is lower than 10" );
}


C# - <= Operator
this is the same as it's previous '<' but it just means if it's lower or equal to

C# - > Operator
this is exactly like the '<' but the oppisate.
this will also be commanded into an if statement such as..
    
if ( int i < 10 )
{
Console.Write( "int i is higher than 10" );
}


C# - >= Operator
this is the same as it's previous '<' but it just means if it's higher or equal to

C# '!' Operator
now, this one is like the '!=' method but used for one word equastions.
here is an example.
    
bool Tutorial = false;
if (!Tutorial)
{
Console.Write( "Tutorial = false" );
}

this is just like using the '==' statement


Qucik Navigation

- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.

[multipage=Update Log]
04 Septemeber '11
- Started the thread with arguments and the for statement
- Added Arrays thanks to BAdmaNgLiTcHa allowing me to put it in
- Added Most Common Operators

Qucik Navigation

- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.
- You must login or register to view this content.


could you please make a simple tutorial ?
10-15-2011, 11:40 AM #18
Correy
I'm the Original
Originally posted by MelestedRabbit View Post
could you please make a simple tutorial ?


what tutorial, this is for learning the methods but if you need a tutorial let me know which one Smile
10-15-2011, 11:41 AM #19
MelestedRabbit
Ultimate Sex God
Originally posted by Correy View Post
what tutorial, this is for learning the methods but if you need a tutorial let me know which one Smile


can you make a tutorial on how to make a basic program ?
with the simplest comp language

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo