Warning: INSERT command denied to user 'dbo292345962'@'' for table 'watchdog' query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:400:\"INSERT command denied to user 'dbo292345962'@'' for table 'captcha_sessions'\nquery: INSERT into captcha_sessions (uid, sid, ip_address, timestamp, form_id, solution, status, attempts) VALUES (0, '27c91e95f1f98b6adf50813237ea6a59', '', 1594304086, 'comment_form', 'eb5663fce98e9c8f1a0e57adbc67c475', 0, 0)\";s:5:\"%file\";s:62:\"/homepages/25/d199835659/htdocs/ID/modules/captcha/captcha.inc\";s:5:\"%line\";i:99;}& in /homepages/25/d199835659/htdocs/ID/includes/database.mysql.inc on line 135
Getting Started with C# Programming | Inferno Development

Getting Started with C# Programming

C# (C Sharp) is a Microsoft programming language created to compete with Java and C++. C# was developed in 2000 as an object oriented, multi-paradigm programming language within the .NET Framework (a programming library that comes with windows).


C# has become popular over the years as an alternative to Java. Due to its ease of use and visual GUI programming through Visual Studio .NET, it is currently the 4th most searched programming language on search engines (after C / C++, Java, Python, and Visual Basic).

Getting Started

To start learning and developing C#, you need an IDE that can compile your C# applications. Visual Studio .NET, 2008, 2010, or Sharp Develop (free). The express version of Visual Studio is free.

First C# Program

The C# language is very similar to C++ and Java, borrowing elements from both. Every function in C# is in a class and they are all usually in their own namespace (this is for organizational purposes).

Remember that C# is case-sensitive, so be careful with how you type.

using System;
This is a multi-line comment, it is not compiled or used by C# but for easy documentation, if you use "using System" then you don't have to type System.Console.WriteLine, and instead can type Console.WriteLine.

public class MyCSharpClass
   public static void Main(string[] arguments)
       // single line comment
       Console.WriteLine("Number of command line parameters = {0}", arguments.Length);
       for(int i = 0; i < arguments.Length; i++)
           Console.WriteLine("Arg{0} = {1}", i, arguments[i]);

First we declare our own class called "MyCSharpClass" (you can make up a name). The static void Main is an important function that C# looks for in each program to know the starting point of each program (each program must have this).

string[] arguments is an array of strings (a list of strings), that are gathered from the command line arguments.

If your program is named "CoolSharp", then in command prompt you may type "CoolSharp parameter1 parameter2" and that list will contain "parameter1" for arguments[0] and "parameter2" for arguments[1].

Therefore, we loop through the arguments with a "for" loop. And display each argument in the command line. We use arguments.Length property to learn how many parameters the user entered in his console.

Give this a try after you compile an empty project with this source code (call it MyCSharpClass.cs).

int i, is an integer variable that is incremented in the for loop to keep track of how many loops we've made so far. The {0} and {1} are special keywords used to gather the second and third argument from a WriteLine() function.

Learning C#

If you're a beginner to programming C# is a good language to begin. If you constantly run examples, compile them, and edit them you will begin to understand why and how they work. Keep reading more tutorials like this one and check out our C# section.

You may also visit our C# forums and ask for help from experienced programmers that work for companies developing C# applications.

Tomescu Alin's picture

Good introductory article!

Good introductory article!


Get Linux or die tryin'

Baran Ornarli's picture

Thanks alinush. I hope you

Thanks alinush. I hope you enjoyed it. I think you and I should write more C# tutorials.

Bob's picture

Thanks for this, I was

Thanks for this, I was wondering about C# recently.

Kyle's picture

Ah C# tutorials, really cool

Ah C# tutorials, really cool stuff.

Jake's picture

I'd like to see more indepth

I'd like to see more indepth tutorials on C# in the near future! :D.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.