Monday, November 24, 2008

Looping

By using loop technique you can repeat operation as many time as you want.So you do not write the same code each time.

So we can categorized the main type of loop techniques that are use in C# as follows.

1. do-while loop

2. while loop

3. for loop

Interrupting Loops


Some times you want finger-grained control over the processing of looping code. There are 4 kinds of command in C# to do that task.

1. break - Causes the loop to end immediately

2. continue - Causes the current loop cycle to end immediately

3. goto - Allows jumping out of a loop to a labeled position

4. return - Jumps out of the loop and its containing function



The switch Statement


The switch statement is similar to th if statement in that it executes code conditionally based on the of test.

We can show the basic structure of a switch statement is as above.

Basic C# Console Application Structure

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
// Output text to the screen.
Console.WriteLine(“The first app in Beginning C# Programming!”);
Console.ReadKey();
}
}
}

The most important section of code at the moment is the following:

static void Main(string[] args)
{
// Output text to the screen.
Console.WriteLine(“The first app in Beginning C# Programming!”);
Console.ReadKey();
}

when we run the above console application this code will executed and will print on the screen “The first app in Beginning C# Programming!”.

In console application in C# to print the output we use " Console.WriteLine( );" .And inside the bracket we should put the message that we want to display.

Basic C# Console Application Structure

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
// Output text to the screen.
Console.WriteLine(“The first app in Beginning C# Programming!”);
Console.ReadKey();
}
}
}

The most important section of code at the moment is the following:

static void Main(string[] args)
{
// Output text to the screen.
Console.WriteLine(“The first app in Beginning C# Programming!”);
Console.ReadKey();
}

when we run the above console application this code will executed and will print on the s

Basic C# Console Application Structure

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
// Output text to the screen.
Console.WriteLine(“The first app in Beginning C# Programming!”);
Console.ReadKey();
}
}
}

The most important section of code at the moment is the following:

static void Main(string[] args)
{
// Output text to the screen.
Console.WriteLine(“The first app in Beginning C# Programming!”);
Console.ReadKey();
}

when we run the above console application this code will executed and will

Thursday, October 9, 2008

Creating your first C# program

1.Create a new C# console application project by using Visual studio .

2.And type below coding ad compile it

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
// Output text to the screen.
Console.WriteLine(“The first app in Beginning C# Programming!”);
Console.ReadKey();
}
}
}

3.And press the any key to exit from the application.

Brief discussion

1.We used to print the output we use "Console.WriteLine"
2.Here we use "Console.ReadKey();" to detect keyboard input.if we press any key then program will complete it's execution.We used this method here to see out put of the program.otherwise you can't see the output.because it will complete the execution with in second and you can't see the output.to avoid that we use this command.

Thursday, August 14, 2008

C# reference Books

If any one want to get C# reference book please ask me i will provide the link for that.Else I also can send the book that are very useful to learn basic.You can send me a email.My email address is erandika1986@gmail.com.