How to make a kick start to C#?

  • Thread starter Thread starter SAM
  • Start date Start date
S

SAM

Hi, can any one help me on a quick and efficent start in C sharp? please
help me out...

best regards,
Sam
 
Hi SAM,

If you mean learning C# there are plenty of resources on the internet.
Just do a search for 'C#' and 'Tutorial'.

Basically, you need to put everything inside a class

public class MyClass
{
}

And you need a starting point. The first method that runs is called Main
(capital M)

public class MyClass
{
public static void Main()
{
// this is a comment and will be ignored by the compiler
// put your code here
}
}

If you are creating a windows program you need to create a class that
inherits from System.Windows.Forms.Form

public class MyClass : System.Windows.Forms.Form
{
public static void Main()
{
}
}

And in your Main method you need to call Application.Run with the
constructor of your class as a parameter.

public class MyClass : System.Windows.Forms.Form
{
public MyClass()
{
// this is the class constructor
// You typically create buttons etc here
// note the lack of a return type
// ie it should NOT be 'public void MyClass()'
}

public static void Main()
{
System.Windows.Forms.Application.Run(new MyClass());
}
}

Download the help files for .Net framework from msdn.microsoft.com (SDK)
and use your favourite text program (notepad is fine) to create code.

Once a codefile is created use csc.exe (found in
%windir%/Microsoft.Net/Framework/v1.1.4322/csc.exe or any other v?.? if
you install another version).

csc mycode.cs

will create mycode.exe

Also, you can add using statements to save typing

using System.Windows.Forms;

public class MyClass : Form
{
public MyClass()
{
}

public static void Main()
{
Application.Run(new MyClass());
}
}

This should get you started. Feel free to post questions on this
newsgroup when you are stuck or just curious about something (preferably
C# related) :)
 
Hi Sam,

Not quite sure what it is exactly that you want? Are you looking for
example code, book recommendations?

Otherwise I recommend "using System;" would be a good place to start.
Nick
 
Hi Sam
there is Gotdotnot.com and you can also very helpful sample project with
a variety of topics on codeproject.com .also just from a previous post ,
check
checkout http://www.publicjoe.f9.co.uk. and you can always use the msdn
articles if you want details on specific point
Mohamed M .Mahfouz
Developer Support Engineer
ITWorx on behalf of Microsoft EMEA GTSC
 
Hi, can any one help me on a quick and efficent start in C sharp? please
help me out...

best regards,
Sam
I think there are three different approaches to this question
depending on who you are.

1. You've never written a program in your life before.

2. You've programmed in C, Visual basic or some other procedural
stuff, but never done any object oriented stuff.

3. Youve done object oriented programming in other languages such as
C++ and Java


I'm in the third group and am finding Jesse Liberty's Programming C#
quite handy, in conjunction with Kick Start Managed DirectX by Tom
Miller. Also Windows Forms programming with C# by Eric Brown I would
consider to be a must-have

Jessie Liberty has done a C# book called something like beginning C#
which is probably quite good, though I haven't read it myself.
There'll be plenty of reviews at amazon

If there is a C# for dummies, I'd be inclined to give it a miss. They
progress too slowly.

Kevin R
 
I think there are three different approaches to this question
depending on who you are.

1. You've never written a program in your life before.

2. You've programmed in C, Visual basic or some other procedural
stuff, but never done any object oriented stuff.

3. Youve done object oriented programming in other languages such as
C++ and Java

I fall smack into category 2, and I've found "Microsoft Visual C# .NET Step
By Step" to be a great book for getting me up to speed on both C# and Visual
Studio .NET 2003.

HTH.

-Evan
 
Back
Top