What is C#?
- Introduction to Programming
- What is C#?
- Your First Console Application in C#
- Introducing Methods and the Main() Function in C#
- Introducing C# Classes and Structs
- C# Data Types, Variables and Casting
- C# Program Flow Control and Entry Points
- Passing Parameters to Methods and Return Values in C#
- C# Access Modifiers and Scope
- C# Interfaces and Classes
- Using Namespaces in C#
- C# Conditional Statements
- Looping and Iteration in C#
- Using Arrays and Lists in C#
- C# Constants and Read-Only Variables
- Error and Exception Handling in C#
- Using Recursion in C#
- C# Operator List
- Class Inheritance in C#
- C# Class and Method Attributes Explained
- C# Class Constructors and Destructors
- C# Generics Variables
- XML Serialization and Deserialization
- C# String Formatting Examples
C# is a strongly typed language meaning that every variable must be declared with a data type and initialized prior to use. Once a variable has been defined, it cannot be redefined within its scope. For example, if you define a variable to hold a number, you cannot make it hold text later on. We will cover variables and data types shortly.
C# is an extension of C++ and while it retails a similar syntax and layout, it is also vastly different. C# takes the best parts of several programming languages and merges them together. It also adds a host of new features to make C# one of the most powerful languages around at the moment.
C# is a managed language which means that it is not compiled directly into machine code, but rather into an intermediate language which is executed within the common language runtime. We'll see more about this later.
What this means for new programmers
C# is easier to learn and work with for somebody new to programming. The language, Visual Studio and the .Net platform makes it more difficult to make critical errors such as memory leaks and null references. C# syntax is much easier to understand than similar C++ which means that non-programmers can pick it up easier.
What this means for existing programmers
If you are migrating from Delphi/Pascal you will see some obvious similarity between the languages and it should be fairly similar from the start. It was for me. If you are migrating from C++ or Java, again it should be familiar. This is because C# is based on C++, Java and Delphi.
One of the most important concepts to understand is that there are no global variables or functions in C#. All methods and members must be declared within classes, however, you can use static members of public classes can substitute for global variables and functions.
In the next tutorial in this series, we will look at the nitty gritty of C# and start doing some programming work.