We have started a project and it’s purpose is to get everyone to learn C# and understand it as better as they can and this is going to be free on this website. We will take this process slowly however so expect every Monday to be the day you get the post about this journey. Feel free to drop suggestions at the comment section and or questions too.
C# is a modern, general-purpose, object-oriented programming language developed by Microsoft and approved by European Computer Manufacturers Association (ECMA) and International Standards Organization (ISO). It was developed by Anders Hejlsberg and his team during the development of .Net Framework.
C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows use of various high-level languages on different computer platforms and architectures.
The .Net Framework
C# is part of the .Net Framework and is used for writing .Net applications.
The .Net framework is a revolutionary platform that helps you to write Windows Applications, Web Applications and Web Services. The .Net framework applications are multi-platform applications. The framework has been designed in such a way that it can be used from any of the following languages: C#, C++, Visual Basic, Jscript, COBOL, etc. All these languages can access the framework as well as communicate with each other.
The .Net framework consists of an enormous library of codes used by the client languages such as C#. Here are a few :
- Common Language Runtime (CLR)
- The .Net Framework Class Library
- Common Language Specification
- Common Type System
- Metadata and Assemblies
- Windows Forms
- ASP.Net and ASP.Net AJAX
- Windows Workflow Foundation (WF)
- Windows Presentation Foundation
- Windows Communication Foundation (WCF)
Strong Programming Features of C#
Although C# constructs closely follow traditional high-level languages, C and C++ and being an object-oriented programming language. It has strong resemblance with Java, it has numerous strong programming features that make it endearing to a number of programmers worldwide.
- Boolean Conditions
- Automatic Garbage Collection
- Standard Library
- Assembly Versioning
- Properties and Events
- Delegates and Events Management
- Easy-to-use Generics
- Conditional Compilation
- Simple Multithreading
- LINQ and Lambda Expressions
- Integration with Windows
You can develop in C# using Visual Studio by Microsoft, it also has a community edition which is free and also very powerful. Using the tools provided by Visual Studio, you can write all kinds of C# programs from simple command-line applications to more complex applications. I personally have published my first application to the market which was build on C#.
C# is an object-oriented programming language. In Object-Oriented Programming methodology, a program consists of various objects that interact with each other by means of actions. The actions that an object may take are called methods. Objects of the same kind are said to have the same type or, are said to be in the same class.
Classes contain the data and the method definitions that the program uses. Be careful there is only one Main method per Class.
Methods define the behavior of the Class.
static void Main() – defines the main method, which is the entry point to all programs in C#.
The using Keyword
The using keyword is used for including the namespace in the program. A program can include multiple using statements.
Comments in C#
Comments are used for explaining code. Compilers ignore the comment entries. The multiline comments in C# programs start with /* and terminates with the characters */ as shown below −
Single-line comments are indicated by the ‘//’ symbol.
The value types directly contain data. Some examples are int, char, and float, which stores numbers, alphabets, and floating point numbers, respectively. When you declare an int type, the system allocates memory to store the value.
That’s a wrap about a general introduction of C# programming language. Follows us next week as we will continue our learning experience together.