0% found this document useful (0 votes)
6 views

C# Basic Fundamentals

Uploaded by

nehakausar1597
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

C# Basic Fundamentals

Uploaded by

nehakausar1597
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Channel Name: Programming with Mosh

Topics:
 C# vs .NET
 CLR (Common Language Run-time)
 Architecture of .NET Applications
 Our First C# Applications

1. C# FUNDAMENTALS
C# VS .NET
 C# is a programming language
 .NET is a framework for building applications on windows
 .NET framework is not limited to C#

There are different languages that can target C# and build applications using that framework
(examples are F sharp and vb.net)

__________________________________________________________________________________

.NET
 CLR (Common Language Runtime)
 Class Library

History of C#
 Before C# we had C/C++
 When we compiled our application, the compiler translated our code directly into the native
code for the machine on which it was running
 It would not run on different machine with different architecture & hardware
 So, while designing C# and .NET framework the developers borrowed a concept from JAVA
community
 In JAVA when you compile your code, it’s not translated directly into the machine code, it’s
translated into an intermediate language called “Bytecode”
 We have the exact same concept in C#, when we compile our C# code the result is what we
call IL Code or Intermediate language code, which is independent of the computer on which
it’s running
 Now we need something that would translate that IL Code into the native code of the
machine that is running the application and that is the job of CLR or Common Language
Runtime
Definition of CLR: It is essentially an application that is sitting in the memory
whose job is to translate the IL Code into the machine code and this process
is called “JUST-IN-TIME” compilation or “JIT”

2. C# FUNDAMENTALS
Architecture of .NET Applications
 At a very high level when we build an application with C# application consists of building
blocks called ”CLASSES”
 These classes collaborate with each other at runtime and as a result the application provides
some functionality

Class:

 Class consists of attribute also known as data and functions also know as methods
 Data represents the state of an application
 Methods execute codes, they do things for us
 For example, in a car the make, model and colour is it’s Data and the function that is start
and move is the method
 In an application there are 10, 100 and even 1000 of classes, each responsible of different
functionality
 An example of that is, classes that are responsible for getting the data from the user, process
the data and display something to the user
 As the number of classes grows, we need something to organise these classes, that’s where
we use a namespace

Namespace:

 Namespace is a container of related classes


 For example, in .Net framework we have namespaces each containing tens of related classes
 We have namespaces for working with data like databases, we also have namespaces for
working with graphics and images, we have namespaces for working with security
 In real world as the number of namespaces grows, we need a different way of partitioning
an application and that’s where we use an assembly

Assembly:

 An assembly is a container for related namespaces


 Physically it’s a file on the disk which can either be an executable or a DLL (dynamically
linked library)
 So when you compile an application the compiler builds one or more assemblies depending
on how you partition you code

You might also like