Platforma.NET Wykład 2 Składowe platformy.net. Spis treści. Plan wykładu tydzień po tygodniu. Plan wykładu tydzień po tygodniu. Notatki.



Podobne dokumenty
Projekt: Mikro zaprogramowane na sukces!

Platforma.NET Wykład 2 Składowe platformy.net

Platforma.NET Wykład 2 Składowe platformy.net. Spis treści. Marek Sawerwain. 10 marca Notatki. Notatki

Microsoft IT Academy kurs programowania

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

Podstawy programowania. Wprowadzenie

Tychy, plan miasta: Skala 1: (Polish Edition)

MaPlan Sp. z O.O. Click here if your download doesn"t start automatically

ARNOLD. EDUKACJA KULTURYSTY (POLSKA WERSJA JEZYKOWA) BY DOUGLAS KENT HALL

Karpacz, plan miasta 1:10 000: Panorama Karkonoszy, mapa szlakow turystycznych (Polish Edition)

Zakopane, plan miasta: Skala ok. 1: = City map (Polish Edition)

Cel szkolenia. Konspekt

Programowanie C# mgr in. Dariusz Ku. p. 119A

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

CENNIK I TERMINARZ SZKOLEŃ

Środowiska i platformy programistyczne

Zarządzanie sieciami telekomunikacyjnymi

Katowice, plan miasta: Skala 1: = City map = Stadtplan (Polish Edition)

Stargard Szczecinski i okolice (Polish Edition)

OpenPoland.net API Documentation

Języki i paradygmaty programowania doc. dr inż. Tadeusz Jeleniewski

Strona główna > Produkty > Systemy regulacji > System regulacji EASYLAB - LABCONTROL > Program konfiguracyjny > Typ EasyConnect.

Helena Boguta, klasa 8W, rok szkolny 2018/2019

Dane opatrzone informacją o położeniu obiektów w świecie rzeczywistym. Współrzędne geograficzne. Geokodowanie

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

Miedzy legenda a historia: Szlakiem piastowskim z Poznania do Gniezna (Biblioteka Kroniki Wielkopolski) (Polish Edition)

OSI Network Layer. Network Fundamentals Chapter 5. Version Cisco Systems, Inc. All rights reserved. Cisco Public 1

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

Proposal of thesis topic for mgr in. (MSE) programme in Telecommunications and Computer Science

Instrukcja obsługi User s manual

Testy jednostkowe - zastosowanie oprogramowania JUNIT 4.0 Zofia Kruczkiewicz

Emilka szuka swojej gwiazdy / Emily Climbs (Emily, #2)

No matter how much you have, it matters how much you need

Języki i paradygmaty programowania - 1

Dariusz Brzeziński. Politechnika Poznańska, Instytut Informatyki

Application Layer Functionality and Protocols

Realizacja systemów wbudowanych (embeded systems) w strukturach PSoC (Programmable System on Chip)

SSW1.1, HFW Fry #20, Zeno #25 Benchmark: Qtr.1. Fry #65, Zeno #67. like

Kurs programowania. Wykład 13. Wojciech Macyna. 14 czerwiec 2017

MS OD Integrating MDM and Cloud Services with System Center Configuration Manager

OSI Network Layer. Network Fundamentals Chapter 5. ITE PC v4.0 Chapter Cisco Systems, Inc. All rights reserved.

Network Services for Spatial Data in European Geo-Portals and their Compliance with ISO and OGC Standards

Miedzy legenda a historia: Szlakiem piastowskim z Poznania do Gniezna (Biblioteka Kroniki Wielkopolski) (Polish Edition)

Platforma.NET Wykład 2 Składowe platformy.net. Spis treści. Plan wykładu tydzień po tygodniu. Plan wykładu tydzień po tygodniu. Notatki.

archivist: Managing Data Analysis Results

Języki i metodyka programowania. Język C# pętle, sterowanie, wyjątki

Platforma.NET Wykład 2 Składowe platformy.net. Spis treści. Marek Sawerwain. Ostatnia kompilacja pliku: 22 marca 2018, t: 18:54. Notatki.

Wroclaw, plan nowy: Nowe ulice, 1:22500, sygnalizacja swietlna, wysokosc wiaduktow : Debica = City plan (Polish Edition)

Krytyczne czynniki sukcesu w zarządzaniu projektami

Rev Źródło:

CENNIK I TERMINARZ SZKOLEŃ

.NET NET Framework Microsoft Windows Communication Foundation Microsoft Windows Presentation Foundation Microsoft Windows Workflow Foundation

ERASMUS + : Trail of extinct and active volcanoes, earthquakes through Europe. SURVEY TO STUDENTS.

Programowanie RAD Delphi

Instrukcja konfiguracji usługi Wirtualnej Sieci Prywatnej w systemie Mac OSX

CENNIK I TERMINARZ SZKOLEŃ SZKOLENIA OTWARTE DLA UŻYTKOWNIKÓW SYSTEMÓW INFORMATYCZNYCH

Systemy wbudowane. Poziomy abstrakcji projektowania systemów HW/SW. Wykład 9: SystemC modelowanie na różnych poziomach abstrakcji

PROGRAM STAŻU. IBM Global Services Delivery Centre Sp z o.o. Nazwa podmiotu oferującego staż / Company name. Muchoborska 8, Wroclaw

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

Revenue Maximization. Sept. 25, 2018

Dlaczego my? HARMONOGRAM SZKOLEŃ kwiecień - czerwiec ACTION Centrum Edukacyjne. Autoryzowane szkolenia. Promocje RODO / GDPR

Metodyki projektowania i modelowania systemów Cyganek & Kasperek & Rajda 2013 Katedra Elektroniki AGH

T O M A S Z N I T K A

CENNIK I TERMINARZ SZKOLEŃ

Czym jest Java? Rozumiana jako środowisko do uruchamiania programów Platforma software owa

SNP SNP Business Partner Data Checker. Prezentacja produktu

POLITYKA PRYWATNOŚCI / PRIVACY POLICY


CENNIK I TERMINARZ SZKOLEŃ

Wojewodztwo Koszalinskie: Obiekty i walory krajoznawcze (Inwentaryzacja krajoznawcza Polski) (Polish Edition)

Czy OMS Log Analytics potrafi mi pomóc?

Tworzenie aplikacji w języku Java

Pielgrzymka do Ojczyzny: Przemowienia i homilie Ojca Swietego Jana Pawla II (Jan Pawel II-- pierwszy Polak na Stolicy Piotrowej) (Polish Edition)

MS Visual Studio 2005 Team Suite - Performance Tool

ABOUT NEW EASTERN EUROPE BESTmQUARTERLYmJOURNAL

Hard-Margin Support Vector Machines

Domy inaczej pomyślane A different type of housing CEZARY SANKOWSKI

Machine Learning for Data Science (CS4786) Lecture11. Random Projections & Canonical Correlation Analysis

Metodyka programowania. Podstawy C#

Dlaczego my? HARMONOGRAM SZKOLEŃ październik - grudzień ACTION Centrum Edukacyjne. Autoryzowane szkolenia. Promocje

TTIC 31210: Advanced Natural Language Processing. Kevin Gimpel Spring Lecture 9: Inference in Structured Prediction

Karpacz, plan miasta 1:10 000: Panorama Karkonoszy, mapa szlakow turystycznych (Polish Edition)

Leba, Rowy, Ustka, Slowinski Park Narodowy, plany miast, mapa turystyczna =: Tourist map = Touristenkarte (Polish Edition)

PROGRAM STAŻU. Nazwa podmiotu oferującego staż / Company name IBM Global Services Delivery Centre Sp z o.o.

Kierunek: Informatyka rev rev jrn Stacjonarny EN 1 / 6

4 Web Forms i ASP.NET Web Forms Programowanie Web Forms Możliwości Web Forms Przetwarzanie Web Forms...152

Programowanie współbieżne i rozproszone

Dolny Slask 1: , mapa turystycznosamochodowa: Plan Wroclawia (Polish Edition)

OSI Physical Layer. Network Fundamentals Chapter 8. Version Cisco Systems, Inc. All rights reserved. Cisco Public 1

Blow-Up: Photographs in the Time of Tumult; Black and White Photography Festival Zakopane Warszawa 2002 / Powiekszenie: Fotografie w czasach zgielku

Dolny Slask 1: , mapa turystycznosamochodowa: Plan Wroclawia (Polish Edition)

Poland) Wydawnictwo "Gea" (Warsaw. Click here if your download doesn"t start automatically

1. CZYM JEST SERIALIZACJA

USB firmware changing guide. Zmiana oprogramowania za przy użyciu połączenia USB. Changelog / Lista Zmian

Szkolenia informatyczne Vavatech

Profil Czasopisma / The Scope of a Journal

Wybrzeze Baltyku, mapa turystyczna 1: (Polish Edition)

Cel szkolenia. Konspekt. About this Course

CENNIK I TERMINARZ SZKOLEŃ


Transkrypt:

Marek Sawerwain Instytut Sterowania i Systemów Informatycznych Uniwersytet Zielonogórski 10 marca 2011 V1.1 1/ 47 Spis treści Wprowadzenie Plan wykładu Analiza składowych platformy.net Common Language Specification Common Type Systems (CTS) Przegląd języków programowania.net Analiza biblioteki klas Budowa podzespołu Język pośredni Kompilacja i wykonywanie programów IL Tabela instrukcji wybór Już za tydzień na wykładzie V1.1 2/ 47 Wprowadzenie Plan wykładu Plan wykładu tydzień po tygodniu (1) Informacje o wykładzie, pojęcie platformy, podstawowe informacje o platformie.net, (2) : CLR, CTS, języki programowania, biblioteki klas, pojęcie podzespołu (ang. assembly), (3) Programowanie w C# środowisko VS, MonoDevelop, syntaktyka C#, wyjątki, współpraca z DLL, (4) Programowanie w C# model obiektowy, typy uogólnione, lambda wyrażenia, (5) Programowanie w C# aplikacje okienkowe, programowanie wielowątkowe. (6) Programowanie w F# podstawy, przetwarzanie danych tekstowych, (7) "Klasówka I", czyli wstęp do egzaminu cześć pierwsza (8) Dostęp do baz danych V1.1 3/ 47 Wprowadzenie Plan wykładu Plan wykładu tydzień po tygodniu (9) Język zapytań LIN (10) Obsługa standardu XML (11) Technologia ASP.NET (12) ASP.NET Model View Controller (13) Tworzenie usług sieciowych SOA i WCF (14) Bezpieczeństwo aplikacji.net (15) "Klasówka II", czyli wstęp do egzaminu cześć druga V1.1 4/ 47

Wprowadzenie Plan wykładu Plan wykładu 1. Elementy.NET 1.1 główne elementy.net, 1.2 reguły CLS, 1.3 system typów. 2. Biblioteka klas 2.1 podział typów, 2.2 typy wbudowane oraz typy w kontekście C#, 2.3 podstawowe klasy w przestrzeni System. 3. Podzespół (assembly)/język pośredni 3.1 rola podzespołu, 3.2 budowa i model, 3.3 język pośredni. V1.1 5/ 47 Analiza składowych platformy.net Elementy platformy.net Wspólne środowisko uruchomieniowe oraz biblioteka klas, Web Services zestandaryzowana technologia publikacji serwisów WWW, SOAP Simple Object Access Protocol, HTTP protokół stosowany do przesyłania informacji pomiędzy serwisami WWW, XML opis danych. Visual Basic C++ C# Perl Python Message ueuing XML Web Services ADO.NET and XML.NET Framework Class Libray Common Language Runtime COM+ (Transactions, Partitions, Object Pooling) WIN32 / WIN64 User Interface.NET Framework oferuje ustalony sposób produkcji oprogramowania w oparciu o platformę w której nie akcentuje się żadnego języka programowania. Platforma zawiera wspólne środowisko uruchomieniowe, bibliotekę klas dodatkowe serwery oraz narzędzia. IIS WMI V1.1 6/ 47 Analiza składowych platformy.net Cztery główne filary platformy.net środowisko wykonawcze programów.net odpowiedzialne za lokalizację, wczytanie oraz zarządzanie typami/obiektami platformy.net Common Language Infrastructure (CLI) ECMA-335 Common Language Specification (CLS) zespół zasad oraz reguł niezbędnych do spełniania aby określony język programowania mógł współpracować z CLI. Common Type System (CTS) definicja sposobu reprezentacji typów danych w pamięci maszyny. Common Intermediate Language (CIL) język pośredni (IL) stanowiący niezależny zestaw instrukcji od istniejących rozwiązań procesorowych, do którego kompilowane są wszystkie programy pracujące w ramach środowiska.net, metadane. Common Language Runtime (CLR) Common Language Specification (CLS) Base Class Library (BCL) Metadata Definition and Semantics Common Type System (CTS) Common Intermediate Language (CIL) Instruction Set V1.1 7/ 47 Środowisko wykonawcze maszyna wirtualna Zadaniem maszyny wirtualnej jest kontrola nad odwołaniami uruchamianego programu do sprzętu i systemu operacyjnego. W przypadku braku pewnych funkcji na poziomie sprzętowym zdaniem maszyny jest symulacja brakującej funkcjonalności. W ten sposób aplikacja/program nie jest wstanie sprawdzić, czy jest uruchomiony na prawdziwym, czy też udawanym/wirtualnym sprzęcie. Maszyny wirtualne to m.in.: interpretery, szczególnie interpretery kodu bajtowego, kompilatory JIT, emulatory rzeczywiście istniejącego sprzętu, np. emulatory starszych komputerów, konsol do gier. Uwaga! Nie zawsze jednoznacznie można określić wprost, czy faktycznie mamy do czynienia z maszyną wirtualną przykładem może być Java. V1.1 8/ 47

Zastosowania maszyn wirtualnych Maszyny wirtualne są używane do różnych celów, min. do: 1. uruchamiania starszych aplikacji i/bądź starszych systemów operacyjnych w innych środowiskach niż pierwotne, 2. zapewnienia uniwersalnego środowiska uruchomieniowego, 3. bezpiecznego rozdzielania zasobów (min. mainframe, superkomputery), 4. uruchamiania jednocześnie różnych systemów operacyjnych na jednym komputerze (bez konieczności resetu tzw. systemu goszczącego), 5. tworzenia programowych klastrów, 6. analizowania jego pracy/debuggowania tworzonych systemów operacyjnych, 7. optymalizacji tworzonych aplikacji/programów, poprzez zapewnienie kontroli nad ich środowiskiem działania. Wymienione właściwości mogą występować łącznie lub być ograniczone, istotną własnością jest zupełność, czyli dana maszyna wirtualna W powinna być w stanie uruchomić swoją własną kopię. V1.1 9/ 47 Znane maszyny wirtualne Kilka współczesnych programowych maszyn wirtualnych: Nazwa Model Zarząd. pam. Bezpie. Inter. JIT C. CL O.Model Dynam. typ. CLR stack auto/man Y N Y Yes Yes Mono stack auto/man Y Y Y Yes Yes DotGNU stack auto/man Y N Y Yes N JVM stack auto Y Y Y Yes N LLVM register man. N Y Y Yes N Parrot register auto N Y N Yes Yes Legenda: Zarząd. pam. Zarządzanie pamięcią, Bezpie. Bezpieczeństwo, Inter. Interpreter, JIT C. Just-in-time compiler, CL O.Model model obiektowy, Dynam. typ. dynamiczne typowanie. Maszyny wirtualne można podzielić na dwa podstawowe modele: rejestrowy oraz stosowy. Istotnym problemem jest wydajność maszyny, dlatego obecność kompilatora JIT jest niezbędna, aby dane rozwiązanie oferowało odpowiednio wysoką wydajność. V1.1 10/ 47 Usługi określone przez CLR: 1. zarządzanie kodem, czyli jego uruchamianie oraz nadzór nad jego wykonaniem, 2. zarządzanie pamięcią w przypadku obiektów zarządzanych 3. izolacja obszarów pamięci przydzielonych poszczególnym aplikacją.net, 4. konwersja języka IL do kodu maszynowego, 5. dostęp do metadanych (informacja o typach), 6. zabezpieczenia w dostępie kodu do zasobów, 7. weryfikacja i zgodność typów, 8. obsługa wyjątków (przekazywanie ich pomiędzy różnymi językami jak np.: F# oraz C#), 9. współpraca kodu zarządzanego z niezarządzanym, obsługa COM i bibliotekami DLL, 10. automatyzacja tworzenia obiektów, 11. usługi wspomagające tworzenie oprogramowania jak debuggowanie oraz profilowanie V1.1 11/ 47 Wymagania, co do środowiska wykonawczego zostały określone w dokumencie ECMA-335: http://www.ecma-international.org/publications/standards/ecma-335.htm. Base Class Library Support Thread Support COM Marshaler Type Checker Exception Manager Security Engine Debug Engine IL to native code (JIT compiler) Code Manager Garbage (GC) Collector Class Loader Istniejące implementacje wspólnego środowiska wykonawczego: CLR implementacja Microsoftu, MONO http://www.mono-project.com, DotGNU/Portable.NET www.gnu.org/projects/dotgnu/, http://dotgnu.org/. V1.1 12/ 47

Rozwój CLR Kolejne wydania platformy.net naturalnie pociągają za sobą modyfikację CLR: WCF WPF WF EF Parallel WCS LIN DLR CLR 1.0 CLR 1.1 CLR 2.0 CLR 2.0 CLR 2.0 CLR.NET 1.0.NET 1.1.NET 2.0.NET 3.0.NET 3.5 (SP1).NET oznacza to, iż dokument ECMA-335 jest poddawany modyfikacjom w momencie wydawania nowych wersji platformy.net, ostatnia pochodzi z grudnia 2010. V1.1 13/ 47 Common Language Specification Common Language Specification (CLS) Rola CLS CLS to zestaw reguł których spełnienia ma zapewnić współpracę pomiędzy różnymi językami programowania w ramach platformy.net. Trzy główne obszary/poziomy, gdzie stosowane są reguły CLS: 1. framework poziom bibliotek/technologii/zestawów klas, 2. consumer język programowania lub narzędzie dostarczające dostęp do funkcjonalności platformy, 3. extender język programowania lub narzędzie dostarczające dostęp do funkcjonalności platformy oraz rozszerza jej możliwości, V1.1 14/ 47 Common Language Specification Reguły szczegółowe CLS z dokumentu ECMA 335 Przykłady reguł ze standardu: CLS Rule 17 Unmanaged pointer types are not CLS-compliant. Note: CLS (consumer) There is no need to support unmanaged pointer types. CLS (extender) There is no need to provide syntax to define or access unmanaged pointer types. CLS (framework) Unmanaged pointer types shall not be externally exported. CLS Rule 23 System.Object is CLS-compliant. Any other CLS-compliant class shall inherit from a CLS- compliant class. CLS Rule 25 No longer used. [Note: In an earlier version of this standard, this rule stated The accessibility of a property and of its accessors shall be identical. The removal of this rule allows, for example, public access to a getter while restricting access to the setter. end note] V1.1 15/ 47 Common Language Specification Reguły szczegółowe CLS z dokumentu ECMA 335 Przykłady reguł ze standardu: CLS Rule 38 Properties and methods can be overloaded based only on the number and types of their parameters, except the conversion operators named op_implicit and op_explicit, which can also be overloaded based on their return type. Note: CLS (consumer) Can assume that only properties and methods are overloaded, and need not support overloading based on return type unless providing special syntax for operator overloading. If return type overloading isn t supported, then the op_implicit and op_explicit can be ignored since the functionality shall be provided in some other way by a CLS-compliant framework. Consumers must first apply the hide-by- name and hide-by-signature-and-name rules ( 8.10.4) to avoid any ambiguity. CLS (extender) Should not permit the authoring of overloads other than those specified here. It is not necessary to support operator overloading at all, hence it is possible to entirely avoid support for overloading on return type. CLS (framework) Shall not publicly expose overloading except as specified here. Frameworks authors should bear in mind that many programming languages, including object-oriented languages, do not support overloading and will expose overloaded methods or properties through mangled names. Most languages support neither operator overloading nor overloading based on return type, so op_implicit and op_explicit shall always be augmented with some alternative way to gain the same functionality. V1.1 16/ 47

Common Type Systems (CTS) Common Type System (CTS) Wspólny system typów Wspólny system typów określa w jaki sposób typy są deklarowane, używane oraz zarządzane w czasie wykonania (run-time). Najważniejsze funkcje udostępniane przez CTS to min: 1. bezpieczeństwo typów, szybkie wykonywanie kodu, utworzenie niezbędnej struktury do integracji między językowej, 2. pełny model zorientowany obiektowo implementowany w wielu językach programowania.net, 3. określa warunki, które muszą być spełnione przez określony język.net, co pozwala na interakcje pomiędzy obiektami pomiędzy różnymi językami.net. Główne zadanie CTS Obecność CTS pozwala na integrację języków, bowiem języki programowania obecne w.net współdzielą te same typy podstawowe określone przez CTS. V1.1 17/ 47 Common Type Systems (CTS) Ogólny podział typów Type Value Types Refernces Types (identity within app. domain) Built-in Value Types (special encoding in signature) User Defined Integer Types Enums Floating Point Types Typed References V1.1 18/ 47 Wartości dla typów prostych zazwyczaj sa umieszczane na stosie, natomiast typy referencyjne umieszczane są na stercie oraz są zarzadzanie przez mechanizmy CLR (np.: usuwanie przez garbage collector). Common Type Systems (CTS) Ogólny podział typów Refernces Types (identity within app. domain) Self-Describing Interface Pointer Built-In Reference Types Name Equivalent Function String Delegates Managed (might be in heap) Object Boxed Value Types Unmanaged Boxed Enums Structural Equivalent Arrays V1.1 19/ 47 Wartości dla typów prostych zazwyczaj sa umieszczane na stosie, natomiast typy referencyjne umieszczane są na stercie oraz zarzadzanie przez mechanizme CLR (np.: usuwanie przez garbage collector). Common Type Systems (CTS) Wartości dla typów prostych zazwyczaj sa umieszczane na stosie, natomiast typy referencyjne umieszczane są na stercie oraz są zarzadzanie przez mechanizmy CLR (np.: usuwanie przez garbage collector). CTS typy wbudowane built-in Podstawowe typy obecne we wspólnym środowisku wykonawczym. Nazwa CIL Typ CLS Nazwa BCL Opis bool Yes System.Boolean True or false value char Yes System.Char Unicode 16-bit char object Yes System.Object Object or boxed value type string Yes System.String Unicode string float32 Yes System.Single IEC 60559:1989 32-bit float float64 Yes System.Double IEC 60559:1989 64-bit float int8 No System.SByte Signed 8-bit integer int16 Yes System.Int16 Signed 16-bit integer int32 Yes System.Int32 Signed 32-bit integer int64 Yes System.Int64 Signed 64-bit integer native int Yes System.IntPtr Signed integer, native size native unsigned int No System.UIntPtr Unsigned integer, native size typedref No System.TypedReference Pointer plus exact type unsigned int8 Yes System.Byte Unsigned 8-bit integer unsigned int16 No System.UInt16 Unsigned 16-bit integer unsigned int32 No System.UInt32 Unsigned 32-bit integer unsigned int64 No System.UInt64 Unsigned 64-bit integer V1.1 20/ 47

Common Type Systems (CTS) CTS a typy w języku C# (I) Typy wartościowe: (1) Proste typy numeryczne i znakowe: (a) wielkość integer ze znakiem: sbyte, short, int, long, (b) wielkość integer bez znaku: byte, ushort, uint, ulong, (c) znak unicode: char, (d) IEEE floating point: float, double, (e) liczby o dużej precyzji: decimal, (f) boolean: bool. (2) Typ enum: enum EName {..., (3) Typ struct: struct SName {..., (4) Typy nullable : typy mają możliwość przyjęcia wartości null. (II) Typy referencyjne: (1) Typ klasowy: (a) typ podstawowy dla typu obiektowego: object, (b) łańcuchy znaków unicode: string, (c) klasy zdefiniowane przez użytkownika: class CName {..., (2) Typ interface: interface IName {..., (3) Typ tablicowy: jedno i wielowymiarowe tablice zdefiniowane przez użytkonika: int[], int[,], (4) Typ delegate : typy użytkownika: delegate int DName(... ). V1.1 21/ 47 Przegląd języków programowania.net Opracowano ponad 40 języków dla.net V1.1 22/ 47 Przegląd języków programowania.net Najważniejsze języki Najważniejsze języki dostępne z pudełka to: C#, Visual Basic.NET, C++/CLI, J# (odmiana języka Java opracowany przez Microsoft), JScript.NET (kompilowana odmiana języka JScript). Inne ważne języki: 1. COBOL, Delphi.NET, Oxygen, 2. Eiffel, Fortran, Lisp, 3. Nemerle, F#, Python, P# (Prolog). V1.1 23/ 47 Przegląd języków programowania.net F# język funkcyjny Definicja funkcji rekurencyjnej fib obliczającej liczby ciągu Fibbonaciego: let rec fib x = match x with 1 -> 1 2 -> 1 x -> fib (x - 1) + fib (x - 2) printfn "(fib 2) = %i" (fib 2) printfn "(fib 6) = %i" (fib 6) printfn "(fib 11) = %i" (fib 11) i elementy ciągu Lucasa: let rec luc x = match x with x when x <= 0 -> failwith "value must be greater than 0" 1 -> 1 2 -> 3 x -> luc (x - 1) + luc (--x - 2) printfn "(luc 2) = %i" (luc 2) V1.1 24/ 47

Przegląd języków programowania.net Konwersja liczby całkowitej na postać binarną: let BitsNum = 32 ;; let binary_of_int n = [ for i in BitsNum - 1.. -1.. 0 -> if (n >>> i) % 2 = 0 then "0" > String.concat "" ;; else "1" ] let x1 = binary_of_int 1431 ;; let x2 = binary_of_int ( -1123 ) ;; V1.1 25/ 47 Analiza biblioteki klas Zadania i funkcje biblioteki klas Standard ECMA-335 określa także postać standardowej biblioteki klas, zaliczane są następujące pakiety (zachowane zostało oryginalne nazewnictwo standardu): 1. Run-time infrastructure library 2. Base Class Library (BCL) 3. Network library 4. Reflection library 5. XML library 6. Extended numerics library 7. Extended array library 8. Vararg library 9. Parallel library V1.1 26/ 47 Analiza biblioteki klas Ogólny schemat Base Class Library BCL.NET 3.5 Microsoft.NET Framework 3.5 Commonly Used Types and Namespaces Windows Presentation Foundation System.Windows RowDefinition ScrollViewer Slider SpellCheck StackPanel TabControl TabItem TextBlock TextBox ToolBar ToolTip TreeView UIElementCollection ViewBox Viewport3D VirtualizingStackPanel WrapPanel Style Trigger UIElement3D NEW Visibility Window System.Windows.Controls Border Button CheckBox ColumnDefinition ContextMenu ControlTemplate DockPanel FlowDocumentReader Frame Grid Image InkCanvas ItemCollection ItemsPresenter ListBox ListView MediaElement Menu MenuItem Page PasswordBox ProgressBar RadioButton RichTextBox Popup RepeatButton ScrollBar StatusBar TabPanel Thumb ToggleButton UniformGrid System.Windows.Data WindowsFormsHost Binding CollectionView DataSourceProvider MultiBinding DoubleAnimation StoryBoard Timeline Cursor Cursors FocusManager InputDevice Keyboard KeyboardNavigation Mouse Stylus BitmapImage RenderTargetBitmap WritableBitmap MarkupExtension XamlReader XamlWriter Communications and Workflow System.Messaging System.Net.Sockets System.ServiceModel.Description System.Net Dns FtpWebRequest HttpListener HttpWebRequest WebClient System.ServiceModel NetMsmqBinding NetTcpBinding OperationBehaviorAttribute OperationContractAttribute ServiceBehaviorAttribute ServiceContractAttribute ServiceHost WorkflowServiceHost NEW WSHttpBinding System.Net.Mail MailMessage SmtpClient System.Net.NetworkInformation NetworkInterface NetworkChange Ping WebGetAttribute NEW WebInvokeAttribute NEW WebOperationContext NEW WebServiceHost NEW System.ServiceModel.Persistence NEW ServiceMoniker System.Data.Linq.Mapping NEW AttributeMappingSource NEW MetaModel NEW XmlMappingSource NEW WorkflowLoaderService WorkflowPersistenceService WorkflowRuntimeService WorkflowSchedulerService OdbcCommand OdbcConnection OdbcDataAdapter OdbcDataReader TrackingService XPathDocument XPathExpression XPathNavigator XslCompiledTransform XsltArgumentList XmlAttribute XmlDocument XmlElement XmlNode XmlReader XmlWriter System.Xml.Linq NEW Key NEW New with the.net Framework 3.5. System.Xml.Schema System.Data.OleDb Rule RuleAction RuleCondition RuleSet SslStream XmlSerializer System.Xml.Xsl XAttribute NEW XDocument NEW XElement NEW XName NEW XNamespace NEW XNode NEW XText NEW System.Data.Odbc System.Workflow.Runtime.Tracking System.Workflow.Activities.Rules PersistenceProvider NEW PersistenceProviderFactory NEW SqlPersistenceProviderFactory NEW NegotiateStream What is the.net Framework? The.NET Framework is the managed code programming model for Windows. It provides a highly productive environment for software developers and offers excellent skills reuse across multiple application architectures. The.NET Framework is available with the same consistent API across different development platforms, including the full.net Framework for the desktop and server, the.net Compact Framework for mobile devices, the.net Framework on SL Server, the.net Micro Framework for small embedded systems such as SPOT watches, and Silverlight version 1.1 for cross-platform, cross-browser development of rich Internet applications. The.NET Framework is used by 90% of Fortune 100 companies and is easily deployable to end user PCs. System.Xml.Serialization System.Xml DataContext NEW EntityRef<T>NEW EntitySet<T>NEW Table<T>NEW WorkflowInstance WorkflowRuntime System.Workflow.Runtime.Hosting CodeActivity SequenceActivity ParallelActivity ReceiveActivity NEW SendActivity NEW StateMachineWorkflowActivity CustomPeerResolverService System.Data.Linq NEW WorkflowMarkupSerializer System.Workflow.Runtime SoapHttpClientProtocol System.Workflow.Activities MsmqIntegrationBinding System.ServiceModel.PeerResolvers System.Net.Security ActivityDesigner System.Workflow.ComponentModel.Serialization WebService System.Web.Services.Protocols System.ServiceModel.MsmqIntegration Binding CommunicationObject IChannel Message System.ServiceModel.ComIntegration HtmlButton HtmlControl HtmlForm HtmlInputControl System.Xml.XPath SqlCommand SqlConnection SqlDataAdapter SqlDataReader SqlNotification DbCommand DbConnection DbDataAdapter DbDataReader DbProviderFactory XmlSchema XmlSchemaSet XmlSchemaValidator OleDbCommand OleDbConnection OleDbDataAdapter OleDbDataReader WebPart System.Web.UI.HtmlControls BuildProvider WebConfigurationManager System.Data.SqlClient System.Data.Common WorkflowCompiler System.Web.Services PerformanceCounterScope ClientOperation ClientRuntime DispatchOperation DispatchRuntime System.ServiceModel.Channels ContactManager NEW PeerApplication NEW PeerCollaboration NEW PeerContact NEW PeerNearMe NEW ClientFormsAuthenticationMembershipProvider NEW ClientRoleProvider NEW System.Web.Configuration OracleCommand OracleConnection OracleDataAdapter OracleDataReader DataColumn DataRow DataSet DataTable DataView Activity ActivityExecutionContext CompositeActivity System.Workflow.ComponentModel.Compiler System.Workflow.ComponentModel.Design System.Web.UI.WebControls.WebParts Control MasterPage Page ScriptManager NEW UpdatePanel NEW UpdateProgress NEW UserControl ClientFormsIdentity NEW ClientRolePrincipal NEW ConnectivityStatus NEW System.Web.ClientServices.Providers NEW System.Web.Compilation System.Data.OracleClient System.Data RuleConditionDialog RuleSetDialog System.Workflow.ComponentModel Atom10FeedFormatter NEW Rss20FeedFormatter NEW SyndicationFeed NEW SyndicationItem NEW System.ServiceModel.Web NEW System.ServiceModel.Dispatcher AspNetCompatibilityRequirementsAttribute ServiceHostFactory WorkflowServiceHostFactory NEW Cloud NEW PeerName NEW PeerNameRecord NEW PeerNameResolver NEW System.Net.PeerToPeer.Collaboration NEW System.Workflow.Activities.Rules.Design SecurityAlgorithmSuite SecurityMessageProperty SecurityVersion System.ServiceModel.Syndication NEW System.ServiceModel.Diagnostics System.ServiceModel.Activation System.Net.PeerToPeer NEW System.Web.ClientServices NEW RichTextBox TabControl TextBox TreeView UserControl WebBrowser DATA, XML, and LIN System.ServiceModel.Security DurableOperationAttribute NEW DurableServiceAttribute NEW IEndpointBehavior IOperationBehavior IServiceBehavior MetadataExporter MetadataImporter OperationDescription ServiceEndpoint ServiceDescription WebHttpBehavior WebScriptEnablingBehavior NEW WorkflowRuntimeBehavior NEW NetworkStream Socket TcpClient TcpListener UdpClient Message Messageueue HttpSessionState System.Web.UI Cache Button CheckBox ComboBox DataGrid DateTimePicker Form Label ListBox ListView MessageBox NumericUpDown OpenFileDialog PictureBox ProgressBar RadioButton BaseUriHelper JournalEntry NavigationWindow PageFunction<T> FormsAuthentication FormsIdentity Membership Roles System.Web.SessionState System.Web.Caching SoundPlayer System.Windows.Navigation Colors DrawingBrush ImageBrush LinearGradientBrush RadialGradientBrush WebBaseEvent System.Web.Security AuthenticationService NEW ProfileService NEW RoleService NEW System.Media System.Windows.Forms XpsSerializationManager XpsSerializationManagerAsync Content DetailsView FormView GridView LinqDataSource NEW ListView NEW LogIn Menu ObjectDataSource TreeView Wizard System.Web.Management System.Web.ApplicationServices NEW PrintDocument PrinterSettings VisualsToXpsDocument XpsDocumentWriter System.Windows.Xps.Serialization AmbientLight DiffuseMaterial DirectionalLight GeometryModel3D ModelVisual3D PerspectiveCamera SpecularMaterial System.Web.UI.WebControls NEW ApplicationManager HttpApplication HttpCookie HttpRequest HttpResponse HttpRuntime HttpServerUtility System.Drawing.Printing System.Windows.Xps System.Windows.Media.Media3D System.Windows.Media SerializerDescriptor SerializerProvider SerializerWriter DispatcherObject DispatcherTimer BlurBitmapEffect DropShadowBitmapEffect System.Windows.Media.Imaging BrowserInteropHelper HwndHost InteropBitmap WindowInteropHelper System.Windows.Markup System.Web.Hosting System.Web Bitmap Brush Color Font Icon Image Pen System.Windows.Threading System.Windows.Media.Effects System.Windows.Interop ASP.NET System.Drawing Ellipse Line Path Polygon Rectangle System.Windows.Media.Animation System.Windows.Input System.Windows.Documents.Serialization System.Windows.Shapes RotateTransform ScaleTransform SolidColorBrush ElementHost Block Bold Figure FixedDocument Floater FlowDocument Hyperlink Inline Italic List ListItem Paragraph Run Section Span Table TableCell TableColumn TableRowGroup TextPointer TextRange TextSelection Underline System.Windows.Controls.Primitives 5 3.0 Windows Forms System.Windows.Forms.Integration ObjectDataProvider XmlDataProvider System.Windows.Documents 3.0 New with the.net Framework 3.0. CF Also available in the.net Compact Framework 3.5. SL Planned for implementation in Silverlight 1.1. (Subject to change.) Fundamentals System System.AddIn.Contract NEW System.Collections.Generic IContract NEW INativeHandleContract NEW Array Boolean Byte Char Console DateTime DateTimeOffset NEW Decimal Delegate Enum Environment EventArgs Exception Int32 Int64 Math Object String TimeZoneInfo NEW Type Uri System.Diagnostics.Eventing NEW System.AddIn.Hosting NEW AddInProcess NEW AddInSecurity NEW AddInStore NEW AddInToken NEW System.Configuration AnonymousPipeClientStream NEW AnonymousPipeServerStream NEW NamedPipeClientStream NEW NamedPipeServerStream NEW PipeSecurity NEW PipeStream NEW System.IdentityModel.Claims Claim ClaimSet DirectoryEntry DirectorySearcher System.DirectoryServices.ActiveDirectory ServiceBase System.Text Encoding StringBuilder System.Security.AccessControl Builder MethodBuilder TypeBuilder AccessRule FileSecurity ObjectSecurity System.Text.RegularExpressions Regex System.Threading System.Security.Cryptography ResourceManager ECDsaCng NEW SHA1 TripleDES DataContractAttribute DataContractSerializer DataMemberAttribute ISerializable XmlDictionaryReader XmlDictionaryWriter Expression<T> NEW Expression NEW System.ServiceProcess SecureString SecurityManager System.Runtime.Serialization Iueryable<T> NEW ueryable NEW System.Linq.Expressions NEW System.IO.Compression Domain Forest WindowsIdentity System.Security System.Resources SerialPort System.Linq NEW Directory File FileStream Path Stream StreamReader StreamWriter System.DirectoryServices System.Security.Principal DataContractJsonSerializer NEW JsonReaderWriterFactory NEW System.Reflection.Emit System.IO.Ports System.IO CounterData NEW CounterSet NEW Debug EventLog EventSchemaTraceListener NEW Process Trace System.Runtime.Serialization.Json NEW FieldInfo MemberInfo MethodInfo PropertyInfo System.IO.Pipes NEW Calendar CultureInfo RegionInfo TextInfo System.Diagnostics.PerformanceData NEW Configuration System.Diagnostics ArrayList HashTable IEnumerable System.Reflection IsolatedStorage System.Globalization EventLogInformation NEW EventLogReader NEW EventLogRecord NEW EventLogWatcher NEW EventRecord NEW ProviderMetadata NEW Component TypeConverter CollectionAdapters NEW ContractBase NEW ContractHandle NEW FrameworkElementAdapters NEW System.Collections System.IO.IsolatedStorage ServicedComponent System.Diagnostics.Eventing.Reader NEW System.ComponentModel System.AddIn.Pipeline NEW System.EnterpriseServices EventDescriptor NEW EventProvider NEW EventProviderTraceListener NEW Dictionary<K,V> HashSet<T> NEW IEnumerable<T> List<T> ueue<t> Stack<T> System.Security.Cryptography.X509Certificates X509Store ReaderWriterLockSlim NEW Semaphore Thread WaitHandle System.Transactions Transaction GZipStream Additive versions of the.net Framework http://msdn.microsoft.com/netframework Part number: 098-108905 V1.1 27/ 47 plakat autorstwa firmy Microsoft Analiza biblioteki klas Ogólny schemat Base Class Library BCL.NET.NET Framework 4 Universe A selection of new types and namespaces Workflow System.WorkflowModel Activity WorkflowElement System.WorkflowServiceModel WorkflowServiceHost2 CompositeScriptReference System.Web.DynamicData DataModel DynamicControl DynamicDataManager DynamicField Axis ControllerFactory IViewEngine ViewPage Sys.Observer RouteTable Sys.Data.DataSource Chart DataTypeAttribute ChartArea DisplayFormatAttribute DataPoint RangeAttribute Legend RegularExpressionAttribute RequiredAttribute UIHintAttribute ValidationAttribute Series Sys.Binding Route System.ComponentModel.DataAnnotations System.Web.UI.WebControls Core Ajax System.Web.Routing System.Web.UI.DataVisualization.Charting Annotation ActionResult Controller Sys.UI.DataView Sys.UI.Template Sys.UI.TemplateResult BigInteger Complex System.IO.MemoryMappedFiles Web CompositionContainer ExportAttribute ImportAttribute ActiveXHost D3dImage TouchPoint TouchPointCollection TouchDevice D3dImage System.Windows.Controls WebBrowser System.Windows.Media.Effects DataGrid DatePicker PixelShader ShadeEffect Ribbon RibbonWindow LazyInit Parallel SpinLock Data System.Data.Services DataServiceException DataServiceHost IDataServiceConfigulation IDataServiceProvider EntityKey IExtendedDataRecord System.Data.Common.CommandTrees ChangeInterceptorAttribute DataService CompensationFlowAttribute WorkflowInstanceContext System.WorkflowModel.Activities.Rules System.Data AtomPub10ServiceDocumentFormatter System.WorkflowServiceModel.Dispatcher XamlProperty System.ServiceModel.Channels VisualStateGroup VisualStateManager StateMachine XamlType Service.Document VisualState Sequence XamlWriter System.ServiceModel.Syndication System.Windows Effect Persist XamlReader DbCommandTree DbExpression DbExpressionBuilder DbueryCommandTree System.Data.Common ISynchonizationProvider DataServiceKeyAttribute ueryinterceptorattribute DbCommandDefinition DbProviderServices System.Data.Services.Provider IDataServicesProvider System.Data.Services.Client System.ServiceModel Calendar ServiceOperation TypeIdentifierAttribute System.Threading Communications System.Windows.Controls System.Windows.Media.Imaging SendMessage RuleSet System.Windows.Input System.Windows.Interop ReceiveMessage Flowchart System.Collections.Concurrent System.Xaml Client ClientOperation DbUpdate System.Runtime.Interop.Services System.Linq ParallelEnumerable Dbuery TrackingProfile SortedSet CompensationScope System.WorkflowModel.Tracking System.Collections.Generic System.ComponentModel.Composition EntityDataSource System.Threading.Tasks System.Numerics System.WorkflowServiceModel.Activities System.WorkflowModel.Activities System.Web.Mvc System.Web.UI EntitySqlParser System.Data.Objects Compileduery ObjectContext OperationContact DataServiceRequest ObjectParameter Service DataServiceResponse Objectuery ServiceContract ObjectStateManager CorrelationOperationBehavior System.ServiceModel.Discovery DataServiceContext DataServiceuery System.Data.Metadata.Edm System.Data.EntityClient EntityCommand ComplexType AnnouncementService EntityConnection EdmType DiscoveryClient EntityDataReader EntityType ServiceDiscoveryBehavior EntityTransaction RelationshipType AnnouncementClient The award winning Addison-Wesley Microsoft.NET Development Series provides professional developers with the most comprehensive and practical coverage of the latest.net technologies. To discover more go to informit.com/msdotnetseries. _300 Forewords by Miguel de Icaza and Anders Hejlsberg Microsoft Programming An instant classic. From the Foreword by Miguel de Icaza Principal Group Program Manager, Developer Division, Microsoft Second Edition Adam Calderon and Joel Rumerman first review the core Microsoft AJAX Library and JavaScript techniques needed to support a rich clientside experience. Next, they build upon these techniques showing how to create distributable AJAX-enabled controls that include rich browserindependent JavaScript client-side functionality. The authors thoroughly explain both the JavaScript and.net aspects of control development and how these two distinct environments come together to provide a foundation for building a rich user experience using ASP.NET AJAX. Create object-oriented cross-browser JavaScript that supports.net style classes, interfaces, inheritance, and method overloading Work with components, behaviors, and controls, and learn how they relate to DOM elements Learn Sys.Application and the part it plays in object creation, initialization, and events in the Microsoft AJAX Library Build Extender and Script controls that provide integrated script generation for their corresponding client-side counterparts Don Box Architect, Microsoft John Montgomery Principal Group Program Manager, Developer Division, Microsoft This foremost series on.net contains vital information for developers who need to get the most out of the.net Framework. Our authors are selected from the key innovators who create the technology and are the most respected practitioners of it. From the Foreword by Craig Mundie, Chief Research and Strategy Officer, Microsoft Corporation Author Joe Duffy has risen to the challenge of explaining how to write software that takes full advantage of concurrency and hardware parallelism. In Concurrent Programming on Windows, he explains how to design, implement, and maintain large-scale concurrent programs, primarily using C# and C++ for Windows. Advanced ASP.NET AJAX Server Controls Duffy aims to give application, system, and library developers the tools and techniques needed to write efficient, safe code for multicore processors. This is important not only for the kinds of problems where concurrency is inherent and easily exploitable such as server applications, compute-intensive image manipulation, financial analysis, simulations, and AI algorithms but also for problems that can be speeded up using parallelism but require more effort such as math libraries, sort routines, report generation, XML manipulation, and stream processing algorithms. For.NET Framework 3.5 Concurrent Programming on Windows has four major sections: The first introduces concurrency at a high level, followed by a section that focuses on the fundamental platform features, inner workings, and API details. Next, there is a section that describes common patterns, best practices, algorithms, and data structures that emerge while writing concurrent software. The final section covers many of the common system-wide architectural and process concerns of concurrent programming. This is the only book you ll need in order to learn the best practices and common patterns for programming with concurrency on Windows and.net. Group Program Manager, Microsoft Don Box Architect, Microsoft John Montgomery Principal Group Program Manager, Developer Division, Microsoft This foremost series on.net contains vital information for developers who need to get the most out of the.net Framework. Our authors are selected from the key innovators who create the technology and are the most respected practitioners of it. Brad Abrams Adam Calderon Joel Rumerman Group Program Manager, Microsoft ISBN-13: 978-0-321-43482-1 ISBN-10: 0-321-43482-X Cover photograph by istockphoto.com 5 4 9 9 9 Text printed on recycled paper 9 Microsoft Programming Whether this is the first time or the fifty-first time you re using WCF, you ll learn something new by reading this book. Allen, Program Manager, Web Services, Microsoft Windows Communication Foundation (WCF) is the easiest way to produce and consume Web services on the Microsoft platform. With.NET 3.5, WCF has been extensively revamped and Visual Studio 2008 gives developers powerful new tools for utilizing it. Essential Windows Communication Foundation shows developers exactly how to make the most of WCF with.net 3.5 and Visual Studio 2008. Concurrent Programming on Windows Drawing on extensive experience working with early adopters, three Microsoft insiders systematically address the topics developers ask about WCF. The authors approach each subject with practical advice and present best practices, tips, and tricks for solving problems. Throughout, you ll find detailed explanations, solutions for the pain points of WCF development, and an extensive collection of reusable code examples. Coverage includes www.informit.com/msdotnetseries Cover photograph by PhotoLink/Getty Images, Inc. Includes FREE 45-Day Online Edition Development Series Development Series Using WCF contracts to define complex structures and interfaces Understanding WCF s channel stacks and channel model architecture Configuring the WCF communication stack to use only the protocols you need Using standard and custom service behaviors to manage concurrency, instances, transactions, and more Serializing data from.net types to XML Infosets and representing Infosets on the wire Hosting WCF services via IIS, managed.net applications, and Windows Activation Services WCF security, in depth: authentication; transport and message-level security; and Internet and intranet scenarios Improving reliability: exception handling, diagnostics, and more Workflow services: new integration points between WCF 3.5 and Windows Workflow Foundation Building client-to-client, peer network-based applications Utilizing WCF for non-soap Web services: AJAX and JSON examples and.net 3.5 hosting classes This series is a great resource for developers using the.net Framework and Web services. It covers all the bases from reference to how-to. The books in this series are essential reading for developers who want to write solid managed code. John Montgomery Director, Developer Platform and Evangelism Division, Microsoft Corporation This series is supported by the leaders and principal authorities of the Microsoft.NET Framework and its languages. It has an author pool that combines some of the most insightful authors in the industry with the software architects and developers at Microsoft. Microsoft s Steve Resnick, Richard Crane, and Chris Bowen are technology experts at the Microsoft Technology Center in Boston. They specialize in helping customers improve their technical agility by applying WCF and related technologies. Resnick has specialized in Internet technologies and distributed computing at Microsoft since 1995. He is a frequent speaker at Microsoft events and is now technology director for the U.S. Microsoft Technology Centers. Crane has more than 15 years of experience in senior software development roles. He specializes in large-scale Web sites, distributed computing, transactional systems, and performance analysis. Bowen has been an architect and developer for more than 15 years at companies such as Monster.com and Staples and is co-author of Professional Visual Studio 2005 Team System. Joe Duffy 780321 434821 Don Box Architect, Microsoft Corporation Foreword by Steve Maine, Program Manager, Microsoft Programming/C# Windows Communication Foundation, Microsoft 5 4 9 9 9 From the Foreword by Don Box The popular C# programming language combines the high productivity of rapid application development languages with the raw power of C and C++. Now, C# 3.0 adds functional programming techniques and LIN, Language INtegrated uery. The C# Programming Language, Third Edition, is the authoritative and annotated technical reference for C# 3.0. Written by Anders Hejlsberg, the language s architect, and his colleagues, Mads Torgersen, Scott Wiltamuth, and Peter Golde, this volume has been completely updated and reorganized for C# 3.0. The book provides the complete specification of the language, along with descriptions, reference materials, code samples, and annotations from nine prominent C# gurus. For.NET Framework 3.5 The many annotations a new feature in this edition bring a depth and breadth of understanding rarely found in any programming book. As the main text of the book introduces the concepts of the C# language, cogent annotations explain why they are important, how they are used, how they relate to other languages, and even how they evolved. Development Series This book is the definitive, must-have reference for any developer who wants to understand C#. Anders Hejlsberg is a programming legend. He is the architect of the C# language and a Microsoft Technical Fellow. He joined Microsoft Corporation in 1996, following a thirteen-year career at Borland, where he was the chief architect of Delphi and Turbo Pascal. Mads Torgersen is the Program Manager for the C# Language at Microsoft and runs the C# design meetings. Prior to joining Microsoft in 2005, he was an associate professor at the University of Aarhus, doing programming language research. 780321 440068 $49.99 U.S./$54.99 CANADA Don Box Architect, Microsoft John Montgomery Principal Group Program Manager, Developer Division, Microsoft This foremost series on.net contains vital information for developers who need to get the most out of the.net Framework. Our authors are selected from the key innovators who create the technology and are the most respected practitioners of it. Essential C# 3.0 is an extremely well-written and well-organized no-fluff guide to C# 3.0, which will appeal to programmers at all levels of experience with C#. This fully updated edition dives deep into the new features that are revolutionizing programming, with brand new chapters covering query expressions, lambda expressions, extension methods, collection interface extensions, standard query operators, and LIN as a whole. Brad Abrams Group Program Manager, Microsoft Before leaving Microsoft, Peter Golde was the lead developer of the C# compiler. Steve Resnick Richard Crane Chris Bowen ISBN-13: 978-0-321-56299-9 ISBN-10: 0-321-56299-2 Cover photograph by istockphoto.com 5 4 4 9 9 The C# Programming Language Author Mark Michaelis covers the C# language in depth, and each important construct is illustrated with succinct, relevant code examples. (Complete code examples are available online.) Graphical mind maps at the beginning of each chapter show what material is covered and how each topic relates to the whole. Topics intended for beginners and advanced readers are clearly marked. From the Foreword by Charlie 780321 562999 C# primitive data types, value types, reference types, type conversions, and arrays Operators and control flow, loops, conditional logic, and sequential programming Methods, parameters, exception handling, and structured programming Classes, inheritance, structures, interfaces, and object-oriented programming Well-formed types, operator overloading, namespaces, and garbage collection Don Box Architect, Microsoft This is a great resource for professional.net developers. It covers all bases, from expert perspective to reference and how-to. Books in this series are essential reading for those who want to judiciously expand their knowledge base and expertise. John Montgomery Generics, collections, custom collections, and iterators Principal Group Program Manager, Developer Division, Microsoft Delegates and lambda expressions Standard query operators and query expressions LIN: language integrated query Reflection, attributes, and declarative programming Threading, synchronization, and multithreaded patterns Interoperability and unsafe code The Common Language Infrastructure that underlies C# This foremost series on.net contains vital information for developers who need to get the most out of the.net Framework. Our authors are selected from the key innovators who create the technology and are the most respected practitioners of it. Anders Hejlsberg Mads Torgersen Scott Wiltamuth Peter Golde For.NET Framework 3.5 Group Program Manager, Microsoft Mark Michaelis is a software architect and trainer at Itron and IDesign and is the founder of intellitechture. He is a Microsoft Regional Director and serves on several Microsoft software design review teams, including C#. Mark holds a B.A. in philosophy from the University of Illinois and an M.S. in computer science from the Illinois Institute of Technology. informit.com/msdotnetseries mark.michaelis.net/essentialcsharp Essential C# 3.0 Brad Abrams Whether you are just starting out as a programmer, are an experienced developer looking to learn C#, or are a seasoned C# programmer interested in learning the new features of C# 3.0, Essential C# 3.0 gives you just what you need to quickly get up and running writing C# applications. IDesign ISBN-13: 978-0-321-53392-0 ISBN-10: 0-321-53392-5 5 4 9 9 9 Text printed on recycled paper $44.99 U.S. $48.99 CANADA Calvert, Community Program Manager, Visual C#, Microsoft Supported by the leaders and principal authorities of core Microsoft technologies, this series has an author pool that combines some of the most insightful authors in the industry with the lead software architects and developers at Microsoft and the developer community at large. Following an introduction to C#, readers learn about Third Edition Cover photograph by istockphoto.com 9 $49.99 U.S. $54.99 CANADA 0321514440 If you want to be a C# developer, or if you want to enhance your C# programming skills, there is no more useful tool than a well-crafted book on the subject. You are holding such a book in your hands. C# Supported by the leaders and principal authorities of core Microsoft technologies, this series has an author pool that combines some of the most insightful authors in the industry with the lead software architects and developers at Microsoft and the developer community at large. This is a great resource for professional.net developers. It covers all bases, from expert perspective to reference and how-to. Books in this series are essential reading for those who want to judiciously expand their knowledge base and expertise. Scott Wiltamuth is Partner Program Manager for Visual Studio. While at Microsoft, he has worked on a wide range of developer-oriented projects, including Visual Basic, VBScript, JScript, Visual J++, and Visual C#. Text printed on recycled paper 9 Special Annotated Edition for C# 3.0 Based on my own experience, I can safely say that every.net developer who reads this will have at least one aha moment and will be a better developer for it. Essential Windows Communication Foundation informit.com/msdotnetseries ISBN-13: 978-0-321-44006-8 ISBN-10: 0-321-44006-4 Text printed on recycled paper Michaelis Joe Duffy is the development lead, architect, and founder of the Parallel Extensions to the.net Framework team at Microsoft. In addition to hacking code and managing a team of developers, he works on long-term vision and incubation efforts, such as language and type system support for concurrency safety. He previously worked on the Common Language Runtime team. Joe blogs regularly at www.bluebytesoftware.com/blog. informit.com/msdotnetseries 5 4 9 9 9 780321 514448 Hejlsberg Torgersen Wiltamuth Golde ISBN-13: 978-0-321-51444-8 ISBN-10: 0-321-51444-0 9 $49.99 U.S. $54.99 CANADA 0321545613 Mundie, Chief Research and Strategy Officer, Microsoft Nicholas Supported by the leaders and principal authorities of core Microsoft technologies, this series has an author pool that combines some of the most insightful authors in the industry with the lead software architects and developers at Microsoft and the developer community at large. This is a great resource for professional.net developers. It covers all bases, from expert perspective to reference and how-to. Books in this series are essential reading for those who want to judiciously expand their knowledge base and expertise. Brad Abrams Includes Free 45-Day Online Edition Text printed on recycled paper Resnick Crane Bowen Cover photograph by Douglas Peebles/CORBIS Foreword by Craig the importance of clean architecture and design is critical... This places an emphasis on understanding not only the platform s capabilities but also emerging best practices. Joe does a great job interspersing best practices alongside theory throughout his book. Supported by the leaders and principal authorities of core Microsoft technologies, this series has an author pool that combines some of the most insightful authors in the industry with the lead software architects and developers at Microsoft and the developer community at large. This is a great resource for professional.net developers. It covers all bases, from expert perspective to reference and how-to. Books in this series are essential reading for those who want to judiciously expand their knowledge base and expertise. Localize ASP.NET AJAX controls including client script Discover ASP.NET AJAX client and server communication architecture and the new support for Windows Communication Foundation (WCF) Understand ASP.NET AJAX Application Services Create custom Application Services Design controls for a partial postback environment Understand the AJAX Control Toolkit architecture and the many features it provides Develop highly interactive controls using the AJAX Control Toolkit Understand AJAX Control Toolkit architecture and build controls that utilize the toolkit Adam Calderon is the Application Development Practice Lead at InterKnowlogy and a Microsoft MVP. He has been involved with ASP.NET AJAX since the Alpha release, participated in the ATLAS First Access program, and is a member of the Microsoft UI Server Frameworks Advisory Council where he contributes to the future direction of the ASP.NET platform. Adam is also heavily involved in the development community; he has taught classes at UCSD and has spoken at TechEd, user groups, and Code Camps throughout southern California. Joel Rumerman, Senior.NET Developer at The CoStar Group, develops line-of-business applications that rely heavily on ASP.NET AJAX. He s an expert with JavaScript and an ASP.NET programmer who has been involved with ASP.NET AJAX since it was codenamed Atlas. Joel is currently working on a large scale Virtual Earth mash-up that plots commercial real estate information. Krzysztof Cwalina Brad Abrams Duffy $49.99 U.S. $54.99 CANADA Microsoft Programming/Concurrent Programming Foreword by Nikhil Kothari, When you begin using multi-threading throughout an application, Software Architect,.NET Developer Platform, Microsoft Microsoft Programming/ASP.NET ASP.NET AJAX server controls can encapsulate even the most powerful AJAX functionality, helping you build more elegant, maintainable, and scalable applications. This is the first comprehensive, code-rich guide to custom ASP.NET AJAX server controls for experienced ASP.NET developers. Unlike other books on ASP.NET AJAX, this book focuses solely on server control development and reflects the significant improvements in ASP.NET 3.5 AJAX and the latest Visual Studio 2008 features for streamlining AJAX development. Framework Design Guidelines Conventions, Idioms, and Patterns for Reusable.NET Libraries informit.com/msdotnetseries 5 4 9 9 9 780321 545619 Essential C# 3.0 Architect, Microsoft John Montgomery ISBN-13: 978-0-321-54561-9 ISBN-10: 0-321-54561-3 9 Essential Windows Communication Foundation Don Box A companion DVD includes the Designing.NET Class Libraries video series, instructional presentations by the authors on design guidelines for developing classes and components that extend the.net Framework. A sample API specification and other useful resources and tools are also included. Calderon Rumerman Text printed on recycled paper Cwalina Abrams informit.com/msdotnetseries Cover photograph by Getty Images, Inc. The C# Programming Language Third Edition Supported by the leaders and principal authorities of core Microsoft technologies, this series has an author pool that combines some of the most insightful authors in the industry with the lead software architects and developers at Microsoft and the developer community at large. This is a great resource for professional.net developers. It covers all bases, from expert perspective to reference and how-to. Books in this series are essential reading for those who want to judiciously expand their knowledge base and expertise. Guidelines for and examples of common framework design patterns Brad Abrams is the Product Unit Manager of the Application Framework team at Microsoft. He was the primary author of the.net Framework Design Guidelines, the Common Language Specification, and the class libraries for the ECMA CLI specification. Concurrent Programming on Windows The general philosophy and fundamental principles of framework design Naming guidelines for the various parts of a framework Guidelines for the design and extending of types and members of types Issues affecting and guidelines for ensuring extensibility How (and how not ) to design exceptions Framework Design Guidelines, Second Edition, is the only definitive source of best practices for managed code API development, direct from the architects themselves. Krzysztof Cwalina is a Principal Program Manager in the.net Application Frameworks Core group at Microsoft. He was responsible for the design of a large part of the Framework APIs, and for the development of the.net Framework Design Guidelines. Advanced ASP.NET AJAX Server Controls Guidelines in this book are presented in four major forms: Do, Consider, Avoid, and Do not. These directives help focus attention on practices that should always be used, those that should generally be used, those that should rarely be used, and those that should never be used. Every guideline includes a discussion of its applicability, and most include a code example to help illuminate the dialogue. Framework Design Guidelines Second Edition Framework Design Guidelines, Second Edition, teaches developers the best practices for designing reusable libraries for the Microsoft.NET Framework. Expanded and updated for.net 3.5, this new edition focuses on the design issues that directly affect the programmability of a class library, specifically its publicly accessible APIs. This book can improve the work of any.net developer producing code that other developers will use. It includes copious annotations to the guidelines by thirty-five prominent architects and practitioners of the.net Framework, providing a lively discussion of the reasons for the guidelines as well as examples of when to break those guidelines. Microsoft architects Krzysztof Cwalina and Brad Abrams teach framework design from the top down. From their significant combined experience and deep insight, you will learn 9 780321 533920 Mark Michaelis $49.99 U.S. $54.99 CANADA 032143482X 0321440064 Visit Safaribooksonline.com for early access to Rough Cuts of forthcoming.net titles. 0321562992 0321533925 0321577841 0321604741 0321562313.NET 4 Poster Compliments of the.net Development Team and V1.1 28/ 47 plakat autorstwa firmy Addison-Wesley

Analiza biblioteki klas Kilka klas z przestrzeni System Przestrzeń nazw System System.CodeDom System.ComponentModel System.Collections, System.Configuration System.IO System.Text System.TextRegular Krótki opis Zawiera klasy definiujące najczęściej używane typy danych, zdarzenia i obsługę zdarzeń a także interfejsy, atrybuty oraz wyjątki Reprezentacja dokumentu/kodu źródłowego w postaci drzewa Tworzenie komponentów, kontrolek, rejestracja oraz adaptacja Różne kolekcje obiektów min.: listy, kolejki, tablice bitów, tablice skrótów i słowniki Dostęp do ustawień konfiguracyjnych.net i podzespołów oraz obsługa błędów w plikach konfiguracyjnych (pliki * config) Podstawowy dostęp i zarządzanie strumieniami danych Kodowanie i konwersje znaków, manipulacje łańcuchami znaków Obsługa wyrażeń regularnych V1.1 29/ 47 Budowa podzespołu Assemblies, czyli podzespoły /Assemblies (podzespół/zestaw/podzespoły/zestawy) Podzespół to logiczny blok, skompilowany do kodu pośredniego. Z tych elementów budowane są aplikacje.net, zawierają one kod w języku IL oraz metadane. Podzespół opatrzony jest numerem wersji i jest on zamkniętą spójną całością udostępniającym określoną funkcjonalność. Istnieją dwa rodzaje metadanych: w pierwszym podzespół jest traktowany jako jednostka i jest to tzw. manifest oraz metadane przeznaczone do opisu poszczególnych typów zawartych w podzespole. Manifest jest częścią podzespołu i opisuje jego kod i zasoby poprzez podanie: nazwy (tzw. tożsamości) podzespołu, numer wersji oraz tzw. opisu kultury (informacje regionalne oraz informacje o językach obsługiwanych przez dany podzespół), podpisu cyfrowego dla podzespołu, pliki zawarte w podzespole, typy i zasoby zawarte w podzespole wraz z informacją które typy/zasoby są dostępne do użycia przez inne podzespoły, powiązania z innymi podzespołami, uprawnienia które są wymagane do poprawnej pracy podzespołu. V1.1 30/ 47 Budowa podzespołu Assemblies, czyli podzespoły Metadane typów zawierają opis typów zdefiniowanych w kodzie zarządzanym. Zawarte są w tym samym pliku co kod IL, zawierają min: 1. Opis typów: nazwa typu, zasięg typu (publiczny bądź ograniczony do podzespołu) nazwę typu po którym typ dziedziczy, interfejsy zaimplementowane, metody zaimplementowane, właściwości typu, zdarzenia obsługiwane przez typ. 2. Opis atrybutów atrybuty posiadają określone nazwy i funkcje określone w środowisku.net, określają sposób wykonywania kodu bądź opisują wymagania co do bezpieczeństwa. Source1.cs class A... class B... Source2.cs class C... class D... csc Source1.cs Source2.cs Program.exe manifest metadata IL of type A IL of type B IL of type C IL of type D class loader V1.1 31/ 47 Budowa podzespołu Assemblies, czyli podzespoły Ważne elementy związane z podzespołami to: 1. po kompilacji do kodu IL, kod zarządzany jest częścią podzespołu składającego się z jednego bądź wielu plików DLL/EXE, 2. podzespoły mogą być określone jako prywatne bądź współdzielony umieszczone są w GAC (Global Cache), 3. podzespół może zostać podpisany kluczem cyfrowym (sygnaturą) oraz opatrzony 4. informacje o prywatnym podzespole nie są wprowadzane do platformy.net (rejestr nie jest modyfikowany), 5. podzespoły w katalogu aplikacji nie wymagają dodatkowych operacji, 6. współużytkowanie podzespoły są umieszczene w GAC, 7. podzespół może mieć tzw. silną nazwę (podpis/sygnatura cyfrowa) weryfikowana podczas ładowania podzespołu lub słabą nazwę, 8. wersja podzespołu w postaci G.D.K.K (główny/major, drugorządny/minor, kompilacji/compilation, korekty/revision) np.: 3.0.1240.2. 9. wersja informacyjna, czyli ciąg znaków czytelnych dla ludzi, 10. numery wersji podzespołów od których zależy dany podzespół. V1.1 32/ 47

Budowa podzespołu Model podzespołu (assembly model) Manifest jest zapisany w sekcji metadanych zawierający tzw. moduł master, który może lecz nie jest wymagane aby opisywał również typy. 1 Podzespół to pojedyncza/jednolita jednosta w aplikacji zawieracjace klasy, numery wersji oraz opis bezpieczeństwa. Pliki podzespołów (exe, dll) pełnią rolę podobną jak pliki JAR w przypadku Javy lub starsze w formacie MS CAB. Static «use» 1 Type Metadata Manifest Metadata Element 1.. * 1.. * 1 1.. *.NET «use» Module Type Code 1.. * Dynamic (Created in Memory) W formacie Portable Executable (PE), pojęcia "Moduł" oraz "Plik PE" są stosowane wymiennie. Stosowane są rozszerznia.exe,.dll,.netmodule. 1.. * 0..1 1 * * Resource X509Certificate Dependencies Machine Code CIL Text Image Public (Shared) Private publickey * Global Registers 1 Cache 1 Moduły oraz zasoby (np.: pliki PNG badz JPG) sa logicznie przypisane podzespołom, fizycznie również tego typu pliki moga znajdować się plikach assembly. Jednak w wielu przypadkach, z praktycznych powodów (np.: wielkość plików) pliki tego typu nie są umieszczane w podzespołach. Istnieja tylko odniesienia do zasobów umieszczeone w manifescie podzespołu. Takie rozwiązanie przyspiesza ładowanie podzespoły natomiast dostęp do zasobów jest uzyskiwany w tzw. trybie leniwych obliczeń. V1.1 33/ 47 Język pośredni Język pośredni / Kod zarządzany Język pośredni lub wspólny język pośredni (ang. Common Intermediate Language CIL) to język niskiego poziomu dla platformy.net. Stanowi on odpowiednik assemblera dla języków wysokiego poziomu jak C/C++. Ogólnie CIL jest podobny do assemblera, jednak został on wyposażony w konstrukcje programowania obiektowego i nie jest wykonywany przez stosową maszynę wirtualną ale kompilowany przez JIT/ngen do kodu maszynowego. Kod zarządzany, to kod zgodny ze specyfikacją CLR (CLS) zawiera również metadane. W ten sposób umożliwia się realizację: usług automatycznego zarządzania zasobami, współpracy fragmentów/podzespołów oprogramowania napisanych w różnych językach programowania, zarządzania uprawnieniami w dostępie do podzespołu oraz ułatwia zarządzanie cyklem życia obiektów (min. system odśmiecający garbage collector). MSIL czy IL Początkowo język pośredni nazywał Microsoft Intermediate Language (MSIL), jednak po procedurze standaryzacji C# oraz CLI obowiązująca nazwa to CIL lub IL. V1.1 34/ 47 Kompilacja i wykonywanie programów IL Kompilacja i wykonywanie programów IL Diagram kompilacji i wykonania: Source Code Ogólne podejście do kompilacji: Compiler C# Source File VB Source File other.net Source File EXE/DLL Kompilacja C# Compiler VB.NET Compiler other.net Compiler IL and Metadata - CIL - Type Info - CIL - Type Info - CIL - Type Info Class Libraries IL and Metadata Class Loader JIT Compiler Common Language Runtime (CLR) Run time JIT Compiler [optional verification] Trusted pre- JITed code. Native Code Native Code Native Code Operating System Managed Native Code Execution Class to an uncompiled method/class Security Checks Runtime Engine V1.1 35/ 47 Kompilacja i wykonywanie programów IL Podział instrukcji IL Instrukcje kodu bajtowego CIL można podzielić na następujące grupy: 1. Wczytaj i Zapisz Load and store 2. Arytmetyczne Arithmetic 3. Konwersji typów Type conversion 4. Tworzenia i manipulacji obiektami Object creation and manipulation 5. Instrukcje zarządzania stosem Operand stack management (push / pop) 6. Instrukcje sterujące Control transfer (branching) 7. Wywołania metody i powrotu Method invocation and return 8. Zgłaszania sytuacji wyjątkowej Throwing exceptions 9. Realizujące współbieżność Monitor-based concurrency V1.1 36/ 47

Przykład pusty program Kod w IL, nie wykonuje żadnych istotnych czynności:.assembly hello1 {.class hello1 {.method static public void main() il managed {.entrypoint ret Instrukcje.entrypoint a ret stanowią w pewnym sensie odpowiednik funkcji main. V1.1 37/ 47 Przykład wyświetlenie komunikatu Kod w IL, wyświetla komunikat tekstowy:.assembly hello2 {.class hello2 {.method static public void main() il managed {.entrypoint ldstr "Witojcie!!!" call void [mscorlib]system.console::writeline(class System.String) ret Można powiedzieć, że assembler IL to assembler obiektowy. V1.1 38/ 47 Odczytanie liczby całkowitej i wyświetlenie jej na ekranie.assembly hello3 {.method public static void Main() il managed {.entrypoint.maxstack 2.locals (int32 V_0) ldstr "Liczba calkowita int32:" call void [mscorlib]system.console::writeline(string) call string [mscorlib]system.console::readline() call int32 [mscorlib]system.int32::parse(string) stloc.0 ldstr "Wpisano liczbe {0." ldloc.0 box [mscorlib]system.int32 call void [mscorlib]system.console::writeline(string, object) ret Jednak bez klas też można tworzyć programy w IL u. V1.1 39/ 47 Porównanie dwóch liczb całkowitych.assembly big_and_small_nums {.method public static void Main() il managed {.entrypoint.maxstack 2.locals init (int32 V_0, int32 V_1) IL_0000: ldstr "Podaj pierwsza liczbe" IL_0005: call void [mscorlib]system.console::writeline(string) IL_000a: call string [mscorlib]system.console::readline() IL_000f: call int32 [mscorlib]system.int32::parse(string) IL_0014: stloc.0 IL_0015: ldstr "I jeszcze druga" IL_001a: call void [mscorlib]system.console::writeline(string) IL_001f: call string [mscorlib]system.console::readline() IL_0024: call int32 [mscorlib]system.int32::parse(string) IL_0029: stloc.1 IL_002a: ldloc.0 IL_002b: ldloc.1 IL_002c: bne.un.s IL_003a IL_002e: ldstr "Obie wielkosci sa rowne" IL_0033: call void [mscorlib]system.console::writeline(string) IL_0038: br.s IL_0054 IL_003a: ldloc.0 IL_003b: ldloc.1 IL_003c: bge.s IL_004a IL_003e: ldstr "Druga liczba jest wieksza niz pierwsza" IL_0043: call void [mscorlib]system.console::writeline(string) IL_0048: br.s IL_0054 IL_004a: ldstr "Druga liczba jest mniejsza niz pierwsza" IL_004f: call void [mscorlib]system.console::writeline(string) IL_0054: ldstr "Nacisnij Enter aby zakonczyc program" call void [mscorlib]system.console::writeline(string) call string [mscorlib]system.console::readline() IL_0059: pop IL_005a: ret V1.1 40/ 47

Porównanie dwóch liczb całkowitych using System; namespace Test1a { class Program { public static void Main(string[] args) { Console.WriteLine("Podaj pierwsza liczbe"); int x = Int32.Parse( Console.ReadLine() ); Console.WriteLine("I jeszcze druga"); int y = Int32.Parse( Console.ReadLine() ); if ( x == y ) { Console.WriteLine("Obie wielkosci sa rowne"); else { if ( x < y ) { Console.WriteLine("Druga liczba jest wieksza niz pierwsza"); else { Console.WriteLine("Druga liczba jest mniejsza niz pierwsza"); Console.WriteLine("Nacisnij Enter aby zakonczyc program"); Console.ReadLine(); V1.1 41/ 47 Definicja metod.assembly extern mscorlib {.assembly Methods {.ver 1:0:1:0.module Methods.exe.method static void main() cil managed {.maxstack 2.entrypoint ldc.i4 15 ldc.i4 27 call int32 SumCalculate(int32, int32) call void WriteNum(int32) ret.method public static int32 SumCalculate (int32, int32 ) cil managed {.maxstack 2 ldarg.0 ldarg.1 add ret.method public static void WriteNum(int32) cil managed {.maxstack 2 ldstr "Wartosc argumentu: " call void [mscorlib]system.console::write(string) ldarg.0 call void [mscorlib]system.console::write(int32) ret V1.1 42/ 47 Od C# przez IL do assemblera Intel x86/x64 IL source Source code in C# Vector2D v; v = new Vector(); v.x = 10; v.y = 20; Source code in Intel x86_32 assembly call ED00AAD1h mov ecx, eax call dword ptr ds:[00af0012h] mov dword ptr [ecx+4], 000Ah mov dword ptr [ecx+8], 0014h.locals init ([0] class Vector2D v) newobj instance void Vector2D::.ctor() stloc.0 ldloc.0 ldc.i4 0x0A stfld int32 Vector2D::x ldloc.0 ldc.i4 0x14 stfld int32 Vector2D::y V1.1 43/ 47 Tabela instrukcji wybór Tabela instrukcji wybór Opcode Instrukcja Opis 0x58 add Add two values, returning a new value 0xD6 add.ovf Add signed integer values with overflow check 0xD7 add.ovf.un Add unsigned integer values with overflow check 0x3E ble <int32 (target)> Branch to target if less than or equal to 0x8C box <typetok> Convert a boxable value to its boxed form 0x38 br <int32 (target)> skok do etykiety target 0x2B br.s <int8 (target)> j.w. krótka forma 0x01 break Inform a debugger that a breakpoint has been reached 0x28 call <method> Call method described by method 0xFE 0x02 cgt Push 1 (of type int32) if value1 > value2, else push 0 0xC3 ckfinite Throw ArithmeticException if value is not a finite number 0x73 newobj <ctor> Allocate an uninitialized object or value type and call ctor 0x04 ldarg.2 Load argument 2 onto the stack 0x11 ldloc.s <uint8 (indx)> Load local variable of index indx onto stack, short form 0xFE 0x0D ldloca <uint16 (indx)> Load address of local variable with index indx 0x62 shl Shift an integer left (shifting in zeros), return an integer 0x63 shr Shift an integer right (shift in sign), return an integer 0x7A throw Zgłoszenie wyjątku 0x79 unbox <valuetype> Extract a value-type from obj, its boxed representation 0xFE 0x13 volatile. [prefix] Subsequent pointer reference is volatile 0x61 xor Bitwise XOR of integer values, returns an integer V1.1 44/ 47

Tabela instrukcji wybór Język pośredni podsumowanie Czy warto poznawać assembler IL? Tak, choć naturalnie tworzenie dużych programów raczej mija się z celem, jednak poznanie zagadnień związanych z IL - asm na pewno przyczyni się do pogłębienia wiedzy o wewnętrznych mechanizmach CLR oraz CLI. Co jest szczególne ważne, jeśli planuje się tworzenie własnego kompilatora do platformy.net. V1.1 45/ 47 Już za tydzień na wykładzie W następnym tygodniu między innymi Wykład Programowanie w C# środowisko Visual Studio 2010, MonoDevelop, syntaktyka C#, wyjątki, współpraca z DLL, 1. przegląd narzędzi dla programistów w platformie.net, min. ildasm, gacutil, 2. podstawowe informacje o C# 3. pojęcie klasy, 4. podstawowe informacje wejścia/wyjścia 5. tablice, ciągi znaków, wyrażenia regularne, 6. współpraca z kodem niezarządzanym, V1.1 46/ 47 Już za tydzień na wykładzie Proponowane tematy prac pisemnych: 1. analiza i porównanie bibliotek standardowych dla języka Java oraz platformy.net, 2. różnice pomiędzy IL dla platformy.net a językiem pośrednim dla maszyny wirtualnej JAVA, 3. opis technicznej struktury oraz roli podzespołów. Dziękuje za uwagę!!! V1.1 47/ 47