Joined: Wed Jul 01, 2009 8:19 pm Posts: 2 Has thanked: 0 time Have thanks: 0 time
Hello every one let's start Here we will write our first application in c# this is a sample application as console application It's very easy app Please open new project as C# console application now we will write hello world application in c# When u open it u will see this:
Code:
using System; // this is the default namespaces written in code using System.Collections.Generic; using System.Linq; using System.Text;
namespace HelloWorld // HelloWorld this is the name of the class { class Program { static void Main(string[] args) { Console.WriteLine("Hello World"); // message that printed in command prompt screen or black screen } } }
Please When U run the project Run it as Start Without debuging mode to see What u Write
Let's see the command prompt Write Hello World
What if u want to enter any thing and then print it on screen
Code:
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace HelloWorld { class Program { static void Main(string[] args) { String str = ""; Console.WriteLine("Please Enter Your Name: "); str=Console.ReadLine(); Console.WriteLine("Hello : {0}",str); } } }
Please Note That C# Language is a case sensetive language that's mean Sam not sam Not SaM In second code we use String AS a data type String str mean create location in memory to whole text buffer only The all Names in c# is:
abstract const extern int out short typeof as continue false interface override sizeof uint base decimal finally internal params stackalloc ulong
case double foreach namespace readonly switch using
catch else goto new ref this virtual
char enum if null return throw void
checked event implicit object sbyte true volatile class explicit in operator sealed try while
Besides these keywords, C# has other words that should be reserved only depending on how and where they are used. These are referred to as contextual keywords and they are: get partial set value where yield
In second lesson I will show in details what is data types in C# and what is array, functions, classes and write sample on it revualt
doyoubuzz
Code subject: Re: First Application in c#
Posted: Wed Sep 22, 2010 1:11 pm
Joined: Tue Sep 07, 2010 9:18 am Posts: 30 Has thanked: 0 time Have thanks: 1 time
I still remember when i started learning C# this was the very first program...