The ramblings of a yorkshire tyke

Life, Rants and Programming In A Blog

Browsing Posts in CSharp

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…

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....

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!

Powered by WordPress Web Design by SRS Solutions © 2010 The ramblings of a yorkshire tyke Design by SRS Solutions
AWSOM Powered