Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Programming in C#: Exam 70-483 (MCSD) Guide

You're reading from   Programming in C#: Exam 70-483 (MCSD) Guide Learn basic to advanced concepts of C#, including C# 8, to pass Microsoft MCSD 70-483 exam

Arrow left icon
Product type Paperback
Published in Oct 2019
Publisher Packt
ISBN-13 9781789536577
Length 444 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
SrinivasMadhav Gorthi SrinivasMadhav Gorthi
Author Profile Icon SrinivasMadhav Gorthi
SrinivasMadhav Gorthi
Simaranjit Singh Bhalla Simaranjit Singh Bhalla
Author Profile Icon Simaranjit Singh Bhalla
Simaranjit Singh Bhalla
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Learning the Basics of C# FREE CHAPTER 2. Understanding Classes, Structures, and Interfaces 3. Understanding Object-Oriented Programming 4. Implementing Program Flow 5. Creating and Implementing Events and Callbacks 6. Managing and Implementing Multithreading 7. Implementing Exception Handling 8. Creating and Using Types in C# 9. Managing the Object Life Cycle 10. Find, Execute, and Create Types at Runtime Using Reflection 11. Validating Application Input 12. Performing Symmetric and Asymmetric Encryption 13. Managing Assemblies and Debugging Applications 14. Performing I/O Operations 15. Using LINQ Queries 16. Serialization, Deserialization, and Collections 17. Mock Test 1
18. Mock Test 2
19. Mock Test 3
20. Assessments 21. Other Books You May Enjoy

.NET Framework

.NET Framework is a software development framework on which we can write a number of languages such as C#, ASP.NET, C++, Python, Visual Basic, and F#.

Microsoft released the first version of .NET 1.0 in 2002. The current version of .NET Framework is 4.8. The code written in this book will be based on this version of .NET Framework 4.7.2.

.NET Framework provides language interoperability across different programming languages. Applications written in .NET Framework execute in an environment or a virtual machine component known as CLR.

The following diagram illustrates the different components in .NET Framework:

In the previous diagram, note the following:

  • At the top of the hierarchy, we have applications or the program code that we write in .NET. It could be as simple as a Hello World console application program, which we will create in this chapter, or as complex as writing multi-threaded applications.
  • The applications are based upon a set of classes or design templates, which constitutes a class library.
  • The code written in these applications is then acted upon by CLR, which makes use of the Just in Time (JIT) compiler to convert the application code into machine code.
  • The machine code is specific to the underlying platform properties. So, for different systems, such as Linux or Windows, it will be different.
For further information on .NET Framework, please refer to the official docs from Microsoft: https://docs.microsoft.com/en-us/dotnet/framework/get-started/overview.

In the next section, we will the .NET Framework in detail learn how interact with each other.

Languages/applications

Languages indicate the different types of applications that can be built in .NET Framework. If you are new to .NET Framework, you may not be familiar with some of the applications listed here:

  • ADO.NET: In an ADO.NET application, we write programs to access data from sources such as SQL Server, OLE DB, and XML sources.
  • ASP.NET: In an ASP.NET application, we write programs to build web apps such as websites and services using C#, HTML, CSS, and so on.
  • CORE: In .NET Core applications, we write programs that support cross-platform functionality. The programs could be web apps, console applications, or libraries.
  • Windows Forms: In Windows Forms applications, we write programs that provide client-side applications for desktops, tablets, and mobile devices.
  • WPF: In WPF or Windows Presentation Foundation, we write programs that provide user interfaces in Windows-based applications. It runs only on Windows-supported platforms, such as Windows 10, Windows Server 2019, and Windows Vista.
  • WCF: In WCF or Windows Communication Foundation, we write programs that provide a set of APIs, or in simpler terms, services, to exchange data between two distinct systems.
  • LINQ: In LINQ, we write programs that provide data querying capabilities on .NET applications.
  • Parallel FX: In Parallel FX, we write programs that support parallel programming. It involves writing programs that utilize the CPU's capabilities to the fullest by executing several threads in parallel to complete a task.

The class library

The class library in .NET Framework consists of a collection of interfaces, classes, and value types on which the applications are built.

These collections are organized in different containers known as namespaces. They are a set of standard class libraries that can be used for different purposes in an application. Here are some of the namespaces:

  • Microsoft.Sharp: This contains a type that supports compilation and code generation for C# source code, and the type that supports conversion between Dynamic Language Runtime and C#.
  • Microsoft.Jscript: This contains classes that support compilation and code generation using JavaScript.
  • Microsoft.VisualBasic: This contains classes that support compilation and code generation for Visual Basic.
  • Microsoft.VisualC: This contains classes that support compilation and code generation for Visual C++.

Common Language Runtime (CLR)

CLR is a runtime environment that sits in the memory of the underlying machine and converts the IL code to native code. The native code is specific to the underlying platform in which the code is running. This provides a platform independence feature in a typical application made on .NET Framework. Some of the other features provided by CLR are mentioned here:

  • Memory management: CLR provides automatic allocation and release of memory across the application. Due to this, developers do not need to explicitly write code to manage memory. This eliminates issues that can lead to degradation of application performance due to memory leaks. CLR manages the allocation and removal of memory using a garbage collector, which manages the memory allocation in the following manner:
    • Allocating memory: When an application is executed in CLR, it reserves a continuous space of memory for its execution. The reserved space is known as a managed heap. The heap maintains a pointer to the memory address where the next object defined in the process will be allocated.
    • Releasing memory: During the runtime execution of the program, the garbage collector runs at scheduled times and examines whether the memory allocated in heaps are still in scope of program execution or not.
    • It determines whether the program is still using the memory on the basis of roots or the collection of memory objects are still in the scope of the program. If any memory allocation is not reachable as per the collection in the root, the garbage collector determines that the memory allocated in that memory space can be released.
    • We will look into memory management in detail in Chapter 9, Manage the Object Life Cycle.
  • Exception handling: When an application is being executed, it may result in certain execution paths that could generate some errors in the application. Some of the common examples are as follows:
    • When an application tries to access an object such as a file that is not present in the specified directory path.
    • When an application tries to execute a query on the database but the connection between the application and the underlying database is broken/not open.
    • We will look into exception handling in detail when we go through Chapter 7, Implementing Exception Handling.

In the next section, we will look at the release history of .NET Framework and its compatibility with different versions of CLR and C#.

You have been reading a chapter from
Programming in C#: Exam 70-483 (MCSD) Guide
Published in: Oct 2019
Publisher: Packt
ISBN-13: 9781789536577
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image