We have started a project, and its 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 the European Computer Manufacturers Association (ECMA) and International Standards Organization (ISO). Anders Hejlsberg and his team developed it during the development of the .Net Framework.
C# is designed for Common Language Infrastructure (CLI). Which consists of the executable code and runtime environment that allows the 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 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 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 a strong resemblance to Java; it has numerous robust programming features that make it endearing to several 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; which also has a community edition which is free and 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.
C# is an object-oriented programming language. In Object-Oriented Programming methodology, a program consists of various objects that interact with each other using 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 primary 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 for explaining code. Compilers ignore the comment entries. The multiline comments in C# programs start with /* and terminate with the characters */ as shown below −
For single-line comments use 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.