Everything you need to know to get started with C#

C# was developed with the aim of creating a language that suited just about every development need.

By Mehakinder Oberoi Published Date
05 - Jan - 2016
| Last Updated
06 - Jan - 2016
Everything you need to know to get started with C#


When languages such as Java and C++ already existed, was C# really needed? Some say it was only developed by Microsoft to take on Sun’s Java? 
C# was developed by Andres Hejlsberg and his team at Microsoft. In one of his papers, Hejlsberg  commented that most programming languages had flaws. This led him to develop CLR (Common Language Runtime) – which is an environment that promotes the conversion of compiled byte code directly to machine instructions for a CPU to execute (that’s execute as in run, not execute as in hang unto death) – and later led to the to the creation of C#. 

C# and Java
C# was released in the year 2000, and was quite similar to Java in functionality. Though Andres Hejlsberg always said C# shared more similarities with C++ than Java, James Gosling (the father of Java) and Bill Joy (Sun founder) labeled C# an “imitation of Java”. Some went as far as saying that both were just “boring repetitions of each other.”

Learn C# tutorials
CLR in use

Why C#
Originally, the language was named ‘COOL’, which was, well, not so cool.  COOL stood for ‘C-like Object Oriented Language’. However, it was later renamed C# (pronounced ‘C sharp’), which is a musical note that is a  semi-tone higher than the ‘C’ note. Thus, C# is a higher version of C. 

What’s So Sharp About C#

C# is one of the most popular languages today and there are many reasons for this. It has many qualities that make it suitable for development for users at almost all levels. Fifteen years after its advent and following the release of many new versions, C# today has a whole slew of features which make it unique and its use inevitable. Let’s discuss some of them here. 

COM (Component Object Model)
COM, or Component Object Model, provides C# with capabilities such as platform independence and integration of objects, which need not be in the same development environment or even on the same computer. COM along with the DotNet framework promote interoperability. Versioning helps in easy deployment, while support for web-based integration is provided by XML. 

Dynamic binding 
C# is a strongly typed language, which illustrates the fact that all the variables are resolved at compile time. But then the question arises: How does C# simplify access to Document Object Model (DOM) or COM API’s? Dynamic Binding does this for C#. Dynamic Binding delays the process of resolving variables from compile time to runtime. 

Scalability allows C# to be suitable for handling enterprise applications and projects on a large scale. MVC’s based on DotNet are used to design web constructs that are scalable and updatable as well as to establish the assembly version, digital signature, identity, culture, etc. Updation is useful when you need to delete or update old files to scale your application. 
Other features include robustness, which can be attributed to Garbage collection and type safety attributes provided by C#. Security in C# is assured through intrinsic code trust mechanisms. Also, the replacement of pointers (as in C++) by automatic memory management adds to this feature.


Hello World 
This is the way Hello World is programmed in C#.
using System;
class Hello{
 static void main() {                           
 Console.WriteLine(“Hello World”);   }

C# is a good language to start with for the novice programmer, but you’ll need to get some experience with Object-oriented programming before exploring C#. This is why people usually get to C# only after learning C++, or other OOP languages. 
Now, back to the program listed above, class name doesn’t need to be similar to the file name (a feature observed in Java). The output is written on the console and ‘main’ is accompanied by a ‘static’ keyword.

Windows and C# 

While developing software, the most important factor for choosing a language is the environment in which it will be working.
Probably one of the major reasons for the success of C# is the fact that it’s the best suited language for Windows servers, Windows clients and now even Windows phone applications. The reason is obvious: its development is being overseen by Microsoft. 

Learning C#

Some benefits of learning C#:

  • Promotes easy learning of IIS for server programming
  • Promotes easy deployment of applications made in C# in a Windows centered environment.
  • Is best suited for working in DotNet framework and with its API’s. 
  • Provides the best graphical user interface along with Windows Presentation Foundation and Winforms.
  • Thus, Windows being the most widely used operating system further encourages programming in C#.

Where’s C# used? 

C# is used across many applications. Let’s look at the scope of the language in the industry today.

  • Game Engines: One of the most popular uses of C# has been its contribution in the development of the game engine Unity. It’s currently one of the market leaders, and is used to develop  games for a wide range of devices – desktops and mobile devices to consoles and websites.
  • Cross Application/Platform Development: The interoperability discussed earlier facilitates the growth of applications across various platforms and even across different applications, which can  later be integrated as one application for use by an enterprise.
  • Client Applications: One of the primary uses of C# is development of client applications such as chat or email. 
  • Backend Service: C# is used for programming at the backend in a variety of applications. The combination of XAML and C# is quite famous in the industry for designing mobile apps. 

Learn C# tutorials
Gloria Victis: A game developed on Unity 

  • Components and Controls: The main functionality of the components and controls is their reusability as code. They can also be included as libraries to build something that’s sharable. Examples of this are built-in tools in a game engine or GPS libraries used for building navigation systems. The developers can further use these components as API’s, saving time and making it easy to code.
  • Multiplatform application (mobiles): The word “multiplatform” has been intentionally used here. C# is no longer limited to Windows Phone applications and has infact extended its reach to the IOS and Android markets too with the help of Xamarin Studio. 
  • Web Applications: JavaScript along with C# (in the DotNet framework) is one of the most widely used combinations to create web applications. http://bit.ly/1JzYqvvSee here for more about the web development side of C#.
  • Cloud Computing: One often hears that Cloud Computing is the future of Computer Science. Infact, it’s one of the fields that hasn’t reached its full potential yet.  Cloud-based applications can be easily designed with C# (Visual Studio toolkit).

Tools and Learning Resources

As discussed before, the support by Windows gives C# one of the best programming environments available for it –  there are numerous IDE’s available. The most suitable development environment is undoubtedly Visual Studio because of the toolkits it provides and the ease of design and deployment one experiences with it. But, apart from Visual Studio there are several other IDE’s such as SharpDevelop, MonoDevelop, xacc, cSharpStudio, QuickSharp and Fireball. CodeEditor available for C#. We’ll briefly discuss some of them.

Learn C# tutorials
C# is used in mobile application development

‘Sharpdevelop’ is an open source IDE for C#. ‘MonoDevelop’ aims at developing support for C# in the Linux environment and aims at introducing all the features currently present in Windows in Linux too. ‘xacc’ is mainly used because of its debugging support as well as its support of various languages (27 of them). 
There is a tremendous amount of online resources for anyone from beginners to advanced coders to learn C#. There are MOOC’s such as ‘Game Programming with C#’ (Coursera) available, and also websites such as redhoop.com or noexcuselist.com that can help you stay updated with various MOOC’s available and pick from the best of them. 

Websites such as ‘pragimtech’ and many others keep posting well-crafted videos on their YouTube channels, so make sure to check those out. 
Book worms should start with this list::
Component-based Development with Visual C#  (M&T books) − Ted Faison
C# Essentials, 2nd edition (O’Reilly) − Ben Albahari, Peter Drayton & Brad Merrill
A Programmer’s Introduction to C#, 2nd edition − Eric Gunnerson 
Inside C#, 2nd edition (Microsoft Press) − Tom Archer
C# in Depth − Jon Skeet

Learn C# tutorials
That’s the way development on Visual Studio happens.

Given the wide expanse of the language, we suggest you build certain projects, or at least go through these links for some knowledge on how to get started with them. 
W3schools introduces the web development side of DotNet framework to you. Going through it would provide you with an idea regarding website building with the help of C#. 
Apart from this, we recommend actually implementing, maybe, a small website just to get your feet wet with C#. 
Code project has numerous projects available covering almost all the fields of C#. Going through them would make you aware of the expanse of C#. You can pick any of them and start working on it to try your hand at C#. 

For tutorials on 15 other hot programming languages go here.