=> 0
Programiranje C# 4.0 - Ian Griffiths, Matthew Adams i Jesse Liberty

Programiranje C# 4.0 - Ian Griffiths, Matthew Adams i Jesse Liberty

338,00 kn

autor: Ian Griffiths, Matthew Adams i Jesse Liberty
broj stranica: 856
godina izdanja: 2011
vrsta uveza:
dimenzije knjige širina i visina: 168 x 235 mm
jezik: hrvatski


S podrškom za dinamičko programiranje, C# 4.0 nastavlja evoluciju kao samostalan višenamjenski jezik. Ali, kada se C# koristi s .NET Frameworkom 4, nastaje iznimno moćna kombinacija. Ovaj priručnik za C# pokazat će vam kako da programirate stolne, Web i bogate internetske aplikacije korištenjem jezika C# 4.0 u kombinaciji s mogućnostima za rad s bazama podataka, kosturom za razvoj korisničkih sučelja (Windows Presentation Foundation, WPF), širokim rasponom komunikacijskih servisa (Windows Communications Foundation, WCF) i drugim. U šestom izdanju jedne od najpopularnijih knjiga za C#, stručnjaci za .NET Ian Griffiths, Matthew Adams i Jesse Liberty obrađuju osnovne mogućnosti jezika i kostura te najnovija unaprjeđenja jezika C#. Naučit ćete istodobno programiranje na jeziku C# 4.0 i kako koristiti .NET alate kao što su Entity Framework za jednostavniji pristup podacima i platforma Silverlight za razvoj RIA aplikacija koje se koriste iz Web preglednika. Naučit ćete osnove programskog jezika C# kao što su varijable, kontrola toka, petlje i metode; gradit ćete složene programe koristeći objektno orijentirane tehnike i tehnike funkcionalnog programiranja; obrađivati velike količine podataka pomoću izvornih značajki za upite u LINQ-u; komunicirati preko mreže koristeći Windows Communication Foundation (WCF); naučiti prednosti koje nude značajke za dinamičko programiranje na jeziku C# 4.0; gradit ćete interaktivne Windows aplikacije koristeći Windows Presentation Foundation (WPF); razvijat ćete bogate internetske aplikacije koristeći Silverlight i ASP.NET. Knjiga izlazi iz tiska u lipnju 2011. godine.

                                                                                      sadržaj

Predgovor .     .  .   .   .   .   .  .  .  .  .   .  .  .  .  .   .  .   .  .   .   .   .  .   .  .   .   .   .   .  .   .  .  .  .   .  .  .  .   .  .   .  .  .  .   .  . xv

1.   Uvod u C#.    . . . . . .  . . .  .  . . .  .  . . . .  .  .  .  .  .  . .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . 1

     Zašto C#? Zašto .NET?                                                                               1
     Biblioteka klasa .NET kostura                                                                       2
     Stil jezika                                                                                         3
         Sastavljivost                                                                                   4
         Upravljani kôd                                                                                  5
         Kontinuitet i ekosustav Windowsa                                                                6
     C# 4.0, .NET 4 i Visual Studio 2010                                                                 7
     Sažetak                                                                                             9

2.   osnovne tehnike programiranja   .   .       .  .   .   .   .   .   .   .   .   .   .  .   .  .   .   .   .   .   .  .   .  .   .   .   .   .   .  .   . 11

     Uvod                                                                                               11
     Imenski prostori i tipovi                                                                          14
     Projekti i rješenja                                                                                19
     Komentari, dijelovi i čitljivost                                                                   24
         Loši komentari                                                                                 26
         Komentari za XML dokumentaciju                                                                 26
     Varijable                                                                                          28
         Tipovi varijabli                                                                               28
     Izrazi i iskazi                                                                                    35
         Iskazi pridruživanja                                                                           38
         Operatori povećavanja i smanjivanja                                                            38
     Kontrola toka pomoću iskaza odabiranja                                                             39
         Iskaz if                                                                                       40
         Iskazi switch i case                                                                           45
     Iskazi za ponavljanje                                                                              47
         Iskazi foreach                                                                                 48
         Iskaz for                                                                                      50
         Iskazi while i do                                                                              52

                                                                                                         v
           Napuštanje petlje                                                                         53
        Metode                                                                                       55
        Sažetak                                                                                      58

   3.   apstrahiranje ideja s klasama i strukturama .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .59

        Podijeli i vladaj                                                                            59
           Apstrahiranje ideja metodama                                                              59
           Apstrahiranje ideja pomoću objekata i klasa                                               62
        Definiranje klasa                                                                            64
           Predstavljanje stanja svojstvima                                                          64
           Razine zaštite                                                                            66
           Inicijaliziranje s konstruktorom                                                          68
           Polja – mjesta za smještanje podataka                                                     72
           Polja mogu biti hirovita, ali konstanta se nikad ne mijenja                               75
           Polja samo za čitanje i svojstva                                                          76
        Povezane konstante s tipom enum                                                              79
        Vrijednosni tipovi i referentni tipovi                                                       82
        Previše konstruktora, gospodine Mozart                                                       88
        Preopterećivanje operatora                                                                   88
           Preopterećene metode i podrazumijevani imenovani parametri                                89
        Inicijalizatori objekata                                                                     92
        Definiranje metoda                                                                           95
           Deklariranje statičkih metoda                                                             98
        Statička polja i svojstva                                                                    99
           Statički konstruktori                                                                    101
        Sažetak                                                                                     102

   4.   Proširivost i polimorfizam .   .  . .  . .  . .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . 103

        Povezivanje kroz kompoziciju i agregaciju                                                   104
        Nasljeđivanje i polimorfizam                                                                106
        Zamjenjivanje metoda u izvedenim klasama                                                    109
           Skrivanje osnovnih članova pomoću new                                                    109
           Zamjenjivanje metoda pomoću ključnih riječi virtual i override                           112
        Nasljeđivanje i zaštita                                                                     114
        Pozivanje metoda osnovne klase                                                              116
        Do ovdje i ni makac dalje: pečaćenje                                                        118
        Zahtijevanje premošćenja pomoću abstract                                                    121
        Svi tipovi su izvedeni iz Object                                                            127
           Pakiranje i raspakiravanje vrijednosnih tipova                                           127
        C# ne podržava višestruko nasljeđivanje implementacije                                      132
        C# podržava višestruko nasljeđivanje sučelja                                                132
        Izvođenje sučelja iz drugih sučelja                                                         135
           Eksplicitna implementacija sučelja                                                       136

vi  |  sadržaj
     Posljednje utočište: provjeravanje tipova tokom izvršavanja                                     141
     Sažetak                                                                                         142

5.   Komponiranje i proširivanje s delegatima          .   .   .   .   .   .  .   .  .   .   .  .   .  .   .  .   .   .   .   .   .   .  .  .  143

     Funkcionalna kompozicija s delegatima                                                           150
     Generičke akcije s Action<T>                                                                    156
     Generički predikati s Predicate<T>                                                              160
     Upotreba anonimnih metoda                                                                       162
     Izrada delegata pomoću lambda izraza                                                            163
     Delegati u svojstvima                                                                           165
     Generički delegati za funkcije                                                                  167
     Obavještavanje klijenata događajima                                                             171
         Izlaganje velikog broja događaja                                                            180
     Sažetak                                                                                         183

6.   ispravljanje pogrešaka .  .  .  . .  .  . . .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . 185

     Kada i kako ne uspjeti                                                                          191
     Vraćanje vrijednosti pogrešaka                                                                  194
         Uklanjanje pogrešaka s povratnim vrijednostima                                              200
     Iznimke                                                                                         201
         Obrada iznimaka                                                                             207
         Kada se izvršavaju blokovi finally?                                                         214
         Odluka o tome što hvatati                                                                   215
         Prilagođene iznimke                                                                         218
     Sažetak                                                                                         220

7.   nizovi i popisi   .   .   .  .  .  .   .   .   .   .   .   .   .   .  .  .   .   .   .   .   .   .   .  .   .   .  .   .   .   .  .   .  .  .  .   .  .  .  .   .  . 221

     Nizovi                                                                                          221
         Konstrukcija i inicijalizacija                                                              222
         Prilagođeni tipovi u nizovima                                                               225
         Članovi niza                                                                                230
         Veličina niza                                                                               236
     List<T>                                                                                         243
         Prilagođeni indekseri                                                                       247
         Pronalaženje i sortiranje                                                                   253
     Kolekcije i polimorfizam                                                                        254
         Izradite vlastito IEnumerable<T>                                                            258
     Sažetak                                                                                         264

8.   LinQ .  . . . .  . . . . . .  . .  . .  . .  . .  . . .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . 265

     Izrazi za upite                                                                                 265
         Izrazi upita u usporedbi s pozivima metoda                                                  267
         Produžene metode i LINQ                                                                     268

                                                                                          sadržaj  |  vii
           Klauzula let                                                                             271
        Koncepti i tehnike LINQ-a                                                                   271
           Delegati i lambda izrazi                                                                 271
           Funkcionalni stil i kompozicija                                                          273
           Odloženo izvršavanje                                                                     274
        LINQ operatori                                                                              275
           Filtriranje                                                                              275
           Sortiranje                                                                               276
           Nastavljanje                                                                             279
           Grupiranje                                                                               280
           Projekcije                                                                               282
           Zipanje                                                                                  288
           Budite izbirljivi                                                                        289
           Testiranje cijele kolekcije                                                              291
           Agregacija                                                                               292
           Operacije sa skupovima                                                                   294
           Spajanje                                                                                 295
           Pretvaranje                                                                              296
        Sažetak                                                                                     297

   9.   Klase kolekcija.  . . .  . . .  .  . . .  .  . . . .  .  .  .  .  .  . .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . 299

        Rječnici                                                                                    299
           Uobičajene primjene rječnika                                                             301
           IDictionary<TKey, TValue>                                                                308
           Rječnici i LINQ                                                                          309
        HashSet i SortedSet                                                                         310
        Redovi                                                                                      311
        Povezani popisi                                                                             312
        Stogovi                                                                                     313
        Sažetak                                                                                     314

   10.  znakovni nizovi  .   .  .  .   .   .   .   .   .  .  .  .  .   .   .  .   .   .   .   .  .   .   .   .   .  .   .   .  .   .  .  .   .  .  .  .   .  .  .  . 315

        Što je znakovni niz?                                                                        316
        Tipovi String i Char                                                                        317
        Doslovni znakovni nizovi i znakovi                                                          318
           Izdvajanje specijalnih znakova                                                           319
        Oblikovanje podataka za prikaz                                                              322
           Standardni nizovi za oblikovanje numeričkih vrijednosti                                  323
           Prilagođeni nizovi za oblikovanje numeričkih vrijednosti                                 329
           Datum i vrijeme                                                                          332
           Pretvaranje znakovnih nizova u druge tipove                                              336
           Složeno oblikovanje pomoću String.Format                                                 337
        Razlikovanje postavki kulture                                                               338

viii |  sadržaj
        Pregled pravila za oblikovanje                                                        340
     Pristupanje znakovima preko indeksa                                                      341
     Znakovni nizovi su nepromjenjivi                                                         341
     Uzimanje raspona znakova                                                                 343
     Komponiranje znakovnih nizova                                                            344
        Ponovno dijeljenje niza                                                               346
        Mala i velika slova                                                                   347
     Rad s tekstom                                                                            348
        Promjenjivi znakovni nizovi pomoću StringBuilder                                      349
     Pronalaženje i zamjenjivanje sadržaja                                                    353
     Razne vrste „praznih“ nizova                                                             355
     Uklanjanje bjelina                                                                       357
     Provjeravanje tipa znaka                                                                 360
     Kodiranje znakova                                                                        360
        Zašto je kodiranje bitno                                                              362
        Kodiranje i dekodiranje                                                               363
        Zašto znakovne nizove predstavljati kao sekvence bajtova?                             370
     Sažetak                                                                                  370

11.  datoteke i tokovi podataka  .   .  .  .   .   .  .  .   .   .   .   .   .   .   .  .   .   .   .   .   .  .   .  .   .   .   .   .   .  .   .  .  . 371

     Pregledavanje datoteka i mapa                                                            371
     Pregledavanje mapa                                                                       374
     Rad sa stazama datoteka                                                                  375
        Staza i trenutna radna mapa                                                           376
        Pregledavanje podataka o datotekama                                                   377
     Izrada privremenih datoteka                                                              381
     Brisanje datoteka                                                                        381
     Poznate mape                                                                             383
     Sigurno nastavljanje elemenata staze                                                     387
     Izrada i osiguravanje hijerarhija mapa                                                   388
     Brisanje mape                                                                            394
     Pisanje tekstualnih datoteka                                                             396
        Pisanje cijele tekstualne datoteke odjednom                                           396
        Pisanje teksta pomoću StreamWriter                                                    397
     Kad datoteke polude: rješavanje iznimaka                                                 400
        Pronalaženje i mijenjanje dopuštenja                                                  404
     Učitavanje datoteka u memoriju                                                           409
     Tokovi podataka                                                                          413
        Kretanje kroz tok                                                                     419
        Pisanje podataka pomoću tokova                                                        421
     Čitanje, pisanje i zaključavanje datoteka                                                422
     FileStream konstruktori                                                                  423
        Međuspremnici za tokove                                                               423

                                                                                    sadržaj |  ix
           Zadavanje dopuštenja tokom konstrukcije                                               424
           Zadavanje naprednih opcija                                                            425
       Asinkroni rad s datotekama                                                                425
        Izolirana pohrana                                                                        428
           Pohrana                                                                               429
           Čitanje i pisanje teksta                                                              430
           Definicija „izoliranog“                                                               431
           Upravljanje kapacitetom pohrane pomoću kvota                                          436
           Upravljanje izoliranom pohranom                                                       436
        Tokovi koji nisu datoteke                                                                439
           Prilagodljivi tok: CryptoStream                                                       443
           Rad u memoriji: MemoryStream                                                          444
           Predstavljanje binarnih podataka kao teksta pomoću šifriranja Base64                  444
        Sažetak                                                                                  447

   12. XML   .  .  .  .   .   .   .   .   .  .  .  .  .   .  .  .   .   .  .  .   .   .  .  .   .   .   .   .   .   .  .  .   .  .  .  .   .  .  .  .   .  .  .  .   .  .  . 449

        Osnove XML-a (kratak pregled)                                                            449
           Elementi                                                                              450
           XHTML                                                                                 451
       X znači eXtensible                                                                        452
        Izrada XML dokumenata                                                                    452
           XML elementi                                                                          455
           XML atributi                                                                          456
           Dodavanje LINQ-a u LINQ to XML                                                        459
        Pretraživanje XML dokumenata s LINQ-om                                                   461
           Traženje jednog čvora                                                                 465
           Osi pretraživanja                                                                     466
           Klauzule where                                                                        466
       XML serijalizacija                                                                        467
           Prilagođavanje XML serijalizacije korištenjem atributa                                469
        Sažetak                                                                                  471

   13.  rad s mrežom  .   .  .  .  .   .   .   .   .   .   .  .  .  .  .   .  .   .  .   .   .   .   .   .  .   .  .   .   .   .   .  .  .  .  .  .  .  .  .  .  . 473

        Odabir tehnologije za rad s mrežom                                                       473
           Web aplikacija s klijentskim kodom                                                    474
           .NET klijent i .NET poslužitelj                                                       477
           .NET klijent i Web usluga drugog vlasnika                                             479
           Vanjski klijent i .NET Web usluga                                                     480
       WCF                                                                                       481
           Izrada WCF projekta                                                                   481
           WCF ugovori                                                                           482
           WCF Test Client i WCF Service Host                                                    483
           Udomljavanje WCF usluge                                                               486

x  |  sadržaj
        Pisanje WCF klijenta                                                                   493
        Dvosmjerna komunikacija s dupleksnim ugovorima                                         501
     HTTP                                                                                      511
        WebClient                                                                              512
        WebRequest i WebResponse                                                               516
     Priključci                                                                                522
        IP, IPv6 i TCP                                                                         523
        Povezivanje s uslugama pomoću klase Socket                                             528
        Implementiranje usluga s klasom Socket                                                 531
     Ostale značajke za rad s mrežom                                                           536
     Sažetak                                                                                   537

14.  Baze podataka      .   .   .  .  .  .   .   .   .   .   .   .   .   .  .   .  .  .   .   .   .   .  .   .   .   .   .  .   .   .  .  .  .   .  .  .  .   .  .  . 539

     Značajke .NET-a za pristup podacima                                                       539
        Klasični ADO.NET                                                                       540
        LINQ i baze podataka                                                                   544
        Tehnologije za pristup podacima koje ne potječu od Microsofta                          545
        WCF Data Services                                                                      546
        Silverlight i pristup podacima                                                         546
        Baze podataka                                                                          547
     Entity Data Model                                                                         548
        Generirani kôd                                                                         551
        Mijenjanje preslikavanja                                                               554
        Relacije                                                                               555
        Nasljeđivanje                                                                          562
     Upiti                                                                                     563
        LINQ to Entities                                                                       563
        Entity SQL                                                                             568
        Kombiniranje ESQL-a i LINQ-a                                                           570
        ADO.NET pružatelj EntityClient                                                         571
     Objektni kontekst                                                                         571
        Rad s vezom                                                                            571
        Izrada, ažuriranje i brisanje                                                          574
        Transakcije                                                                            576
        Optimistična istovremenost                                                             581
        Trajanje konteksta i entiteta                                                          583
     WCF Data Services                                                                         584
     Sažetak                                                                                   588

15.  sklopovi   .   .   .   .  .  .  .  .  .  .   .  .  .  .  .  .   .   .  .  .   .   .   .   .   .   .  .  .   .   .   .  .  .  .   .  .  .  .   .  .  .  .   .  . 589

     .NET komponente: sklopovi                                                                 589
        Reference                                                                              590
        Pisanje biblioteka                                                                     593

                                                                                     sadržaj |  xi
           Zaštita                                                                                  595
        Imenovanje                                                                                  598
           Potpisivanje i jaka imena                                                                599
        Učitavanje                                                                                  601
           Učitavanje iz mape aplikacije                                                            602
           Učitavanje iz GAC-a                                                                      603
           Učitavanje iz Silverlight .xap datoteke                                                  603
           Eksplicitno učitavanje                                                                   604
        Sažetak                                                                                     605

   16.  niti i asinkroni kôd   .   .  .  .  .  .   .  .  .  .  .   .   .   .   .   .   .  .  .   .   .   .   .   .   .  .  .   .   .   .  .  .  .  .  .  .  .  . 607

        Niti                                                                                        609
           Niti i sistemski raspored izvršavanja                                                    611
           Stog                                                                                     613
           Repozitorij niti                                                                         620
           Afinitet niti i kontekst                                                                 622
           Uobičajene zablude o nitima                                                              623
           Višenitno kodiranje je teško                                                             629
           Strategije za uspješan višenitni rad                                                     632
        Sinkronizacijski osnovni tipovi                                                             634
           Monitor                                                                                  634
           Drugi tipovi lokota                                                                      645
           Drugi mehanizmi za koordinaciju                                                          649
           Događaji                                                                                 649
           Odbrojavanje                                                                             650
           BlockingCollection                                                                       650
        Asinkrono programiranje                                                                     651
           Model asinkronog programiranja                                                           652
           Asinkroni model temeljen na događajima                                                   655
           Ad hoc asinkronost                                                                       656
        Task Parallel Library                                                                       656
           Zadaci                                                                                   657
           Poništavanje                                                                             663
           Obrada pogrešaka                                                                         665
        Paralelnost podataka                                                                        666
           Metode For i ForEach klase Parallel                                                      667
           PLINQ: Parallel LINQ                                                                     669
        Sažetak                                                                                     670

   17.  atributi i refleksija  .   .   .   .  .  .  .  .  .  .   .  .  .   .  .   .   .   .  .  .   .   .   .   .   .   .  .  .   .   .   .  .  .  .   .  .  .  . 671

        Atributi                                                                                    671
           Tipovi atributa                                                                          672
           Prilagođeni atributi                                                                     673

xii |  sadržaj
     Refleksija                                                                                    677
        Pregledavanje metapodataka                                                                 678
         Otkrivanje tipa                                                                           679
        Reflektiranje na specifičan tip                                                            681
        Kasno povezivanje                                                                          683
     Sažetak                                                                                       686

18.  dinamičnost .     .  .   .   .  .  .  .   .   .   .   .   .   .  .  .  .  .   .   .   .   .   .   .  .  .   .   .   .   .   .  .  .  .  .  .  .  .  .  .  .  . 687

     Statičnost naspram dinamičnosti                                                               687
        Dinamički stil i COM automatizacija                                                        689
     Tip dynamic                                                                                   690
        Tipovi objekata i ključna riječ dynamic                                                    693
     dynamic u situacijama bez interoperabilnosti?                                                 703
     Sažetak                                                                                       706

19.  interoperabilnost s CoM komponentama i Win32 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . 707

     Uvoženje ActiveX kontrola                                                                     707
        Uvoženje kontrole u .NET                                                                   708
     Interoperabilni sklopovi                                                                      711
        No PIA                                                                                     712
     64-bita u usporedbi s 32-bita                                                                 713
     P/Invoke                                                                                      716
     Pokazivači                                                                                    720
     Poboljšanja C# 4.0 sintakse za interoperabilnost                                              725
        Indeksirana svojstva                                                                       725
         Opcionalni ref argument                                                                   726
     Sažetak         








Novo za October

Pathophysiology
Pathophysiology
367,50 kn  349,13 kn
Popust: 5%
Patofiziologija
Patofiziologija
210,00 kn  199,50 kn
Popust: 5%
Patologija i patofiziologija
Patologija i patofiziologija
114,45 kn  108,73 kn
Popust: 5%
Atlas opće patologije
Atlas opće patologije
262,50 kn  249,38 kn
Popust: 5%
Opća patologija
Opća patologija
367,50 kn  349,13 kn
Popust: 5%
Patologija
Patologija
472,50 kn  448,88 kn
Popust: 5%
Patologija
Patologija
934,50 kn  887,78 kn
Popust: 5%