Professional Documents
Culture Documents
NET
Quick Glossary
BCL Base Class Library CLR Common Language Runtime GUI Graphic User Interface MSIL Microsoft Intermediate Language SCM Service Control Manager SOA Service Oriented Architecture ASP Active Server Pages ADO.NET ActiveX Data Object
AGENDA
Introduction to C# .NET C# Genealogy C# And .Net The Simple Stuff C# What is C# Why C# ? C# The Big Ideas Quick Comparison to Java Hello World Constructions of Note Introduction to Microsoft .NET Classic ASP Microsoft ASP.NET Server controls Data controls ASP.NET Web applications Web services Additional topics
Introduction to C#
Anders Hejlsberg
Distinguished Engineer Developer Division Microsoft Corporation
.NET is:
.NET
Microsofts Platform for Windows Development CLR the Virtual Machine that runs MSIL aka MicroSoft Byte Code BCL aka .NET Framework A set of compilers that can generate MSIL C#, Visual Basic, C++, Java (the MicroSoft flavor) http://www.dotnetpowered.com/languages.aspx
C# Genealogy
Elementary Procedural Advanced Procedural Special Procedural Object Oriented Eiffel Advanced Object Oriented
Fortran
Algol 68
C++
C#
Cobol
PL/I
Pascal
Ada 95
Java
Ada 83
C# And .Net
Languages like C# are not isolated entity They interoperate in two ways:
By being part of a system written in more than one language By accessing services and operating on a distributed environment
.Net is many things, in particular binary object access C# interoperates with .Net
Language Created by Anders Hejlsberg (father of Delphi) The origin History can be viewed here: http://www.levenez.com/lang/history.html Principle Influencing Languages:
C++ Delphi Java
C#
What is C#
C# is an object-oriented programming language developed by Microsoft. That intends to be a simple, modern, and generalpurpose programming language for application development. C#, also known as C-Sharp, is a programming language introduced by Microsoft. C# is specially designed to work with the Microsofts .NET platform.
Why C# ?
Builds on COM+ experience Native support for
Namespaces Versioning Attribute-driven development
Power of C with ease of Microsoft Visual Basic Minimal learning curve for everybody Much cleaner than C++ More structured than Visual Basic More powerful than Java
In OOP a component is: A reusable program that can be combined with other components in the same system to form an application. Example: a single button in a graphical user interface, a small interest calculator They can be deployed on different servers and communicate with each other No header files, IDL, etc. Can be embedded in web pages
Syntactically Similar Garbage Collected VM Environment Immutable Strings Exceptions (try / catch / finally) Object as root Single Inheritance model Multi-Interface model
Mono
Open source development SDK for .NET Windows, Linux, Mac OS X, Solaris, Unix Sponsored by Novell Food for thought: Suse + KDE + Mono = ???
Sharp Develop
Open source IDE that uses .NET SDK or Mono Written in C#
Hello World
using System; class Hello { static void Main() { Console.WriteLine("Hello world"); } }
using
Constructions of Note
namespace
disambiguation of names like Internet hierarchical names and Java naming
class
like in Java single inheritance up to object
Console.Write(Line)
Constructions of Note
Organization
Types
Windows Application
GUI based No standard streams (out, in, err) Main thread is shared by the GUI message pump & your code
Service
No standard streams (out, in, err) Main thread is commandeered by the SCM No GUI
Networking Namespaces
System.Messaging System.Net
Functionality for MSMQ Provides access to higher protocols (FTP, HTTP, DNS) Network information classes interface information, and ping providing statistics,
System.Net.Information System.Net.Sockets
System.Runtime.Remoting System.Web
Formally code named Indigo Designed to make SOA an integral part of Windows Tight coupling with .NET designs For more information
http://msdn.microsoft.com/windowsvista/default.aspx?pull=/l ibrary/en-us/dnlong/html/wcfarch.asp
Summary
C# builds on the .NET Framework component model New language with familiar structure
Easy to adopt for developers of C, C++, Java, and Visual Basic applications
Exceptions
How should they be made available in programming languages? What benefits do they provide? What problems could they cause for us? Throw raises an exception Catch defines a block that handles the exception Etc.
Introduction to .NET
ASP.NET
Visual Basic C++ C# JScript Common Language Specification Visual Studio.NET
Windows Forms
ADO.NET: Data and XML Base Class Library Common Language Runtime
Classic ASP
Successes
Simple procedural programming model Access to COM Objects
ADO File system object
No compiling, just save Support for multiple scripting languages Mix HTML and code VBscript leverage Visual Basic skills
Classic ASP
Code readability Coding overhead PostBack complexity Reuse Performance DLL locking Deployment Sessions Caching
Challenges
ASP.NET
Architecture
Compiled
.ASPX
Source code
Visual Basic
Compiler
C#
Compiler Assembly IL Code
C++
Compiler Assembly IL Code Unmanaged Component
Managed code
Assembly IL Code
Server Controls
Simplify common tasks
Forms Tables Data display Calendar Ad rotator
Server-side programming model Automatic browser compatibility Less code, less complexity Extensible
Server Controls
Validation
Without code
Required field Within range Two fields equal (password) Regular expressions Validation error messages Custom validation
Data Controls
Bind to many data sources
Collections
Array HashTable DataReader DataSet
ADO.NET
XML
Data Controls
ADO.NET
Connection Command DataReader DataSet DataAdapter DataView
Web Services
What Are Web Services?
Allow applications to communicate across the Internet Platform independent Protocol independent Synchronous/asynchronous Stateful/stateless ASP.NET
Additional Topics
Deployment
Copy Components in .\bin No registering DLLs No locked DLLs Apps are isolated Each app can have its own version Uninstall Delete
Additional Topics
Scalability Improvements
ASP.NET pages are complied State shared across machines Managed providers Disconnected data access Caching
Additional Topics
Authentication
Supports basic, digest, authentication, Passport Form-based authentication Users or roles One API for user info cookie, and Windows
ASP.NET
Features
ASPX, ASP side by side Simplified programming model Simplified deployment Better performance Caching Security Powerful controls
ASP.NET
Features
Simplified browser support Simplified form validation Code behind pages More powerful data access Web services Better session management
Useful Tools
Visual C# Express: Bing Visual C# Express in Visual Studio: MSDNAA must be version 2005: we need C# 2.0 Mono: http://www.go-mono.com Open Source impl for Linux: not quite at 2.0 Rotor: http://msdn.microsoft.com/net/sscli Shared Source impl for Windows (through 2.0) Used to work on BSD / OS X, too
Useful Tools
Portable.NET: http://www.dotgnu.org
yet another open source impl
CMS: http://cms.csuglab.cornell.edu
we will use this for homework turn on your email notifications!
44