2. Intro …
In this course, I will provide you with the tools you need to start
building applications with .NET.
By starting with popular hello world application we will start
with language fundamentals.
We will investigate the .net frame work , and learning the
working with object and object oriented techniques ..
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
3. Intro …
.NET Framework provide number of classes, we will
investigate number of them
We will focus on data structure and a lot of .NET features.
I will give you the a ability to write code more flexible,
handling exceptions, and use delegates and events.
When you done you will build your windows and web
applications.
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
4. So lets get start
”The Big day has finally come“
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
5. :Module I
Introduction to .NET framework
Introduction to Visual Studio
Debugging
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
6. …Details.…
We will look what is the .NET
Why we learning it
The history of .NET Framework
That’s all important to understand before start and building
your application
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
7. ?What is the .NET,anyway
1991: windows sits on the top of “DOS”
Widows app require windows environment to be run.
Windows app provide API ( application programming interface)
for communication with devices , drivers and so on .
2001:.NET runtime sits on the top of “Windows”
.NET app require .NET runtime environment to be run.
.NET provide API for working with windows, data types, and
more.
.NET runtime it is like windows over windows
.NET provide environment the handling data types, memory
managements, APIs, and much more
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
8. ?What is the .NET, anyway
We will work with .NET framework 2.0 : it is the third version of the
brains behind platform (1.0-1.1-2.0)
It is object oriented programming environment.
Can create command-line apps ,web application using the tools which
provided by the .NET framework.
.NET is open
You can program in many different languages
Can use different tools .
Not limited to VB / C#
.NET SDK ( software development kit ) is download free
• So you don't need to buy visual studio, and can use commandline but visual studio is more productive
• When you setup the visual studio it setup automatic .NET SDK.
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
9. ?Why .NET
Before .NET, software development required mastery of
multiply techniques
Mainly stitched together various programming tools.
For example
Web sits ? Require VB scripts or J scripts and html.
Database apps ? Require SQL / SQL server
Business app ? Require VB
Office applications ? Require VBA scripts
Streamlined Graphics ? Require C++
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
10. Advantage of .NET
.NET provide
Object-oriented view of windows
• .NET framework encapsulate a lot of functionality into classes
Application security is built-in
• no need to build your own authentication or authorization tools
Deploying applications is easier
• Units of deploying are now in containers called assembles so you can
deploying them without need to install any other extensions to use it
Versioning issues largely handled without effort
Assemblies can be digitally signed
• So you can know who deploying them to be able to trust this assembles
All .NET languages are interoperable
• That’s mean you can write apiece of code in c# and other in VB or
any .NET language you want
• So it lead us to the concepts of .NET frame work architecture
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
12. Common Language Runtime
Common language runtime ( CLR ) provides runtime
environment for all .NET applications.
CLR’s purpose is to load and run applications
compiled to intermediate language ( IL ).
Each .NET compiler create IL as it’s output.
CLR manage .NET base services:
Memory managements
Garbage collection
Exception handling
Loading/running applications
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
13. CLR and Running Code
CLR allow you to run managed and unmanaged code
Unmanaged code run out side CLR
• As programming before .NET like C++ and VB6 they
compile without .NET
Managed code run “ within “ CLR , and benefits of all CLR
features
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
14. CLR and Compilers
.NET compilers create .NET intermediate language (MSIL) as
output
At execution time , just-in-time (JIT) Compiler convert code to
native executable
Native code : respond to native object file which produce for
each CPU architecture and linked for producing executable
file
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
15. More about JIT
JIT compiler take native processor into account
Create code optimized for the local environment .
Make decision how to optimize code at runtime
Which mean you can create the code on Pentium 3
processor, And compile it on Pentium 4 Processor the
compiling files will be change for the corresponding
processor architecture to be better.
Only need to compile application once
Compiled bits are cached once.
Performance overhead is very slight
Remember :
.NET runtime / CLR must be installed on client computers in
order to run .NET code
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
16. NET framework base class library.
BCL consists of classes that provide base functionality for .NET framework
And many classes which make your life as developer easier
Library of class used by all .NET application
If you want to be more experience developer you must know which
classes in the base class library which will make your development
easier through the .NET documentations
Contains a large number of classes (it can be described as blocks of
functionality, have properties which describe the class , methods are the
operations which class do, events which can call notifications) grouped in
namespaces
Each class within the namespace has a unique name
BCL’s namespaces group classes into common blocks of functionality
All classes work with files in namespace
All classes work xml in namespace
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
17. Some BCL namespaces
System
Define data types, Memory management, garbage collection,
and a lot…
System.Data
. Is represent the hierarchal representation of namespaces
Define the data as SQL server, OLDB , OLDC ,and a lot …
System.Diagnostic
Define the trace operation , performance recording , and a lot ..
System.IO
System.Web
System.Windows.Forms
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
18. NET languages.
Microsoft provide several .NET languages:
VB, C# , C++ ,and Jscript
Other vendor provide other languages
• Python, Fortran , Cobol, and many more
How do languages interoperate?
.NET provide :
• Common language specification ( CLS ) : describe how
.NET language should work.
• Common Type systems ( CTS ): describe how data types
should work together
In the end all .NET language compile to IL
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
19. Examining a .NET application :
Introducing assemblies
When you compile managed code your create assembly
Theoretically assembly can contain multiply modules
VS only supports creating single module assemblies
Output looks like EXE or DLL
Actually contains compiled IL, and information about the
assembly which called Metadata which also contains
manifest and other assembles it requires
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
20. ?What is in the manifest
Version, name , and security requirement.
List of files in assembly and cryptographic hash for each file
List of public types
List of external required references
We use the ILDASM.EXE (intermediate language disassembly)
where come with .NET framework to examine the content of
assembly file
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
21. ?What can you create
.NET allow you to create a large range of
applications
VS includes templates for ( among other ):
Windows application
Console application
Web application
Class library
Windows control library
Web control library
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
22. Let’s try
1- cmd -> csc
2- vs cmd ->csc
3-notepad ->helloworld->compil and run
4-comments and dividing code
5- namespace
6-ildasm -> manifest
7-ildasm -> code
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca
23. The End of Part I
Eng. Mohamed Atia
Eng.Mohamed@hotmail.ca