C# Programming For Beginners & Intermediates
C# Made Easy Step By Step
With Hands-on Projects
Craig Berg
Your Gift
Let me help you master this and other programming languages quickly.
Visit
https://bit.ly/codetutorials
To Find Out More
Introduction
PS: Id like your feedback. If you are happy with this book, please leave a review on Amazon.
Please leave a review for this book on Amazon by visiting the page below:
https://amzn.to/2VMR5qr
Table of Contents
Introduction to C# Programming & The .Net Framework
C#, pronounced as c-sharp or see-sharp, is a high-level, robust, and modern programming language. C# is also a simple object-oriented programming language that exists within the .NET family of programming languages. It was developed by Microsoft under the .NET initiative led by Anders Hejlsberg, author of Turbo Pascal and Delphi, both of which are famous programming languages in their own right.
Like most programming languages, C# came about as an improvement over other programming languages, especially the ones that had come before it, such as C++, C, and the Java programming language. Because of this, C# may have a syntax that seems familiar to that of C, C++, and the Java programming language with a slight difference in certain cases.
C# allows developers to create secure and robust applications for desktop, mobile, server, embedded systems, and web. In this book, we are going to cover the major concepts of the C# programming language in detail, and in a way that will help you understand C# in a unique and easy way so that as you continue your learning journey, you can understand deeper aspects of the language.
NOTE: This book is very beginners and intermediates friendly. As such, we may mention but not explain advanced topics of the C# language such as Generics, Delegates, Events, Lambda Expressions, LINQ, Nullable Types, Dynamics, and Asynchronous Programming. As you master the beginner and intermediate aspects of C#, make sure you seek out knowledge on the advanced topic mentioned above and others, and that you challenge yourself to learn as much about the language as possible.
Introduction to the .NET Framework
We have noted that C# is a programming language within the .NET family. If you are new to C# programming, you may be wondering, what exactly is the.NET family and what does it entail?
.NET is a very famous development platform mainly well known to Windows desktop application developers, video game and back-end web developers. Simplified, .NET, pronounced as dot net, is a cross-platform and open-source developer platform used to develop robust applications for desktop use across multiple operating systems.
It encapsulates the development of applications ranging from desktop applications, web applications, mobile applications, and as mentioned, C# is very popular in the gaming developer community.
Languages under the .NET initiative include C#, F#, Visual Basic, and ASP.NET. Each of these languages are similar in the sense that each made improvement to the other, and each finds use in the creation of applications in different fields.
The .NET family of languages is also very popular because of its wide range of predefined class libraries that support both simple and complex programs, data structures for various applications such as databases, security, encryption, artificial intelligence, and more.
The .NET libraries are under the maintenance of the NuGet package manager that allows for the installation and update of these packages. Summarized, the .NET framework is a very advanced ecosystem of various programming languages that we cannot discuss here individually because C# is the primary focus of this guidebook.
Core Features of the C# Programming Language
Even though we now have many programming languages, C# has managed to relevant. This is because of a few reasons, key of which is the core features and functionalities of C#.
Let us discuss some of the core features that make C# a great programming language compared to other programming languages with similar applications.
It is a high-level programming language
It is modern and general-purpose
It is very easy to learn
It is part of the .NET framework
Easy to use Generics
It creates very secure and efficient programs
It is cross platform
Assembly Versioning
Indexers
It is designed for CLI Common Language Infrastructure
Automatic and Efficient Garbage Collection
Delegation and Event Management
Now that you know what C# is and its many advantages over other programming languages used for similar development application, let us discuss how to set up your C# learning and working environment the right way.
Table of Content
Section 1
Setup and Installation
In this section, we are going to look at how to setup C# on your computer and start creating C# programs. Before we begin this environment installation, you need to meet a few requirements necessary for running the C# Integrated Development Environment (IDE). For compatibility issues and efficient execution of the programs, ensure that your computer meets the following requirements:
A 1.8Ghz and higher Processor Preferably a 64-bit processor
Windows 7 Service Pack 1 and higher
4GB of RAM and above (6GB for better performance)
Minimum Disk Space of at least 8GB to 210 GB depending on the features you want to be installed
Microsoft .NET Framework 4.5 and higher
For the initial setup, you need a relatively good internet speed.
These basic requirements can determine whether C# will run smoothly on your System or not. If you have the above requirements, we can begin.
How to install the .NET Framework
The very first action we are going to conduct is that of installing .NET Framework 4.5 and higher. In this book, we are going to use version 4.7.
To download the .NET framework, follow this link:
https://www.microsoft.com/en-us/download/details.aspx?id=55167
To begin the download, select your preferred language and click download. Once the download has completed, start the executable and begin the installation.
NOTE: If you are running updated versions of Microsoft Windows 8.1 and above, you may have .NET already installed and you can go ahead and cancel the installation. If case it is not, complete the installation.
Installing the IDE (C#)
Here, we are going to cover the installation of the C# IDE that contains a text editor and C# compiler binaries. We are going to use the Microsoft Visual Studio (MVS) as the IDE.
You can use a variety of MVS-environment alternatives such as Jetbrains, Rider, and Mono IDE but some of these may require a subscription, which is why this book does not cover these installations.
Microsoft Visual Studio runs on Windows and Mac only (as of 2019). If you are a Linux user, you can download the Mono IDE, which is a very great alternative.
To download the visual studio installer, go to the following addresses for Mac and Windows users respectively
https://visualstudio.microsoft.com/vs/mac/
https://visualstudio.microsoft.com/vs/
Download the free, Community Edition. In case of added features or commercial usage, you can purchase the Enterprise or Professional editions.
Once you get the installer, launch it, and wait until the initial setup completes and the visual studio installer launches.