Welcome to the world of C# programming. C# is beginner friendly which makes it an excellent language to start with if you are interested in learning to program. There is also a high demand for C# developers and opportunities for career growth.
Let’s begin by having a closer look at C# and XAML before going step by step through how to write your first C# program.
What is C#?
C# (C-Sharp) is a general purpose, powerful, object-oriented programming language that is structured and easy to learn. It was developed by Microsoft in 2000 and runs on the .NET Framework and can be compiled on a variety of computer platforms. C# is one of the most widely used programming languages in the world and is used to develop web apps, desktop apps, mobile apps and games etc.
It has roots from the C family and has similarities to languages like C++ and Java. It was designed to be a more modern version of C/C++ and is based on the syntax of C++ but has some differences. Systems developed in C/C++ could be translated and modernised with C#.
Here is an example of what a C# program looks like:
A C# program has the following:
• Programs: declare types, which contain members and can be organised into namespaces.
• Namespace: this is a collection of classes.
• Class: this is how objects are defined. A class is a data structure that combines fields and methods in a single unit. A class provides definitions for instances of the class, also know as objects.
• Class methods: this is code that identifies an objects behaviour.
• Class attributes: a descriptive characteristic of the class.
• Main Method: the entry point for the class.
• Statements and expressions
• Comments: text that is not part of the program. Used to explain what the code does.
References:
Get Started with C# ([w3schools.com](file:///C:/Users/louis/AppData/Local/Temp/msohtmlclip1/01/clip_filelist.xml))
A tour of C# - Overview - C# | Microsoft Learn
C# | Modern, open-source programming language for .NET ([microsoft.com](file:///C:/Users/louis/AppData/Local/Temp/msohtmlclip1/01/clip_filelist.xml))