




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A comprehensive guide to c# programming fundamentals, covering essential concepts such as data types, control flow, arrays, classes, objects, inheritance, interfaces, file operations, and database connectivity. It includes detailed explanations, code examples, and practical illustrations to enhance understanding and facilitate learning.
Typology: Assignments
1 / 153
This page cannot be seen from the preview
Don't miss anything!
The .Net framework is a software development platform developed by Microsoft. The framework was meant to create applications, which would run on the Windows Platform. The first version of the .Net framework was released in the year 2000.
The version was called .Net framework 1.0. The .Net framework has come a long way since then, and the current version is 4.6.1.
The .Net framework can be used to create both - Form based and Web based applications. Web services can also be developed using the .Net framework.
The framework also supports various programming languages such as Visual Basic and C#. So developers can choose and select the language to develop the required application. In this chapter, you will learn some basics of the .Net framework.
The basic architecture of the .Net framework is as shown below.
The architecture of the .Net framework is based on the following key components; 1. Common Language Runtime - The “Common Language Infrastructure” or CLI is a platform on which the .Net programs are executed. The CLI has the following key features:
Exception Handling - Exceptions are errors which occur when the application is executed. Examples of exceptions are:
If an application tries to open a file on the local machine, but the file is not present. If the application tries to fetch some records from a database, but the connection to the database is not valid.
Garbage Collection - Garbage collection is the process of removing unwanted resources when they are no longer required. Examples of garbage collection are
A File handle which is no longer required. If the application has finished all operations on a file, then the file handle may no longer be required. The database connection is no longer required. If the
WinForms – This is used for developing Forms-based applications, which would run on an end user machine. Notepad is an example of a client-based application. ASP.Net – This is used for developing web based applications, which are made to run on any browser such as Internet Explorer, Chrome or Firefox.
The Web application would be processed on a server, which would have Internet Information Services Installed. Internet Information Services or IIS is a Microsoft component which is used to execute an ASP.net application. The result of the execution is then sent to the client machines, and the output is shown in the browser.
ADO.Net – This technology is used to develop applications to interact with Databases such as Oracle or Microsoft SQL Server.
Below is the table of .Net framework versions, which have been released with their release dates. Every version has relevant changes to the framework.
For example, in framework 3.5 and onwards a key framework called the Entity framework was released. This framework is used to change the approach in which the applications are developed while working with databases.
Version number CLR version Release date 1.0 1.0 2002-02- 1.1 1.1 2003-04- 2.0 2.0 2005-11- 3.0 2.0 2006-11- 3.5 2.0 2007-11- 4.0 4 2010-04- 4.5 4 2012-08- 4.5.1 4 2013-10- 4.5.2 4 2014-05- 4.6 4 2015-07- 4.6.1 4 2015-11-
The biggest advantage of the .Net framework is that it supports Windows platform. Almost everyone works with Windows machines. Microsoft always ensures that .Net frameworks are in compliance with all the supported Windows operating systems. The following design principles of the .Net framework is what makes it very relevant to create .Net based applications.
Microsoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs for Microsoft Windows. Visual Studio is one stop shop for all applications built on the .Net platform. One can develop, debug and run applications using Visual Studio.
Both Forms based and web based applications can be designed and developed using this IDE. The Visual Studio has the below- mentioned features
Let’s look at the installation of this IDE, so that we can work with creating programs in the subsequent chapters. Visual Studio can be downloaded from the following link - https://www.visualstudio.com/en us/downloads/download-visual-studio-vs.aspx
Once you have the Visual Studio Installer, you can install it using the below mentioned steps Step 1) The first steps involves choosing the location for the installation. In this step one also has to accept the License Terms and conditions.
Microsoft Foundation Classes for C++ Microsoft SQL Server Data Tools Microsoft Web Developer Tools
C# is one of the languages provided by Microsoft to work with .Net. This language encompasses a rich set of features, which allows developing different types of applications.
C# is an object-oriented programming language and resembles several aspects of the C++ Language. In this tutorial, we see how to develop our first application. This will be a basic console application, we will then explore different data types available in the C# language as well as the control flow statements.
A console application is an application that can be run in the command prompt in Windows. For any beginner on .Net, building a console application is ideally the first step to begin with.
In our example, we are going to use Visual Studio to create a console type project. Next, we are going to use the console application to display a message “Welcome to .Net”. We will then see how to build and run the console application.
Let’s follow the below-mentioned steps to get this example in place.
Step 1) The first step involves the creation of a new project in Visual Studio. For that, once the Visual Studio is launched, you need to choose the menu option New->Project.
If the above steps are followed, you will get the below output in Visual Studio. Output:
Step 3) Now let’s write our code which will be used to display the string “Welcome to .Net” in the console application. All the below code needs to be entered in the Program.cs file. The code will be used to write “Welcome to .Net” when the console application runs.
Code Explanation:
Code Explanation:
If the above code is entered properly and the program is executed successfully, following output will be displayed. From the output, you can clearly see that the Integer variable called num was displayed in the console
In our example, we will define a double variable called num. We will then assign a Double value to the variable and then display it accordingly.
Code Explanation:
The variable is then assigned a value of 30.33.
In our example, we will define a Boolean variable called ‘status.’ We will then assign a boolean value to the variable and then display it accordingly.
Code Explanation: