A good new years gift…

My day job keeps me housed in Visual Studio 2010/Windows, so for my out of hours development I feel I need a change, so for many years I have been a home mac and/or linux user; anyway I have used many languages over the years but I feel more comfortable using C#, so my development environment of choice is monodevelop.

Last week I was lucky to get onto the MonoDroid beta, I thought of it is New Year gift from Mono/Novell guys…

So last week I started to playing with it…. its fun… and I think its going to be fun ride using Mono, C# and Android. With phone such as my nexus one and the recently announced Droid Bionic (2GHz dual-core processor, 512mb) it really means that we can start to put some quite computational intensive applications on these devices, plus having access to a quick database such as sqlite makes life easier… now what should I do with it?

A Comparison Of .Net COBOL, Visual Basic and C#

Today my collegues Robert and Alex have finally :-) decided to publish a document that compares Visual Basic, C# and COBOL for .Net under The Creative Commons Attribution-ShareAlike 2.5 License.

Rather than doing a cut-paste job, here is a quote from alex, along with a link to the “real” article itself.

Enjoy.

Alex Turner said:

A Comparison Of .Net COBOL, Visual Basic and C#

Introduction

If you are a COBOL programmer wanting to learn C# or a VB programmer wanting to learn COBOL as a .net language (or any other combination of VB.net, C# and COBOL) then this is a good place to start.

Background

If you are a COBOL programmer wanting to learn C# or a VB programmer wanting to learn COBOL as a .net language (or any other combination of VB.net, C# and COBOL) then this is a good place to start.

It has often been noted that the richness of the COBOL language in its Micro Focus .net implementation is not well known. Robert Sales and I have worked on this document to help bring the language to peoples’ attention and to help people who need to work with COBOL on the .net platform.

Click here to continue reading the rest of the article…

Detecting the use Mono CLR dynamically

While developing something that could be used on Mono on Windows, Mono on Unix and on Windows with Microsoft’s CLR, I needed to be sensitive to the environment but didn’t want to conditionally compile my code different. So I put together a quick class to help.. Below is the C# code with pics of it running on Windows/Mac…


using System;
using System.Reflection;

namespace Gennard.Net
{
public class CLRUtils
{
private static readonly bool isMono= Type.GetType("Mono.Runtime") == null ? false : true;

private static readonly int eOSp = (int)Environment.OSVersion.Platform;
private static readonly bool isUnix = (eOSp == 4) || (eOSp == 128);

/* Class Properties */
public static bool IsMono { get { return isMono; } }
public static bool IsUnix { get { return isUnix; } }

public static void Main()
{
Console.WriteLine("Are we using Mono? : "+IsMono);
Console.WriteLine("Are we using Unix? : "+IsUnix);
}
}
}

The taste of the pudding mix.. is in the eating.. so lets see it working…

On Windows....

On the Mac, we get....

C# and reserved words

Have you ever wanted to create some real nasty code in C#… Well C# has a mechanism that allows a token to be used as a literal, thus avoiding the reserved word clash issues… For example;


int @int = 1;
@int = 2;

if (@int == 2)
{
@int = 3;
}

Just imagine the sort of rubbish code that could be create… remember because it is present you don’t have to use it!