Net framework

17
Introduction to .NET Framework 3.5 and C# 3.0 [email protected] Programming in C#

Transcript of Net framework

Page 1: Net framework

Introduction to .NET Framework 3.5 and

C# 3.0

[email protected]

Programming in C#

Page 2: Net framework

A look back …

.NET 1.0 .NET 1.1 .NET 2.0

3.0 3.5

.NET 4

2002 2003 2008 CTP 2005-08

CLR 1.0 CLR 1.1 CLR 2.0 CLR 4

Page 3: Net framework

Architecture

Base Class Libraries

The CLR JIT &

NGEN Garbage Collector

Security Model

Exception Handling

Loader & Binder

WPF Win Forms DLR ASP.NET WCF And

more! LINQ

Page 4: Net framework

JIT in execution before executing hybrid approach

Interpreted compilation

Static compilation

Just-in-time Compilation

Page 5: Net framework

NGEN use native image from cache instead using JIT compilation

Page 6: Net framework

Loader & Binder locating assemblies at run-time and binding to them.

Page 7: Net framework

WPF – Windows Presentation Foundation graphical subsystem for rendering UI in windows-based application Silverlight utilizes WPF to provide embedded web controls comparable to Adobe Flash but more focus on an UI object model and less on animation.

Page 8: Net framework

WCF – Windows Communication Foundation designing and deploying distributed applications under services- oriented architecture (SOA) implementation

set of principle and methodologies for interoperable application

Page 9: Net framework

DLR – Dynamic language runtime a runtime environment that adds a set of services for dynamic languages to the common language runtime (CLR) Dynamic language identify the type of object at runtime whereas in statically type languages must specify object type at design time

https://gist.github.com/2627105

Page 10: Net framework

New features of C# 3.0

Page 11: Net framework

Implicitly Typed Local Variables declare variables without specifying the type at design time Must be declared and initialized at the same time. Cannot used as a return type and argument of method. Not possible for multiple declaration

var age; // Error, no initializer to infer the data type var age = 5; // Valid

var age = 1, genre = “male”; // Error

Page 12: Net framework

Object Initializers

Creates an object and initialize its fields and properties without a constructor

https://gist.github.com/2627433

Page 13: Net framework

Auto-implemented Properties

Creates an object and initialize its fields and properties without a constructor

public string HouseName { get; set; }

Page 14: Net framework

Extension Methods

Allows you to extend an existing type with new functionality without directly modifying those types Are static methods that have to be declared in a static class Declare an extension method by specifying the first parameter with this keyword

https://gist.github.com/2627468

static return-type MethodName (this type obj, param-list)

Page 15: Net framework

Collection Initializers

ClassName objName = new CollectionClassName{ collection-initializer }

Page 16: Net framework

Predefined Generic Delegates Func<T, TResult>() Delegate Represents a method having one parameters type T and returns a value of type TResult

https://gist.github.com/2627640

public delegate TResult Func<TResult>()

Page 17: Net framework

Lambda Expressions is an alternative to anonymous methods. https://gist.github.com/2633475

parameter-list => expression or statements