Introduction to C# Programming

C# Programming for existing C and C++ programmers.

© Guy Lecky-Thompson

CSharp Code, Guy W. Lecky-Thompson

For those who are mystified by C# programming, and what it seems to stand for, here is a rapid introductionary article to help evaluate this evolving technology.

Introduction

C#, or C Sharp, is a reasoanbly recent invention. Many programmers have only just come to accept that Java is reasoanbly stable and can be used for industrial banking applications, and here is Microsoft foisting another C++ look-alike on us. Is that all C# is, though?

There is more to C# programming than that, however, and it does play a fundamental part of the .NET strategy that Microsoft is following. Notice that we have mentioned Microsoft twice in as many paragraphs, which gives us the first clue : C# is a Windows thing.

What does C# Programming involve?

C# programming looks hauntingly familiar to anyone programming in C++, Java, or even Visual Basic, although that last one is a stretch. The point is that C# is an entirely object oriented, pointer-less self-contained (self-managed) programming language.

In other words, nothing exists in C# programming outside of namespaces, classes, members and methods. So, those familiar with 'pure' object orientation should embrace C# programming. For those moving from procedural programming in the C, BASIC, Modula-2 (or Pascal) vein - be prepared for some new concepts alongside familiar ones.

Before the use of the dreaded namespace keyword scares any would-be C# programmers off, it is used purely as a way to ensure that multipart projects created by teams of programmers can separate out similarly named classes. For example, if we have a class named stream, we might find a use for it as a socket stream, file stream, or console strem.

Using namespaces, and three teams of programmers, we would then be able to come up with Socket.Stream, File.Stream and Console.Stream without ever re-using the (now key) word Stream.

Why is C# Programming better than C++ (Java, C etc.)

Mainly because there are no pointers, or fiddly resource (i.e. memory) management and garbage collection. Also, C# programming relies so much on the use of distinct classes, that it puts the programmer clearly in the obejct oriented frame of mind, which is usually accepted as a good thing.

It is also something of a reworking of C++ and Java, taking the best bits of each and delivering a language that is familiar, but different. The code ends up slightly cleaner, and using it feels rather like the Modula-2 MODULE system, but with an even more object oriented bent.

What do I need for C# Programming

Luckily, Microsoft provide a free compiler. Unluckily for many people it compiles down to .NET bytecode, rather than native binary. However, Borland also have a free C# compiler, which comes complete with an IDE and builds native binaries.

The following link contains a list of currently available C# compilers:

www.thefreecountry.com/compilers/csharp.shtml

Just bear in mind that if the Microsoft compiler is used, the end user has to ve .NET installed, and needs to frolick around in the registry somewhat in order to get it working. However, for those just getting started, it provides a low-barrier-to-entry solution for C# programming.

Why would I bother with C# Programming

So, what would the casual programmer get out of C# programming? In reality, it will prove easiest to learn of all the 'modern' languages. It would make a great teaching language if not for the heavy influences of C making it a little hard to read at first glance. However, it promotes better organisation of code, coupled with reuse, and as such is a great place to start.

For seasoned programmers, it provdes a glimpse of the future. Rather like asking, 10 years ago, why anyone would bother with Java, asking why C# programming is worth the time investment probably isn't the right question. Given Microsoft's influance in the marketplace, the question is probably - can anyone really avoid C# programming?


The copyright of the article Introduction to C# Programming in Computer Programming is owned by Guy Lecky-Thompson. Permission to republish Introduction to C# Programming must be granted by the author in writing.




Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo




Here's the follow-up discussion on this article: View all related messages

2.   Apr 12, 2007 12:30 AM Reply
In response to Microsoft? posted by mmphosis:


Some great points : and I'm all for using appropriate language ...

-- posted by LeckyT


1.   Apr 5, 2007 12:27 PM Reply

Rollback to the 1980's, and your statement might sound like this...

Given IBM's influence in the marketplace, the question is probably - can anyone really avoid COBOL programming?

Sure, IBM an ...

-- posted by mmphosis



Post to this discussion


For a complete listing of article comments, questions, and other discussions related to Guy Lecky-Thompson's Computer Programming topic, please visit the Discussions page.