I was going through a list of articles available on the INETA website. I came across an article with the heading “Why C # is sharp and why is VB.NET basic?” Hmmm… However, the author has no intentions of looking down upon VB. I have done quite a few projects in VB 6. I am still a VB enthusiast because what I like most about it, is its simplicity and ability to do amazing stuff with little effort (directly proportional to coding?? Ahem…).
A few days back, I had read an extensive comparison between 11 languages in the September 2004 edition of DIQ (Developer IQ http://www.developeriq.com). It was called “The Great Language Shootout”. The article tabulates the results with C# scoring an overall 68pts and Java landing at 65pts. The article also explains in detail about the evaluation process. These figures are clearly just indicators of a test process and cannot form the basis to decide the power and application of any language or its future.
Unable to resist the temptation, I decided to write a simple HelloWorld… nope not just World… HelloManagedWorld program in C#. Managed because, I’m using the .NET csc compiler.
The code:
using System;
class helloManagedWorld
{
static void Main()
{
Console.WriteLine("Hello Managed World!");
}
}
Some explanation:
The using System; directive references a namespace called System that is provided by the Microsoft .NET Framework class library. This namespace contains the Console class referred to in the Main method. Namespaces provide a hierarchical means of organizing the elements of one or more programs. A “using” directive enables unqualified use of the types that are members of the namespace. The “Hello Managed World!” program uses Console.WriteLine as shorthand for System.Console.WriteLine.
The Main method is a member of the class helloManagedWorld. It has the static modifier, and so it is a method on the class helloManagedWorld rather than on instances of this class.
The entry point for an application—the method that is called to begin execution—is always a static method named Main.
How to compile the geeky way (ie. if you only have the .NET Framework, without VS.NET):
I started off with some errors as usual... case sensitivity and some syntax problems…
C:\WINNT\Microsoft.NET\Framework\v1.0.3705>csc helloWorld.cs
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
helloWorld.cs(4,30): error CS1552: Array type specifier, [], must appear before
parameter name
C:\WINNT\Microsoft.NET\Framework\v1.0.3705>csc helloWorld.cs
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
error CS5001: Program 'helloWorld.exe' does not have an entry point defined
C:\WINNT\Microsoft.NET\Framework\v1.0.3705>csc helloWorld.cs
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
C:\WINNT\Microsoft.NET\Framework\v1.0.3705>helloWorld
Hello World!
Wasn’t that simple enough? So this is just the beginning. Lets see where I go from here. :-)
Hi!
I am Sunil Jagadish (a.k.a HandledException – Sounds geeky eh? Not to worry. I am not so.) Ok if you know about me, that’s fine. Lets get down to business. If you don’t know much about me, I suggest you take a peek at my general blog http://suniljagadish.blogspot.com
I am learning .NET now. So the info what you can find about .NET o’er here would be basic stuff. If you still think that you would be interested, go ahead!
Critical comments, views, suggestions etc are solicited.
Happy programming!!