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-04-2011, 08:39 PM #2
Epic?
Awe-Inspiring
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.

[multipage=Arguements]
C# - Arguements
For the first part of this tutorial i'll be teaching you the basic of an arguement 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 arguement part, an argument will declare a variable within the thread statement.
an arguement 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 Arguement )
{
//A command would go here
}


you can have more than one arguement, it doesn't have to be the same variable type either.. just like this.
    
void Tutorial( string Arguement, 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 arguement is to change a variaty amount of veriables 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=Update Log]
04 Septemeber '11
Started the thread with arguements and the for statement


Just FYI, "arguements" is spelled "arguments".

And perhaps you should start a little more basic before directly jumping into methods? For example.... a hello world program or something like that?
Also, you might want to focus more on teaching about the methods than about the arguments that methods can take, I mean, arguments aren't a terribly complex topic....
10-04-2011, 08:43 PM #3
Correy
I'm the Original
Originally posted by Epic
Just FYI, "arguements" is spelled "arguments".

And perhaps you should start a little more basic before directly jumping into methods? For example.... a hello world program or something like that?
Also, you might want to focus more on teaching about the methods than about the arguments that methods can take, I mean, arguments aren't a terribly complex topic....


well, by the end of this tutorial it won't be complex.. there's alot more too do, i'm working on it.. so just give it a little time Winky Winky
10-04-2011, 10:53 PM #4
Woof
...hmm
Originally posted by Epic
Just FYI, "arguements" is spelled "arguments".

And perhaps you should start a little more basic before directly jumping into methods? For example.... a hello world program or something like that?
Also, you might want to focus more on teaching about the methods than about the arguments that methods can take, I mean, arguments aren't a terribly complex topic....

#
You wont need to teach somebody about methods if they know the syntax - which this tutorial is for.

Its basiclly like your saying "What if people do not speak english? how will they read these tutorials", its a totally invalid reply.
10-04-2011, 11:54 PM #5
Default Avatar
Cade
Guest
Thanks :happycry:

I have been wanting to get into this.
10-04-2011, 11:57 PM #6
Correy
I'm the Original
Originally posted by Team
Thanks :happycry:

I have been wanting to get into this.


it will be getting updated, and now is your chance to make a name for youself Winky Winky
10-04-2011, 11:58 PM #7
Default Avatar
Cade
Guest
Originally posted by Correy View Post
it will be getting updated, and now is your chance to make a name for youself Winky Winky


I already learned about arrays from javascript, this shouldn't be to hard. Awesome face
10-05-2011, 01:07 AM #8
Jeremy
Former Staff
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;

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.
Fantastic, another thing for me to fail at! :(
10-05-2011, 03:16 AM #9
great thread, now people will have a place to advance with c#.
as for hello world

here's a fancy one


    
//First C# Program
using System;

namespace Main
{
class Welcome
{
public static void Main( string[] args )
{
Console.Write("Hello world\n");
}
}
}

Last edited by Docko412 ; 10-05-2011 at 03:19 AM.
10-05-2011, 04:26 AM #10
Pichu
RIP PICHU.
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;

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.


Very useful information. You going to add to this?

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo