Switch to full style
C# examples
Post a reply

First Application in c#

Wed Jul 01, 2009 9:31 pm

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:

csharp 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
csharp 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 sensitive 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:
Code:
abstract const  extern int  out  short  typeof
as  continue  false  interface  override  sizeof  uint
base
decimal
finally
internal
params   
stackalloc   
ulong

bool
default
fixed   is   
private
static
unchecked
break
delegate
float
lock   
protected
string
unsafe

byte
do
for
long
public
struct
ushort

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:
Code:
get
partial
set
value
where
yield




Re: First Application in c#

Wed Sep 22, 2010 1:11 pm

I still remember when i started learning C# this was the very first program...:wink:

So enjoy guyz....lotz more to come for you.... :yahoo:

Post a reply
  Related Posts  to : First Application in c#
 Connecting Java Application to C++ Application from Code     -  
 I need chat application using php     -  
 About Mobile application     -  
 My First Ajax application     -  
 want to develop an application of my own     -  
 Mobile Application     -  
 GUI for video capturing application     -  
 Chat Room application     -  
 Help Sending e-mail from VB.Net application     -  
 Web enabling of windows application     -  

Topic Tags

C# Basics