Professional Documents
Culture Documents
NET Framework
Agenda
What is the .NET framework?
An overview of the CLR the .NET virtual machine
A comparison between the CLR and the JVM
A brief intro to C#
Hello World!
Page 2
Command Line
GUI
A software platform
.NET Framework
Language neutral
Operating System +
Hardware
Page 3
Page 4
C++
C#
J#
ASP .NET
Web Forms Web Services
Mobile Internet Toolkit
Operating System
ASP.NET
High-productivity environment
for building and running
Web services
Page 5
VB
C++
C#
J#
ASP .NET
Web Forms Web Services
Mobile Internet Toolkit
One Language
Page 7
http://msdn.microsoft.com/en-us/library/zcx1eb1e(v=vs.110).aspx
Is Extensible
Is Secure
Page 8
Common Classes
.NET Framework Class Library
System.Web
Services
Description
Discovery
Protocols
System.Windows.Forms
UI
HtmlControls
Design
ComponentModel
WebControls
System.Drawing
Caching
Security
Drawing2D
Printing
Configuration
SessionState
Imaging
Text
System.Data
System.Xml
OleDb
SqlClient
XSLT
Common
SQLTypes
XPath
Serialization
System
Collections
IO
Security
Configuration
Net
ServiceProcess
Diagnostics
Reflection
Text
Remoting
Globalization
Resources
Threading
Serialization
Page 9
Runtime
InteropServices
Lifecycle
Compilation and Execution
Compilation
Source
Code
Language
Compiler
Native
Code
JIT
Compiler
Execution
Page 10
Code (IL)
Assembly
Metadata
At installation or the
first time each method
is called
Assemblies
ManagedModule
Module
Managed
(MSILand
andMetadata)
Metadata)
(MSIL
ManagedModule
Module
Managed
(MSILand
andMetadata)
Metadata)
(MSIL
Assembly
Assembly
Manifest
Manifest
.html
.gif
Resource Files
Page 11
Multiple Managed
Modules and
Resource Files
Are Compiled to
Produce an Assembly
Compiler
Compiler
metadata)
metadata)
Class
Class
Libraries
Libraries
(MSIL
(MSILand
and
Class
Class Loader
Loader
JIT
JIT Compiler
Compiler
with
with optional
optional
verification
verification
metadata)
metadata)
Trusted,
pre-JITed
code only
Managed
Native
Code
Call to an
uncompiled
method
Execution
Security Checks
Page 12
Runtime Engine
Source
Source
Code
Code
Page 13
Web Service
Page 14
MSBuild.exe
Tasks
.TARGETS
Loggers
Loggers
Tasks
.TARGETS
Source
control
Work
item
tracking
Team Build
Build Execution
Build projects
(including code
analysis)
Update
work items
Publish
build outputs
Produce build
report and send
mail
Page 15
Deployment
Requires the .NET Runtime to Be Installed on Local Computer
Can Be Run Directly from a File Server or Copied Locally
Make No Registry Entries
Cannot Break Another Application
Eliminate DLL Hell
Can Be Uninstalled by Deleting Locally Copied File(s)
Page 16
ClickOnce Deployment
Windows-based rich client application deployed as a web
application.
Page 17
Application Security
Page 18
The C# language
Very similar to Java
70% Java, 10% C++, 5% Visual Basic, 15% new
As in Java
Page 19
As in C++
(Operator) Overloading
Pointer arithmetic in unsafe
code
Some syntactic details
New Features in C#
Page 20
Syntactic Sugar
Delegates
Indexers
Operator overloading
foreach statements
Boxing/unboxing
Compilation
Command Line
Assembly
Source code
Compiler
csc.exe
DLL or EXE
Hello C# World
Command Line
File HelloWorld.cs
using System;
class HelloWorld
{
static void Main()
{
Console.WriteLine("Hello, C# World");
}
}
Page 22
uses
usesthe
thenamespace
namespace
System
System
entry
entrypoint
pointmust
mustbe
be
called
calledMain
Main
output
outputgoes
goestotothe
the
console
console
file
filename
nameand
andclass
class
name
name
need
neednot
notbe
beidentical
identical
Compiler Options
Command Line
Compile Directly from a Command Prompt Window
C:\>csc
C:\>csc HelloWorld.cs
HelloWorld.cs
C:\>csc
C:\>csc /t:exe
/t:exe HelloWorld.cs
HelloWorld.cs
C:\>csc
/t:exe
/reference:assemb1.dll
HelloWorld.cs
Use
/reference
to reference
assemblies
C:\>csc
/t:exe
/reference:assemb1.dll
HelloWorld.cs
Page 23
Compiling
Visual Studio
Page 24
Hello World
GUI
Further reading
The C# Language Specification ECMA 334
Professional C# 2005
C# 2.0, The Complete Reference Herbert Schildt
Professional .NET Framework 2.0 Joe Duffy
Good links
http://www.c-sharpcorner.com
http://www.thecodeproject.com
http://windowsforms.net
http://www.gotdotnet.com/
http://msdn.microsoft.com/netframework/using/
Page 26
Summary
What You Did
Write a command line
client
Write a GUI client
Page 27
End of Lesson