Quote:
C# is Microsoft's new programming language for the .NET platform. It combines some of the
best features of modern programming languages such as Java, C++ or Visual Basic. C# is an
object-oriented language with single inheritance but multiple interfaces per class. It
supports component-based programming by properties (smart fields), events and delegates
(enhanced function pointers). C# is fully interoperable with other .NET languages such as
VB.NET, Eiffel.NET or Oberon.NET.
What you will need
-The Compiler/IDE
As far as this goes you have a few choices, the top two however are SharpDevelop
(Free)(http://www.icsharpcode.net/Opensource/SD/), and visual Studios (Not free
(http://msdn.microsoft.com/vstudio/). SharpDevelop is the way to go if your tight on money.
-Getting Started (Your First Program)
By now you should have choosen a compiler to use. Open up a new "Console Application", and
do the following.
Code:
using System;
class Hello
{
public class HelloWorld
{
public static void Main()
{
Console.WriteLine("Hello World! ");
Console.ReadLine();
}
}
}
Now save and compile and run. You just made your first program. It should print hello world
to your screen in a dos box, and close when you press enter.
Think your ready to up it one step? Here is another console application example.
Code:
using System;
using System.Collections.Generic;
using System.Text;
namespace YourName
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello there!");
Console.Write("Please input your name: ");
string alfa = Console.ReadLine();
Console.WriteLine("Hello " + alfa + ". Welcome to C#");
Console.Read();
}
}
}
That application is simple, it only asks for a name, then displays it on the console along with a little message.
------------------
Next article will cover more beginner topics, and begin to get a little more advaced.
_________________
Protect your computer
Proud Member of ASAP (Alliance of Security Analysis Professionals)
