first steps in net land

Thu, Nov 16, 2006

So after dabbling in assembler again, I thought I’d lurch forward a few decades and have a look at C#. I have a load of C++ code that I wrote to interface to Groupwise and create accounts in the postoffices automatically and it’s getting time to think about upgrading it. At the moment it’s an exe invoked via Java so it’s quite slow. I was going to do it as a DLL and keep it in memory while the main Java application was running but I thought it might have uses outside the Java app. Turned out that wasn’t the case and so it’s a slow exe being loaded on every call.

So instead of doing a DLL during the upgrade I took a look at C# to see what it’s about. To play around with it on OS X, I downloaded Mono, which brings .NET to the Mac. The DMG installs Mono in /Library/Frameworks/Mono.framework and it comes with the C# compiler mcs.

I then did a simple hello world in C#:

using System;

namespace HelloNameSpace { public class HelloWorld { static void Main(string[] args) { Console.WriteLine(“Hello World!"); } } }

and compiled it using mcs

mcs HelloWorld.cs

and then ran it using Mono:

mono HelloWorld.exe

and it worked a treat!

comments powered by Disqus