Sch eme and Sylla bu salphace.ac.in/downloads/notes/cse/10cs761.pdf · C# Pro gram in g an d .NET...
Transcript of Sch eme and Sylla bu salphace.ac.in/downloads/notes/cse/10cs761.pdf · C# Pro gram in g an d .NET...
TEN.dnagnimargorP#C C01 167S
CfO.tpeD IBJS,ES T
TEN. DNA GNIMMARGORP #C
hcS e em and Sy ll a ub s Su jb ce t doC e: C01 167S I. .A Mar sk : 52
H uo r eW/s ek : 40 . E max uoH r :s 30
T lato H uo rs : 25 E max Mar :sk 001
NU IT – 1 6 Hou sr
ehT P posolih hy of .N TE : nU d tsre a idn ng the Previous S tat e fo A ff ai sr , The N. ET
S itulo o ,n The B iu lding Bl co k of t eh .NET Platform (CLR,CTS, and CLS ,) T eh R elo of
t eh EN. T esaB C al ss iL braries, What C# B ir ngs to the T ,elba nA Ov vre ei w fo N. ET
seiraniB a( ka Assembli se ), eht Role of t eh Co mm on etnI r taidem e Langu ega , T eh
eloR of EN. T T py e M ate d ata , The eloR fo t eh a ss embly Mani saf ,t Co pm ili gn IC L
to P oftal rm – Sp cifice urtsnI c oit ,sn nU d tsre a dn ing the Common Type S tsy em ,
I tn rin is c CTS taD a T py se , nU derstanding the C mo mon Lang au ges Speci if cati no ,
U redn nats ding ht e Comm no La gn uage uR ntime A ruot of the .NET aN mespaces,
cnI r ae s ni g Yo ru Namespace Nomen lc a ut re, Deploying the .NET uR n it me.
NU IT – 2 6 Hours
idliuB ng C# pA pl ci at oi ns: The eloR fo ht e Command L eni Comp eil r ( e.csc x )e ,
dliuB ing #C pA cilp ation using csc.exe oW rking wi ht .csc exe eR sp no se Fil se ,
Gener ta ing Bug Reports, Remaini gn g C# Complier Options, T eh Comm na d niL e
beD u regg c( ordbg.ex )e U is ng t ,eh V ausi l studio .NET IDE, Ot eh r Key A ps ects of the
VS.NET IDE, C# “Prepro ec ss or:” Directives, an Interesting Aside: The Sy ets m .
E ivn nor me tn Class .
NU IT – 3 8 H uo rs
#C naL ug ega Fu dn a em tn als: T eh nA ato ym of cisaB C# lC ass, aerC ting o jb tce :s
rotcurtsnoC B ,scisa The Com op tis ion of a #C Application, feD a lu t as is gn em nt an d
Var ai b el cS ope, The #C eM mber Ini it alisation Sy tn ax, Ba cis upnI t a dn uO tp tu wit h
ht e elosnoC ,ssalC U tsredn anding eulaV Typ se and Reference Typ se , The Mast re
N edo : S sy tem, bO j tce , T eh S sy tem Data T py es na( d C# Al ai s ,)se Co revn ting Betwe ne
Va ul e Typ se na d eR ef er nce Typ se : oB xing and bnU ixo gn , Defining P rgor am
TEN.dnagnimargorP#C C01 167S
CfO.tpeD IBJS,ES T
Cons nat ts, C# Iteration Constructs, C# Cont lor s Flow noC st cur ts, T eh Comp etel Set
of C# Oper ta ors, Defining C su tom Class eM th do s, U atsredn ting Static eM th do ,s
M ohte d s P ra a tem er Modi if se , rrA ay Manipulat oi n in C#, S irt gn Ma in p italu no in
,#C #C unE mera it o sn , De ninif g St cur ut r se in C#, D ife ning uC ts om aN em sp ca se .
INU T – 4 6 H uo rs
O tcejb - rO ei nted Progr ma ming wi ht C#: oF rms Defining fo t eh C# Class,
feD i in tio n t eh “Defa tlu P lbu ic nI t ecafre ” fo a Type, Re ac ppi gn ht e Pil al rs of OO P,
The First P ralli s: #C ’s Enca sp ulation Services, Pse du o- En ac ps lu ation: Cre gnita
aeR d-Only ,sdleiF T eh noceS d P :ralli s’#C In natireh ce Supports, ek eping Fami yl
Se rc ets: The “ P etcetor d” Keyword, N se ted Type Defini it ons,The Third Pil al r: C # s’
P lo ymorphic S oppu r ,t aC sting Betwe ne .
PART – B
NU IT –5 6 H uo rs cxE e itp ons and Object iL fetime: O ed to Errors, Bugs, and Exc itpe ons, The R elo o f
. EN T Ex pec tion dnaH i gn , ht e System. Ex pec t oi n saB e ssalC , Throwi gn a eG n ire c
Ex tpec i ,no hctaC i gn Ex ec p it o ,n C RL S etsy m – eveL l Excep it (no System. System
E tpecx io )n , Custom lppA ica it on-L ve el cxE e (noitp S sy tem. S tsy me
Ex dnaH,)noitpec nil g M tlu iple Excep it on, T eh imaF ly kcolB , ht e tsaL Cha cn e
ecxE p it no D ny a lacim ly tnedI ifying Ap oitacilp n – dna S metsy Le lev Excep it on
eD bugg ni g System Exception sU i gn VS. EN T, nU d sre t na id ng bO j tce emitefiL , ht e
CIT o f n“ e ’w , T eh aB s ci s of Garbage Collection,, Finalization a T py e, The
Finalization Pro ec ss, Building na Ad oH c Destruct oi n M hte od, Garbage Co ll ection
Optim zi ations, The Sys et m. GC T epy .
NU IT – 6 6 H uo rs
etnI fr ac se na d C lo lections: Defining nI et rfaces Using C# Invoking I tn erface Members
at ht e object Level, Ex cre i is gn ht e Sha ep s eiH rar hc y, dnU ersta idn ng E lpx icit
etnI rf ca e Implementati no , I tn erfaces sA Poly om rphic Agent ,s Buildi gn nI te fr ace
Hie ar rc ih es, Imple em nting, lpmI emen itat on, In et r af ces Using VS .NE ,T
nu d re s at nd ni g the IC no ev rt bi le Interface, Building a C su tom En emu r ta or ( nEI u em r ba le
na d nE u tarem or), uB ilding Clo baen le stcejbo )elbaenolCI( , dliuB ing Comp ara ble
Objects E px ol ri gn the syst me . Co cell it no s Na ,ecapsem B liu ding a Cu ts om Container
TEN.dnagnimargorP#C C01 167S
CfO.tpeD IBJS,ES T
(R te r fo itting the Cars Ty ep ) .
NU IT – 7 8 H uo rs
Ca abll ck I etn r caf es, Deleg ta es, a dn Eve tn s, Adv cna ed ceT nh iques:
aC l kcabl etnI r ,secaf Und natsre d ni g eht .N TE Delegate Type, Mem sreb of System.
itluM c sa t ,etageleD The Simp tsel P so is ble tageleD e Exa pm le, , B dliu ing More a
alE bo etar D ele ag te Exampl ,e U dn e tsr a dn ing sA ynchro uon s Deleg eta s, U dn e sr t na di gn
a( nd sU i gn ) vE ents . T eh Ad secnav Ke sdrowy of C#, A aC talog of #C Ke rowy ds
Bui idl ng a C su to ,rexednI m A noitairaV of t eh sraC nI dex re In et r lan eR p neser tation
of T py e Indexer . Usi gn C# In ed xer rf om VB .N TE . vO erlo ida ng ope ar t ro s, The
nI t re nal R erpe senta it on of aolrevO d ni g Opera ot rs, etni r nitca g iw th O ev lr oad pO erator
orf m vO er aol ded- O ep r ta ro - Ch la le gn ed naL ug ga se , Cr tae ni g uC stom C revno si no
uoR tines, nifeD in g cilpmI ti srevnoC i no Routines, T eh In ret an l peR resentat noi s of
uC stoms Con ev rsion
R uo enit s
INU T – 8 6 oH u sr
U redn st idna ng . EN T Assembles: rP oblems w ti h alC ssic C MO niB ar ,sei An vO e vr iew
of EN. T Assembly, uB ilding a Si pm le File Test Asse bm ly, A C#. ilC ne t A pp lication,
A Vi us la aB sic .NET eilC nt pA acilp it on, rC o ss Language I hn e ir tance, E px l iro ng the
aC r iL brary’ ,s Manife ts , xE plo nir g ht e aC r iL b ar ry’s T epy s, dliuB i gn t eh M lu ti if le
bmessA l ,y U is ng Asse bm l ,y Underst na din g P etavir Asse ilbm e ,s Pro gnib for P avir te
ssA emb il es (T eh Basics), Pr avi te Assemblies XML gifnoC ru ta ions iF el s, iborP ng
rof rP iva et Ass bme lies ( T eh eD t )slia , nU d natsre d ni g S erah d Assembly,
nU d sre ta dn ing S ah er d Names, Build ni g a yaleD gnidnatsrednU ,ylbmessA derahS
derahS gnivomeR/gnillatsnI ,gningiS
ylbmessA derahS a gnisU ,ylbmessA
B txeT :skoo
.9002 ,aidnI yeliW ,noitidE ht4 ,0.3 TEN. htiw #C orP :nesleorT werdnA .1 11 ot 1 :sretpahC
)963 .pp ot pu(
.4002 ,lliH warGcM ataT ,noitidE dn2 ,#C ni gnimmargorP :ymasurugalaB .E .2
,6.7 ,5.7 ,4.7 ,2.7 ,1.6 ,5.5 ,01.3 ,7.3 selpmaxE gnimmargorP( ,1.9 ,8.8 ,7.8 ,5.8 ,3.8 ,2.8 ,1.8
TEN.dnagnimargorP#C C01 167S
CfO.tpeD IBJS,ES T
,3.31 ,2.31 ,1.31 ,6.21 ,5.21 ,4.21 ,1.21 ,4.11 ,2.11 ,4.01 ,2.01 ,4.9 ,3.9 ,2.9 ,2.41 ,1.41 ,6.31
)6.81.5.81 ,3.81 ,3.61 ,2.61 ,1.61 ,3.51 ,2.51 ,4.41
:skooB ecnerefeR
.1002 ,srehsilbuP PW ,#C edisnI :rehcrA moT .1
.4002 ,lliH warGcM ataT ,ecnerefeR etelpmoC ehT #C :tdlihcS trebreH .2
TEN.dnagnimargorP#C C01 167S
CfO.tpeD IBJS,ES T
stnetnoC fo elbaT .oN egaP
TINU -1 ehT hp osoli p yh of N. TE 1-25 1.1 idnatsrednU ng eht suoiverP etatS fo riaffA s
2.1 ehT TEN. S tulo i ,no
3.1 ehT idliuB ng kcolB of eht TEN. mroftalP (C ,STC,RL dna CLS)
4.1 ehT eloR fo EN. eht T esaB ssalC biL r ra ei
5.1 tahW #C sgnirB ot the baT el
6.1 nA weivrevO fo TEN. eiraniB s
7.1 ehT eloR fo eht nommoC etaidemretnI aL ngu ega
8.1 ehT eloR TEN. fo T epy eM t tada a
1 9. ehT eloR fo bmessA eht ly naM i sef t
01.1 gnilipmoC LIC ot mroftalP – cificepS rtsnI u snoitc
11.1 gnidnatsrednU eht nommoC epyT S metsy
21.1 cisnirtnI ataD STC ,sepyT
31.1 gnidnatsrednU eht nommoC aL n segaug noitacificepS ,
41.1 gnidnatsrednU eht nommoC aL n egaug emitnuR
51.1 A ruot fo eht TEN. secapsemaN ,
TINU -2 Bu li d ni g C# App cil a oit ns 26-36
1.2 ehT eloR fo eht dnammoC eniL reilpmoC c( cs e. x )e
2.2 gnidliuB C # noitacilppA gnisu e.csc xe
3.2 gnikroW htiw exe.csc esnopseR ,seliF G gnitarene Bug stropeR
4.2 ehT dnammoC eniL reggubeD )exe.gbdroc(
5.2 gnisU ,eht lausiV tS u oid TEN. EDI 6
6.2 rehtO yeK stcepsA fo eht TEN.SV EDI
7.2 ”:rossecorperP“#C evitceriD s
8.2 nA gnitseretnI edisA : ehT S metsy . tnemnorivnE lC ssa .
TINU -3 ehT #C orP gra gnimm egaugnaL 37- 98
1.3 ehT otanA my fo a #C cisaB C al s s
2.3 gnitaerC bo j :stce rotcurtsnoC cisaB s
3.3 ehT sopmoC ti noi fo a C# ppA il tac i no
4.3 tluafeD tnemngissA dna elbairaV epocS
5.3 ehT #C rebmeM tinI i noitazila S atny x
6.3 cisaB tupnI dna tuO p tu htiw eht C elosno lC a ss
TEN.dnagnimargorP#C C01 167S
CfO.tpeD IBJS,ES T
7.3 gnidnatsrednU eulaV sepyT dna ecnerefeR T sepy
8.3 ehT retsaM oN d :e yS s et m, jbO e tc
9.3 ehT S metsy D ata T A #C dna( sepy il esa )s
01.3 gnitrevnoC neewteB eulaV dna ecnerefeR T :sepy oB x gni obnU x gni ,
11.3 inifeD ng margorP C tnatsno s
21.3 #C noitaretI C sno t tcur s
31.3 #C slortnoC wolF C no ts tcur s
41.3 ehT etelpmoC S te fo C
51.3 sdohteM retemaraP seifidoM
61.3 rrA a y M alupina it no ni C #
71.3 gnirtS noitalupinaM in C#
81.3 #C snoitaremunE
91.3 inifeD ng serutcurtS in C #
02.3 inifeD ng motsuC aN m apse c se .
UNIT – 4 OO P with C# 09 - 601
1.4 inifeD ng fo eht #C C ,ssal
2.4 noitinifeD eht tluafeD“ cilbuP ”ecafretnI fo a T epy
3.4 ippaceR ng iP eht ll sra fo OO P ,
4.4 ehT tsriF :sralliP s’#C uspacnE l ta i no S secivre , P odues - :noitaluspacnE
gnitaerC daeR - nO yl sdleiF
ehT5.4 dnoceS s’#C:ralliP nI h ecnatire stroppuS
.4 6 gnipeek ylimaF :sterceS ehT “ cetorP t ”de Ke ,drowy
detseN T epy D ,snoitinife
.4 7 ehT drihT :ralliP C s’# Pol cihpromy S roppu t ,
8.4 gnitsaC neewteB .
UNIT – 5 E pecx t oi ns and O ejb ct Li tef ime 107-1 42
edO1.5 ot ,srorrE Bu ,sg dna Ex ,snoitpec
2.5 ehT eloR fo TEN. Ex noitpec idnaH n ,g
ehT 3.5 S metsy . Ex noitpec esaB ssalC ,
4.5 gniworhT a cireneG ,noitpecxE
5.5 gnihctaC Ex noitpec ,
6.5 C RL S metsy – leveL noitpecxE (S metsy . S sy t me Ex ,)noitpec
7.5 suC mot noitacilppA - leveL Ex noitpec (S etsy m. metsyS Ex ,)noitpec
8.5 gnildnaH elpitluM noitpecxE
TEN.dnagnimargorP#C C01 167S
CfO.tpeD IBJS,ES T
9.5 ehT inaF ly ,kcolB eht tsaL ahC n ec Ex noitpec Dyn lacima ly
gniyfitnedI noitacilppA – dna S metsy leveL noitpecxE gniggubeD metsyS
01.5 Ex noitpec gnisU VS. ,TEN
11.5 gnidnatsrednU tcejbO ,emitefiL
21.5 ehT C “ fo TI n ’we ,
31.5 ehT scisaB fo G egabra noitcelloC ,
41.5 noitazilaniF a Type, ehT noitazilaniF P secor s,
51.5 gnidliuB na dA coH noitcurtseD ,dohteM
61.5 egabraG noitcelloC ,snoitazimitpO
71.5 ehT S metsy . CG T epy .
TINU – snoitcelloC dna secafretnI 6 521 - 041
#C gnisU secafretnI gninifeD 1.6
,leveL tcejbo eht ta srebmeM ecafretnI gnikovnI 2.6
yhcrareiH sepahS eht gnisicrexE 3.6
,noitatnemelpmI ecafretnI ticilpxE gnidnatsrednU 4.6
A secafretnI 5.6 ,stnegA cihpromyloP s
,noitatnemelpmI seihcrareiH ecafretnI gnidliuB 6.6
,ecafretnI elbitrevnoCI eht gnidnatsrednu,TEN. SV gnisU secafretnI 7.6
,)rotaremunE dna elbaremunEI( rotaremunE motsuC a gnidliuB 8.6
)elbaenolCI ( stcejbo elba enolC gnidliuB 9.6 ,
elbarapmoC I stcejbO elbarapmoC gnidliuB 01.6
ecapsemaN snoitcelloC .metsys eht gnirolpxE 11.6
.)epyT sraC eht gnittiforteR( reniatnoC motsuC a gnidliuB 21.6
TINU - stnevE dna ,setageleD ,secafretnI kcabllaC 7 141 - 751
1.7 I kcabllaC gnidnatsrednU ,secafretn
2.7 ,epyT etageleD TEN. eht gnidnatsrednU
elbissoP tselpmiS ehT ,etageleD tsacitluM .metsyS fo srebmeM 3.7
elpmaxE etageleD etarobalE a eroM gnidliuB ,elpmaxE etageleD
,setageleD suonorhcnysA gnidnatsrednU 4.7
U dna( gnidnatsrednU 5.7 stnevE )gnis
sdrowyeK #C fo golataC A ,#C fo sdrowyeK secnavdA ehT 6.7
airaV A ,rexednI motsuC a gnidliuB 7.7 rexednI sraC eht fo noit
lanretnI ehT ,srotarepo gnidaolrevO .TEN. BV morf rexednI #C gnisU 8.7
TEN.dnagnimargorP#C C01 167S
CfO.tpeD IBJS,ES T
,srotarepO gnidaolrevO fo noitatneserpeR
TINU - ylbmessA TEN. a fo tamroF eht gnidnatsrednU 8 851 - 461
,seiraniB MOC cissalC htiw smelborP 1.8
,ylbmessA TEN. fo weivrevO nA 2.8
ylbmessA tseT eliF elpmiS a gnidliuB 3.8
,noitacilppA tneilC #C A 4.8
oitacilppA tneilC TEN. cisaB lausiV A5.8 ,n s’yrarbiL raC eht gnirolpxE tsefinaM
sepyT s’yrarbiL raC eht gnirolpxE 6.8
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 1
TINU -1 gnicudortnI mroftalP TEN. eht dna #C
1.1 sriaffA fo etatS suoiverP eht gnidnatsrednU
taht seussi eht fo emos redisnoc ot lufpleh s’ti ,esrevinu TEN. eht fo scificeps eht gninimaxe erofeB
teg oT .mroftalp tnerruc s’tfosorciM fo siseneg eht detavitom dnim reporp eht ni - nigeb s’tel ,tes
eht dnatsrednu dna stoor ruo rebmemer ot nossel yrotsih sselniap dna feirb a htiw retpahc siht
pets tsrif eht si melborp a evah uoy gnittimda ,lla retfa( sriaffa fo etats suoiverp eht fo snoitatimil
los a gnidnif drawot ruo nrut ew ,ti wenk ew sa efil fo ruot kciuq siht gnitelpmoc retfA .)noitu
.mroftalp TEN. eht dna #C yb dedivorp stifeneb suoremun eht ot noitnetta
remmargorP IPA 23niW/C a sA efiL
fo ylimaf swodniW eht rof erawtfos gnipoleved ,gnikaeps yllanoitidarT devlovni smetsys gnitarepo
gnimmargorp noitacilppa swodniW eht htiw noitcnujnoc ni egaugnal gnimmargorp C eht gnisu
gnisu detaerc yllufsseccus neeb evah snoitacilppa suoremun taht eurt si ti elihW .)IPA( ecafretni
emit siht - luow su fo wef ,hcaorppa deronoh IPA war eht gnisu snoitacilppa gnidliub taht eergasid d
C .egaugnal esret yrev a si C taht si melborp suoivbo tsrif ehT .gnikatrednu xelpmoc a si
dna ,citemhtira retniop ylgu ,tnemeganam yromem launam htiw dnetnoc ot decrof era srepoleved
lacitcatnys ylgu stifeneb eht skcal ti ,egaugnal derutcurts a si C taht nevig ,eromrehtruF .stcurtsnoc
tcejbo eht yb dedivorp - eht enibmoc uoy nehW )?edoc ittehgaps yas enoyna nac( hcaorppa detneiro
na ot IPA 23niW eht yb denifed sepyt atad dna snoitcnuf labolg fo sdnasuoht elbadimrof ydaerla
.yadot dnuora gnitaolf snoitacilppa yggub ynam os era ereht taht rednow elttil si ti ,egaugnal
remmargorP CFM/++C a sA efiL
.egaugnal gnimmargorp ++C eht fo esu eht si tnempoleved IPA/C war revo tnemevorpmi tsav enO
+C ,syaw ynam nI tcejbo na sa fo thguoht eb nac + - hguoht neve ,suhT .C fo pot no reyal detneiro
dna ,ecnatirehni ,noitaluspacne( ”POO fo srallip“ demaf eht morf tifeneb sremmargorp ++C
g.e( egaugnal C eht fo stcepsa lufniap eht fo ycrem eht ta llits era yeht ,)msihpromylop launam ,.
atnys ylgu dna ,citemhtira retniop ylgu ,tnemeganam yromem sti etipseD .)stcurtsnoc lacitc
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 2
sessalC noitadnuoF tfosorciM eht ,elpmaxe roF .yadot tsixe skrowemarf ++C ynam ,ytixelpmoc
licaf taht sessalc ++C fo tes a htiw repoleved eht sedivorp )CFM( noitcurtsnoc eht etati 23niW fo
a dniheb IPA 23niW war eht fo ”tesbus enas“ a parw ot si CFM fo elor niam ehT .snoitacilppa
edoc suoremun dna ,sorcam cigam ,sessalc fo rebmun - fo sseldrageR .)sdraziw aka( sloot noitareneg
t yb dereffo ecnatsissa lufpleh eht ++C rehto ynam sa llew sa( krowemarf CFM eh - desab
rorre dna tluciffid a sniamer gnimmargorp ++C taht si rettam eht fo tcaf eht ,)stikloot gniwodniw -
.C ni stoor lacirotsih sti nevig ,ecneirepxe enorp
remmargorP 0.6 cisaB lausiV a sA efiL
ftraeh a ot euD morf yawa detfihs evah sremmargorp ynam ,elytsefil relpmis a yojne ot erised tle
)++(C fo dlrow eht - .)6BV( 0.6 cisaB lausiV sa hcus segaugnal reltneg ,rednik ot skrowemarf desab
arbil edoc ,secafretni resu xelpmoc dliub ot ytiliba sti ot eud ralupop si 6BV MOC ,.g.e( seir
eht sedih 6BV ,CFM naht erom nevE .rehtob dna ssuf laminim htiw cigol ssecca atad dna ,)srevres
IPA 23niW war eht fo seitixelpmoc cisnirtni ,sdraziw edoc detargetni fo rebmun a gnisu weiv morf
BV dna ,sessalc ,sepyt atad - .snoitcnuf cificeps neeb sah hcihw( 6BV fo llafnwod rojam ehT
tcejbo ylluf a ton si ti taht si )TEN. cisaB lausiV fo tnevda eht nevig deifitcer - ;egaugnal detneiro
si“ hsilbatse ot remmargorp eht wolla ton seod 6BV ,elpmaxe roF ”.erawa tcejbo“ si ti ,rehtar - ”a
b spihsnoitaler rof troppus cisnirtni on sah dna )ecnatirehni lacissalc on ,.e.i( sepyt neewte
dedaerhtitlum dliub ot ytiliba eht edivorp t’nseod 6BV ,revoeroM .noitcurtsnoc ssalc deziretemarap
wol ot nwod pord ot gnilliw era uoy sselnu snoitacilppa - sllac IPA 23niW level xelpmoc si hcihw(
.)tsrow ta suoregnad dna tseb ta
remmargorP EE2J/avaJ a sA efiL
sti sah dna detneiro tcejbo yletelpmoc )tsomla( si egaugnal gnimmargorp avaJ ehT .avaJ retnE
rg raf era shtgnerts s’avaJ ,erawa era uoy fo ynam sA .++C ni stoor citcatnys troppus sti naht retae
ynam pu snaelc )egaugnal a sa( avaJ .ecnednepedni mroftalp rof fo stcepsa lacitcatnys yrovasnu
taht ”segakcap“ denifederp fo rebmun egral a htiw sremmargorp sedivorp )mroftalp a sa( avaJ .++C
t gnisU .snoitinifed epyt suoirav niatnoc eruP %001“ dliub ot elba era sremmargorp avaJ ,sepyt eseh
bew ,troppus gnigassem ,ytivitcennoc esabatad htiw etelpmoc snoitacilppa ”avaJ - tnorf delbane
si melborp laitnetop eno ,egaugnal tnagele yrev a si avaJ hguohtlA .ecafretni resu hcir a dna ,sdne
taht tnorf avaJ esu tsum uoy taht snaem yllacipyt avaJ gnisu - ot - .elcyc tnempoleved eht gnirud kcab
s’avaJ fo niarg eht tsniaga seog siht sa ,noitargetni egaugnal fo epoh elttil sreffo avaJ ,tceffe nI
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 3
.)deen yreve rof egaugnal gnimmargorp elgnis a( laog yramirp era ereht ,revewoh ,ytilaer nI
htiw elgnimmoc ot ekil yllaedi dluow taht dlrow eht ni ereht tuo edoc gnitsixe fo senil fo snoillim
rof etairporppa ton ylpmis si avaJ eruP .citamelborp ksat siht sekam avaJ ,yldaS .edoc avaJ rewen
ciremun ro yllacihparg ynam noitucexe s’avaJ dnif yam uoy ,sesac eseh snoitacilppa evisnetni ylla
a esu ot eb dluow smargorp hcus rof hcaorppa retteb A .)derised eb ot gnihtemos sevael deeps
rewol - detimil a edivorp seod avaJ elihw ,salA .etairporppa erehw )++C sa hcus( egaugnal level
non ssecca ot ytiliba - ssorc eurt rof troppus elttil si ereht ,sIPA avaJ - .noitargetni egaugnal
remmargorP MOC a sA efiL
tnempoleved noitacilppa suoiverp s’tfosorciM saw )MOC( ledoM tcejbO tnenopmoC ehT
ffe ni syas taht erutcetihcra na si MOC .krowemarf ecnadrocca ni sessalc ruoy dliub uoy fI“ ,tce
yranib a fo ytuaeb ehT ”.edoc yranib elbasuer fo kcolb a htiw pu dne uoy ,MOC fo selur eht htiw
egaugnal a ni dessecca eb nac ti taht si revres MOC - sremmargorp ++C ,suhT .rennam tnednepedni
essalc MOC dliub nac tliub sessalc MOC esu nac sremmargorp ihpleD .6BV yb desu eb nac taht s
tahwemos si ecnednepedni egaugnal s’MOC ,erawa eb yam uoy sa ,revewoH .htrof os dna ,C gnisu
ssalc MOC gnitsixe na gnisu ssalc MOC wen a evired ot yaw on si ereht ,elpmaxe roF .detimil sa(
erom eht fo esu ekam tsum uoy ,rehtaR .)ecnatirehni lacissalc rof troppus on sah MOC
sah“ emosrebmuc - sti si MOC fo tifeneb rehtonA .sepyt ssalc MOC esuer ot pihsnoitaler ”a
noitacol - sreifitnedi noitacilppa sa hcus stcurtsnoc gnisU .erutan tnerapsnart ,sbuts ,)sDIppA(
tnemnorivne emitnur MOC eht dna ,seixorp war htiw krow ot deen eht diova nac sremmargorp
wol rehto dna ,sllac CPR ,stekcos -
rednu xelpmoc ylemertxe si ti ,ledom tcejbo lufsseccus yrev a deredisnoc eb nac MOC hguohtlA
nu tsael ta( dooh eht gnibmulp sti gnirolpxe shtnom ynam tneps evah uoy lit — uoy fi yllaicepse
suoremun ,seiranib MOC fo tnempoleved eht yfilpmis pleh oT .)remmargorp ++C a eb ot neppah
MOC - yrarbiL etalpmeT evitcA eht ,elpmaxe roF .ecnetsixe otni emoc evah skrowemarf erawa
)LTA( MOC fo noitaerc eht esae ot sorcam dna ,setalpmet ,sessalc ++C fo tes rehtona sedivorp
,revewoH .weiv morf erutcurtsarfni MOC eht fo trap doog a edih osla segaugnal rehto ynaM .sepyt
nevE .MOC fo ytixelpmoc eht edih ot hguone ton si enola troppus egaugnal a esoohc uoy nehw
MOC ylpmis ylevitaler - eligarf htiw dnetnoc ot decrof llits era uoy ,6BV sa hcus egaugnal erawa
tnemyolped suoremun dna seirtne noitartsiger - .)lleh LLD demret ylevitcelloc( seussi detaler
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 4
remmargorP AND swodniW a sA efiL
c rehtruf oT llac gniht elttil a si ereht ,srettam etacilpmo tsal eht revO .tenretnI eht de ,sraey lareves
tenretnI erom gnidda neeb sah tfosorciM - awa fo ylimaf sti otni serutaef er dna smetsys gnitarepo
w a gnidliub ,yldaS .stcudorp MOC gnisu noitacilppa be - desab swodniW teNretni detubirtsiD
rutcetihcrA snoitacilppA .xelpmoc etiuq osla si )AND( e eht ot eud si ytixelpmoc siht fo emoS
taht tcaf elpmis esu eht seriuqer AND swodniW ,PSA( segaugnal dna seigolonhcet suoremun fo
,LMTH dna ,tpircSBV ,tpircSavaJ ,LMX ew sa ,)+(MOC .)ODA sa hcus IPA ssecca atad a sa ll
enO eseht fo ynam taht si melborp p citcatnys a morf detalernu yletelpmoc era seigolonhcet fo tnio
,elpmaxe roF .weiv ircSBV elihw ,C ekil hcum xatnys a sah tpircSavaJ ehT .6BV fo tesbus a si tp
MOC aerc era taht srevres h emitnur +MOC eht rednu nur ot det kool tnereffid yleritne na eva dna
si tluser ehT .meht ekovni taht segap PSA eht morf leef hsamhsim desufnoc ylhgih a fo
sti sah ygolonhcet ro/dna egaugnal hcae ,tnatropmi erom spahrep dna ,eromrehtruF .seigolonhcet
t nwo htona ekil gnihton kool yam taht( metsys epy ni ”tni“ nA .)metsys epyt s’re ton si tpircSavaJ
.6BV ni ”regetnI“ na sa emas eht etiuq
2.1 noituloS TEN. ehT
mottob ehT .nossel yrotsih feirb eht rof hcum oS swodniW a sa efil taht si enil sah remmargorp
ot neeb a si krowemarF TEN. ehT .hgu eturb dna lacidar rehtar - ecrof sevil ruo gnikam ot hcaorppa
itulos ehT .reisae egnahC“ si TEN. yb desoporp no eht emalb t’nac uoy ,yrros( ”gnihtyreve
rof regnessem ees lliw uoy sA .)egassem eht ,koob siht fo redniamer eht gnirud TEN. eht
krowemarF rof ledom wen yletelpmoc a si po fo ylimaf swodniW eht no smetsys gnidliub gnitare
no sa llew sa ,smetsys non suoremun - suoirav dna X SO caM sa hcus smetsys gnitarepo tfosorciM
xuniL/xinU r kciuq a si ereh ,egats eht tes oT .snoitubirtsid nwodnu dedivorp serutaef eroc emos fo
:TEN. fo ysetruoc
seiranib MOC gnitsixE .gniht doog a )esruoc fo( si sihT :edoc gnitsixe htiw ytilibareporetni lluF •
noitacovnI mroftalP ,oslA .asrev eciv dna seiranib TEN. rewen htiw )poretni ,.e.i( elgnimmoc nac
eS C llac ot uoy swolla )ekovnIP( secivr - eht fo IPA gniylrednu eht gnidulcni( seirarbil desab
.edoc TEN. morf )metsys gnitarepo
U :noitargetni egaugnal latot dna etelpmoC • ssorc stroppus TEN. ,MOC ekiln - egaugnal
ssorc ,ecnatirehni - oitpecxe egaugnal gnildnah n ssorc dna , - egaugnal .gniggubed
TEN. lla yb derahs enigne emitnur nommoc A • - a si enigne siht fo tcepsa enO :segaugnal erawa
llew - TEN. hcae taht sepyt fo tes denifed - ”.sdnatsrednu“ egaugnal erawa
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 5
rf retlehs sedivorp yrarbil sihT :yrarbil ssalc esab A • mo IPA war fo seitixelpmoc eht dna sllac
TEN. lla yb desu ledom tcejbo tnetsisnoc a sreffo - .segaugnal erawa
iDI,nwonknUI,yrotcaFssalCI:gnibmulp MOC erom oN • live eht dna ,edoc LDI ,hctaps TNAIRAV
of os dna ,YARRAEFAS,RTSB( sepyt atad tnailpmoc p on evah )htr evitan a ni ecal .yranib TEN.
a retsiger ot deen on si ereht ,TEN. rednU :ledom tnemyolped deifilpmis ylurt A • tinu yranib otni
swolla TEN. ,eromrehtruF .yrtsiger metsys eht emas eht fo snoisrev elpitlum a no ynomrah ni tsixe
nac uoy sA .enihcam elgnis eht morf rehtag ylekil tsom mroftalp TEN. eht ,stniop tellub suoiverp
nI .)tfosorciM morf detanigiro skrowemarf htob taht tcaf eht dnoyeb( MOC htiw od ot gnihton sah
areporetni eht gnisu si rehto hcae htiw tcaretni nac sepyt MOC dna TEN. yaw ylno eht ,tcaf ytilib
.reyal
TEN. eht fo skcolB gnidliuB eht gnicudortnI 3.1
,TEN. yb dedivorp stifeneb eht fo emos wonk uoy taht woN )SLC dna ,STC ,RLC eht( mroftalP
.SLC dna ,STC ,RLC eht :elbissop lla ti ekam taht seititne )detalerretni dna( yek eerht weiverp s’tel
a dna tnemnorivne emitnur wen a sa dootsrednu eb nac TEN. ,weiv fo tniop s’remmargorp a morF
nur ehT .yrarbil ssalc esab evisneherpmoc - nommoc eht sa ot derrefer ylreporp si reyal emit
daol ,etacol ot si RLC eht fo elor yramirp ehT .RLC ro ,emitnur egaugnal sepyt TEN. eganam dna ,
wol fo rebmun a fo erac sekat osla RLC ehT .flaheb ruoy no - yromem sa hcus sliated level
eht si mroftalp TEN. eht fo kcolb gnidliub rehtonA .skcehc ytiruces gnimrofrep dna tnemeganam
noitacificeps STC ehT .STC ro ,metsyS epyT nommoC dna sepyt atad elbissop lla sebircsed ylluf
htiw tcaretni nac seititne eseht woh seificeps ,emitnur eht yb detroppus stcurtsnoc gnimmargorp
no noitamrofni erom( tamrof atadatem TEN. eht ni detneserper era yeht woh sliated dna ,rehto hcae
ni retal atadatem TEN. nevig a taht dnatsrednU .)retpahc siht - troppus ton thgim egaugnal erawa
a si )SLC( noitacificepS egaugnaL nommoC ehT .STC eht yb denifed erutaef yreve dna hcae
taht stcurtsnoc gnimmargorp dna sepyt nommoc fo tesbus a senifed taht noitacificeps detaler lla
SLC esopxe ylno taht sepyt TEN. dliub uoy fi ,suhT .no eerga nac segaugnal gnimmargorp TEN. -
TEN. lla taht derussa tser nac uoy ,serutaef tnailpmoc - .meht emusnoc nac segaugnal erawa
ht tcurtsnoc gnimmargorp ro epyt atad a fo esu ekam uoy fi ,ylesrevnoC sdnuob eht fo edistuo si ta
margorp TEN. yreve taht eetnaraug tonnac uoy ,SLC eht fo - ruoy htiw tcaretni nac egaugnal gnim
yrarbil edoc TEN. SLC/STC dna RLC eht ot noitidda nI seirarbiL ssalC esaB eht fo eloR ehT
sedivorp mroftalp TEN. eht ,snoitacificeps TEN. lla ot elbaliava si taht yrarbil ssalc esab a
hcus sevitimirp suoirav etaluspacne yrarbil ssalc esab siht seod ylno toN .segaugnal gnimmargorp
lanretxe suoirav htiw noitcaretni dna ,gniredner lacihparg ,)O/I( tuptuo/tupni elif ,sdaerht sa
ved erawdrah laer tsom yb deriuqer secivres fo rebmun a rof troppus sedivorp osla ti tub ,seci - dlrow
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 6
,ssecca esabatad etatilicaf taht sepyt enifed seirarbil ssalc esab eht ,elpmaxe roF .snoitacilppa
bew fo noitcurtsnoc eht dna ,ytiruces citammargorp ,noitalupinamLMX - ne sa llew sa( delba
elosnoc dna potksed lanoitidart - hgih a morF .sdne tnorf )desab
esab eht dna ,SLC ,STC ,RLC eht neewteb pihsnoitaler eht ezilausiv nac uoy ,level .yrarbil ssalc
elbaT eht ot sgnirB #C tahW 4.1
traped lacidar a hcus si TEN. taht neviG a depoleved sah tfosorciM ,seigolonhcet suoiverp morf eru
si #C .mroftalp wen siht rof yllacificeps ,)”prahs ees“ decnuonorp( #C ,egaugnal gnimmargorp wen
,revewoH .avaJ fo xatnys eht ot )lacitnedi ton tub( ralimis yrev skool taht egaugnal gnimmargorp a
ot pir avaJ a #C llac - fo stcurtsnoc lacitcatnys eht no desab era avaJ dna #C htoB .etaruccani si ffo
denaelc a syaw ynam ni si avaJ sa tsuJ .++C - denaelc a sa deweiv eb nac #C ,++C fo noisrev pu - pu
avaJ fo noisrev — fo ylimaf emas eht ni lla era yeht ,lla retfa .segaugnal
stcepsa suoirav retfa deledom era stcurtsnoc citcatnys s’#C fo ynam taht si rettam eht fo hturt ehT
epyt lamrof fo noiton eht stroppus #C ,6BV ekil ,elpmaxe roF .++C dna 0.6 cisaB lausiV fo
tes dna retteg lanoitidart ot desoppo sa( seitreporp sdohtem eralced ot ytiliba eht dna )sdohtem ret
daolrevo ot uoy swolla #C ,++C ekiL .)syarra retemarap aiv( stnemugra fo rebmun gniyrav gnikat
euD .)setageled aiv( snoitcnuf kcabllac dna ,snoitaremune ,serutcurts etaerc ot sa llew sa ,srotarepo
tcaf eht ot yllacitcatnys sa si taht tcudorp a si tluser eht ,segaugnal suoremun fo dirbyh a si #C taht
naelc — renaelc ton fi — hcum sa tuoba tsuj sedivorp dna ,6BV sa elpmis sa tuoba si ,avaJ naht
n a nI .)stib ylgu detaicossa eht tuohtiw( ++C sa ytilibixelf dna rewop egaugnal #C eht ,llehstu
TEN. rehto yb derahs era hcihw fo ynam( serutaef gniwollof eht sreffo - gnimmargorp erawa
:)segaugnal
noitalupinam retniop tcerid rof deen on evah yllacipyt smargorp #C !deriuqer sretniop oN •
ot nwod pord ot eerf era uoy hguohtla( .)yrassecen yletulosba fi level taht
pus ton seod #C ,siht neviG .noitcelloc egabrag hguorht tnemeganam yromem citamotuA • - a trop
eteled .drowyek
.seitreporp ssalc dna ,serutcurts ,snoitaremune rof stcurtsnoc citcatnys lamroF •
++C ehT • - ot ytiliba ekil ,.g.e( ytixelpmoc eht tuohtiw ,epyt motsuc a rof srotarepo daolrevo
.)melborp ruoy ton si ”gniniahc wolla ot siht* nruter“ ot erus gnikam
ralimis yrev xatnys a gnisu srebmem cireneg dna sepyt cireneg dliub ot ytiliba eht ,5002 #C fo sA •
setalpmet ++C ot .
ecafretni rof troppus lluF • - .seuqinhcet gnimmargorp desab
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 7
tcepsa rof troppus lluF • - fo dnarb sihT .setubirtta aiv seuqinhcet )POA( gnimmargorp detneiro
ieht yfilauq rehtruf ot srebmem rieht dna sepyt ot scitsiretcarahc ngissa ot uoy swolla tnempoleved r
.roivaheb
Pe hr aps the most i pm ortant point to und re s at nd about the C# language shipped
iw ht t eh M ci rosoft . TEN plat of rm is that ti can only prod cu e co ed that can e ex cute
tiw hin t eh .NET r nu mit e (you could n ve er use C# to ub ild a an tive COM es rver ro
a unm ana ged Win32 API a pp l ci a it on). ffO icially s ep aking, the et rm su de to
desc ir be the doc e targe it ng the EN. T run it me is deganam c edo . ehT b ni ary u tin ht at
c no t nia s t eh ganam ed c do e si term de na sa s me bly erom( sliated on assemb il es in
j su t a bit). C no ev rsely, oc de that onnac t be dir ce lt y host de by t eh N. TE r nu it me
is termed nu m degana oc de.
1.5 A idd t noi al .NET-Aw ra e Pr go ra mm ing La ugn ages
Unde sr t dna that C# is on t t eh o yln lan gaug e at rget ni g the EN. T lp atf ro m. hW en eht
. TEN lp a mroft aw s if r ts er vea el d to the eg ne ar l pu lb ic during the 2 00 0 M ci rosoft
seforP s anoi l veD el po e sr efnoC rence (PDC ,) se ev ral ven od rs annou ecn d t eh y ew re
ub sy bu li di gn . TEN -a raw e v noisre s of their er s ep ct evi co pm i srel . tA ht e mit e fo this
wr ti ing, zod ens of di ff er ne t al n ug a eg s have undergone .NET en gil htenm ne t. In
ad id tion to the evif al nguages that s ih p with Visual Studio 2005 (C#, J#, siV u la Basic
N. ET, aM na deg snoisnetxE rof ,++C and ircSJ tp EN. T ,) t eh re a er EN. T oc m elip sr for
S tllam la ,k OC BOL , dna csaP la t( o an me a fe )w . hguohtlA t ih s ob ok foc sesu a( ml tso )
e isulcx ev ly on ,#C Ta elb
1-1 stsil a nu rebm fo .N TE -enab el d orp gramming lang egau s and w ereh to el a nr m ro e
tuoba t meh od( eton taht eseht URLs a er us bj tce to hc a gn e).
efiL ni a litluM ang egau dlroW
As ved e ol pers fi sr t c mo e to dnu e sr at dn t eh l gna u ga e- nga os it c na rut e of EN. T,
num re ous uq es it sno arise. The om st preval ne t of eht se questions would have to be,
“If lla TEN. al n egaug s oc mpi el od wn to ganam‘ ed ,edoc ’ hw y od ew n dee om er naht
no e ”?relipmoc erehT era a ebmun r of ways to na swer t ih s q tseu i no . ,tsriF ew
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 8
sremmargorp era a yrev citrap u ral tol hw en ti oc em s to uo r ciohc e of rgorp ma im ng
gaugnal e lesym( f )dedulcni . So em of su ferp re lang au g se f llu of se im co ol ns and uc lr y
rb ekca ,st tiw h sa few egaugnal sdrowyek sa elbissop . tO h re s ne yoj a egaugnal taht
reffo s erom “human- ”elbadaer citcatnys ot k sne s( uch sa siV au l cisaB N. )TE . llitS
ot eh rs may w na t to le garev e ht e ri ma rfni a em sk lli s wh li e mo gniv to t eh N. TE lp a roft m (via
CO OB L N. E )T .
,woN eb tsenoh . fI tfosorciM erew ot ub i dl a is ngle o“ fficial” .NET la gn u ga e ht at
saw ed r evi d morf eht B SA IC fa im ly of lan ug a eg s, can you r ae l yl say a ll
rgorp amm re s ow uld be pah py tiw h t ih s choice? Or, if the only “official” .NET
langua eg was based o n Fortran syntax, imagine la l the fol sk uo t ereht ohw uow dl
erongi TEN. rehtegotla . esuaceB eht TEN. ur n emit t'ndluoc care sel s hcihw egaugnal
aw s used to build a block of m na ag de cod ,e .NET pr go ar mm ers c na ts ay urt e to
their s ny tactic prefe er n ec s, and sha er the compiled assembl ei s am no g aet mma et s,
departments, and ex et rnal o agr ni az it o sn (r age rdl se s of which N. TE l ugna age
ot sreh oohc se to esu ). nA o reht xe c tnelle udorpyb tc of int ge ar gnit av r uoi s . TEN
segaugnal otni a elgnis inu f dei rawtfos e os luti no is the simple af ct that a ll
rgorp a imm ng languag se ah ve their wo n sets fo streng ht s and we ka -nesses . roF
xe a ,elpm s emo mmargorp ni g la gn uages o ff er excellent tni rins ci s ppu ort rof
a decnavd htam ema lacit orp c se s gni . srehtO reffo roirepus oppus rt for f nani c lai
,snoitaluclac lacigol ,snoitaluclac noitcaretni htiw rfniam a em oc tupm e ,sr and so
htrof . hW en you take ht e s rt eng ht s of a part ci u al r pr argo mm ni g ugnal a eg a dn neht
ocni r etarop eht stifeneb dedivorp yb eht TEN. ,mroftalp ydobyreve sniw . Of cou ,esr in
reality ht e ahc n ec s are qu ti e good th ta you iw ll spend m cu h of y uo r t mi e bu li ding
os tf aw er gnisu ruoy EN. T gaugnal e of c ecioh . Ho ew ,rev once you learn ht e syntax of
no e EN. T lang au g ,e it is ev ry easy to mas et r anoth re . This is al os uq ite eb neficial,
es ep cially to t eh co sn ult na st of t eh ow rld. If your l na guage of cho ci e ah ppe sn to be
C#, but you are calp ed at a c eil nt s eti ht at sah c timmo ted to Visual aB sic EN. T, oy u
sh uo ld be able t o srap e ht e xe i ts ni g co ed body mla ost ni s at nt yl ( noh se t )! elihw still
nitnoc u gni ot egarevel ht e . EN T Frame ow rk. E hguon as id.
1.6 An O ev rview of .NET essA m eilb s
Re rag d sel s of wh ci h EN. T lang au ge you hc soo e ot rp ogram with, nu derstand that
sed p ti e the fact ht at .NET binaries take t eh sa em file extensi no as COM es rvers and
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 9
un am nag de Win32 bin ra ei s . eP hr a sp
om st mi por ,tnat TEN. anib r sei od ton atnoc in talp form-sp ce if ci inst ur c oit ns, ub t
rather lp ofta rm-agn itso c int emre diate langu ga e (IL) and t py e em tadata. ugiF er 1-2
hs ows the ib g picture of ht e story ht us f ra .
1 erugiF - TEN. llA .2 - atadatem dna snoitcurtsni LI time srelipmoc erawa .
etoN : si erehT D ”.LI“ noitaiverbba eht gnidrager edam eb ot tniop eno fo tnempoleved eht gniru
iffo eht ,TEN. htiw revewoH .)LISM( egaugnal etaidemretni tfosorciM saw LI rof mret laic eht
eht ,TEN. fo esaeler lanif .)LIC( egaugnal etaidemretni nommoc ot degnahc saw mret uoy sa ,suhT
tcaxe emas eht gnibircsed lla era LIC dna ,LISM ,LI taht dnatsrednu ,erutaretil TEN. eht daer
siht tuohguorht ”LIC“ noitaiverbba eht esu lliw I ,ygolonimret tnerruc eht htiw gnipeek nI .ytitne
.txet
seilbmessa ,snoitcurtsni LIC ot noitidda nI eht liated diviv ni sebircsed taht atadatem niatnoc osla
epyt eht ,raCstropS fi ,elpmaxe roF .yranib eht nihtiw gnivil ”epyt“ yreve fo scitsiretcarahc
yb detnemelpmi era secafretni hcihw ,ssalc esab s’raCstropS sa hcus sliated sebircsed atadatem
(raCstropS a si .epytraCstropSeht yb detroppus rebmem hcae fo noitpircsed lluf a sa llew sa ,)yna fi
era seiranib MOC ,wonk ydaerla yam uoy sA .atadatem epyt MOC ot tnemevorpmi citamard
a naht erom elttil si hcihw( yrarbil epyt detaicossa na gnisu debircsed yllacipyt fo noisrev yranib
si ti taht era noitamrofni epyt MOC htiw smelborp ehT .)edoc ]LDI[ egaugnaL noitinifeD ecafretnI
yllanretxe eht tnemucod ot yaw on sah edoc LDI taht tcaf eht dna tneserp eb ot deetnaraug ton
c eht rof deriuqer era taht srevres decnerefer ,tsartnoc nI .revres MOC tnerruc eht fo noitarepo tcerro
TEN. nevig a yb detareneg yllacitamotua si dna tneserp syawla si atadatem TEN. - .relipmoc erawa
gnisu debircsed osla era sevlesmeht seilbmessa,atadatem epyt dna LIC ot noitidda ni ,yllaniF
w ,atadatem eht tuoba noitamrofni sniatnoc tsefinam ehT .tsefinam a demret yllaiciffo si hcih
egami dna gnirts gnizilacol rof desu( noitamrofni erutluc ,ylbmessa eht fo noisrev tnerruc
of deriuqer era taht seilbmessa decnerefer yllanretxe lla fo tsil a dna ,)secruoser .noitucexe reporp r
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 01
elgniS 7.1 - seilbmessA elifitluM dna eliF
eno elpmis a si ereht ,sesac fo rebmun taerg a nI - ot - yranib eht dna a neewteb ecnednopserroc eno
eht taht redisoc ot efas si ti ,lld.* TEN. a gnidliub era uoy fi ,suhT .)exe.* rolld.*( elif dna yranib
ot derrefer ebksed elbatucexe na gnidliub era uoy fi ,esiwekiL .emas eht dna eno era ylbmessa eht
elgnis a evah elgnis a fo desopmoc si ylbmessa na fi ,gnikaeps yllacinhceT .flesti ylbmessa eht sa -
elgniS .ylbmessa elif - la niatnoc seilbmessa elif secen eht l na ni tsefinam detaicossa dna ,atadatem
llew ,elgnis ,suomonotua - .egakcap denifed
si hcihw fo hcae ,seiranib TEN. suoremun fo desopmoc era ,dnah rehto eht no ,seilbmessa elifitluM
seht fo eno ,ylbmessa elifitlum a gnidliub nehW .eludom a demret yramirp eht demret( seludom e
rof atadatem dna snoitcurtsni LIC ylbissop dna( tsefinam ylbmessa eht niatnoc tsum )eludom
.atadatem epyt dna ,LIC ,tsefinam level eludom a niatnoc seludom detaler rehto ehT .)sepyt suoirav
om yramirp eht ,tcepsus thgim uoy sA nihtiw seludom yradnoces deriuqer fo tes eht stnemucod elud
uoy nehW ?ylbmessa elifitlum a etaerc ot esoohc uoy dluow yhw ,oS .tsefinam ylbmessa eht
.noitpo tnemyolped elbixelf erom a htiw pu dne uoy ,seludom etercsid otni ylbmessa na noititrap
elpmaxe roF reh ro sih otno dedaolnwod eb ot sdeen taht ylbmessa etomer a gnicnerefer si resu a fi ,
tcurtsnoc ot eerf era uoy ,eroferehT .seludom deriuqer eht daolnwod ylno lliw emitnur eht ,enihcam
sa hcus( sepyt deriuqer yltneuqerf ssel yaw a hcus ni ylbmessa ruoy deman epyt a
apes a ni tpek era )rettamrofeRevirDdraH elgnis a ni decalp erew sepyt ruoy lla fi ,tsartnoc nI - elif
yam resu dne eht ,ylbmessa dedeen yllaer ton si taht atad fo knuhc egral a gnidaolnwod pu dne
y sa ,suhT .)emit fo etsaw a ylsuoivbo si hcihw( gnipuorg lacigol a yllaer si ylbmessa na ,ees nac uo
elgnis a sa denoisrev dna deyolped yllaitini eb ot dednetni era taht seludom detaler erom ro eno fo
.tinu
egaugnaL etaidemretnI nommoC eht fo eloR ehT 8.1
ssa TEN. rof leef retteb a evah uoy taht woN nommoc eht fo elor eht enimaxe s’tel ,seilbme
ralucitrap yna evoba stis taht egaugnal a si LIC .liated erom tib a ni )LIC( egaugnal etaidemretni
mroftalp - TEN. hcihw fo sseldrageR .tes noitcurtsni cificeps - eht ,esoohc uoy egaugnal erawa
relipmoc detaicossa laivirt a sledom edoc #C gniwollof eht ,elpmaxe roF .snoitcurtsni LIC stime
eht fo tamrof eht eciton od tub ,won rof xatnys tcaxe eht htiw flesruoy nrecnoc t’noD .rotaluclac
:ssalc claC
sc.claC //
;metsyS gnisu
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 11
elpmaxErotaluclaC ecapseman
{
salc sihT // .tniop yrtne s'ppa eht sniatnoc s
ssalc cilbup
{
)(niaM diov citats
{
;)(claC wen = c claC
;)48 sna tni
;)sna ,".}0{ si 48 + 01"(eniLetirW.elosnoC
.nwod gnittuhs erofeb yek retnE eht sserp ot resu rof tiaW //
;)(eniLdaeR.elosnoC
}
} // ehT #C .rotaluclac
cilbup ssalc
{
cilbup tni dA d tni( ,x tni )y
{ nruter x + ;y }
}
}
O cn e ht e C# c lipmo re ( sc xe.c e) comp li se ht is os ur ec co ed f li e, you end up iw ht a
si gn le-f li e * xe. e ssa me ylb taht tnoc a ni s a inam ef ts , CIL ni rts cu t oi sn , dna me dat a at
gnibircsed each as cep t of the C la c and C la cApp cl ssa es. roF example, if you were ot
epo n ht is assembly us ni g li dasm.e ex ( axe mined a lttil e lat re ni ht is ahc tp er), you
w uo ld f ni d t ah t t eh A dd () me oht d si repre es nted using
. cilbup dohtem gisybedih ecnatsni 23tni 23tni(ddA ,x 23tni )y lic deganam
{
// edoC ezis 8 )8x0(
.m sxa t kca 2
. tini slacol ]0[( 23tni )0000$1$SC
:0000_LI 1.gradl
:1000_LI 2.gradl
:2000_LI dda
claC
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 21
:3000_LI 0.colts
IL_ 000 4: .rb s 6000_LI
:6000_LI 0.coldl
:7000_LI ter
} // dne fo dohtem ddA::claC
Don t’ w ro yr if you ra e unable to make h dae s or tails fo the r use l nit g CIL for thi s
method—w lli descr bi e ht e ab s ci s of the C LI pr go ra imm ng al nguage. T eh po ni t ot
etartnecnoc no is ht at the C# compiler e im ts CIL, not platform-spe ic fic ni s rt uctions .
,woN llacer taht siht si t eur fo lla TEN. - erawa srelipmoc . To lli ustrat ,e a uss me you
cre ta de this same a cilpp ita no isu gn iV su la saB ic N. TE ( BV .NET ,) r ta eh r ht an #C '
bv.claC stropmI metsyS
ecapsemaN elpmaxErotaluclaC
' A BV TEN. 'eludoM' si a ssalc taht ylno sniatnoc
' citats srebmem .
eludoM ppAclaC
buS )(niaM
miD sna regetnI
miD c sA weN claC
sna = ,01(ddA.c )48
01"(eniLetirW.elosnoC + 48 si ,".}0{ )sna
Con los e eR. da L (eni )
dnE buS
dnE eludoM
ssalC claC
cilbuP noitcnuF Add laVyB( x sA ,regetnI laVyB y sA )regetnI sA etnI reg
nruteR x + y
dnE noitcnuF
dnE ssalC
dnE ecapsemaN
fI oy u exa im en t eh IC L of r t eh Ad (d ) me ,doht oy u fi dn s imi lar ins rt u tc ions
( ils g th ly
ewt aked by
ht e VB . EN T com ip el r):
sA
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 31
. cilbup dohtem 23tni(ddA 23tni ecnatsni ,x 23tni )y lic deganam
{
// edoC s ezi 9 )9x0(
.m sxa t kca 2
. slacol tini ]0[( 23tni )ddA
:0000_LI pon
:1000_LI 1.gradl
:2000_LI 2.gradl
:3000_LI fvo.dda
:4000_LI 0.colts
IL_ 000 5: .rb s 7000_LI
:7000_LI 0.coldl
:8000_LI ter
} // dne fo dohtem ddA::claC
neB efits of IC L
tA ht si p nio ,t y uo im g th eb ow nderi gn caxe ylt w ah t is ag i en d by c ilipmo gn os urce
co ed into CIL ra ht er ht an id re yltc to a s ep c ifi c ni struc noit es t. enO be ifen t si
la ugn age ni te rg ati no . sA you have alr ae dy s ee n, ea hc TEN. -aw era compiler
pr secudo aen rly i ed n it cal CIL i sn tr cu tio sn . ehT r rofe e, a ll nal guages era lba e to
ni teract wi ht in a we ll -defined binary a er na. ,eromrehtruF nevig taht LIC si mroftalp -
,citsonga eht TEN. krowemarF flesti si mroftalp - ,citsonga gnidivorp eht emas stifeneb
J ava srepoleved evah nworg demotsucca to ,.e.i( a s elgni edoc esab gninnur no
suoremun gnitarepo )smetsys . nI fac ,t reht e si an tni e lanoitanr sta dn ard for t eh C#
la ugn a ,eg dna a al rge subset fo the .NET platform na d pmi lem ne ta it sno already xe ist
for m yna non-Wi odn ws epo itar n g ys stems ( rom e ed iat ls ta ht e conc ul s oi n of ht si
tpahc re ). nI tsartnoc ot ,avaJ ,revewoh . TEN swolla uoy ot dliub snoitacilppa gnisu ruoy
egaugnal fo eciohc .
Comp ili ng CIL to lP a ft orm- epS cific In rts uc it ons
euD ot eht tcaf taht as mes b seil con niat LIC urtsni c ,snoit ehtar r ht an alp tfo mr -
s cep i if c snoitcurtsni , LIC edoc um st be moc p li ed on t eh f yl eb fo er esu . The ent ti y
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 41
that oc m ip el s CIL code i tn o em aningful CPU tsni r cu t noi s is et rmed a uj ts - ni -t mi e
(JIT ) c mo piler, cihw h emitemos s seog yb eht rf ie ldn y eman of tiJ ter. ehT N. ET ur ntime
ne vir mno ent segarevel a IJ T relipmoc rof e hca CPU t ra teg i gn ht e runti ae,em ch
opti zim ed for ht e gniylrednu lp a roft m. For axe mple, if you era ub ilding a . EN T
app il cation that is to eb ped l yo ed to a ah ndheld ed vice s( uch as a Pocket PC), the
c ro re ps o dn ing iJ tt re si we ll equipped to r nu within ol w-memory vne iro mn ent. On
eht rehto ha dn , if y uo a er de gniyolp uoy r sa es lbm y to a ba kc -end server ( hw ere
memory is seldom an i euss ) t eh Jitt re w li l eb opt mi i dez to f nu cti no in a high-
em om ry e vn i mnor ent . nI this way, ved elop re s nac write a single dob y fo edoc t ah t
nac be iffe c nei t yl J TI -co pm i el d and exe c detu on mac ih en s tiw h ffid erent
architec ut ser . uF r ,eromreht as a nevig rettiJ selipmoc LIC snoitcurtsni otni
gnidnopserroc enihcam ,edoc ti lliw ehcac eht re stlus ni me om ry in a mann re suit de ot
t eh ta tegr po re gnita ys stem. nI siht ,yaw fi a llac si edam ot a met doh nam de
rP ni tD co mu ne t() , t eh C LI i sn t cur tion s era oc pm il de into platform- eps cif ci ni s urt c snoit no
ht e if r ts covni ation a dn re eniat d in me om yr for etal r use. ,eroferehT eht txen emit
irP n ucoDt m (tne ) ac si ll ,de t eh r e i deen on s t o r oce mpil e t eh CIL.
.1 9 hT e R lo e of .NET Type Metadata
nI dda iti on to C LI ins rt cu it no s, a .NET as es lbm y oc tn ai sn f ,llu oc mplete, dna
cca u ar te met ada ta, ihw ch sebircsed hcae a dn eve yr ty ep (c al s ,s s curt t eru ,
en mu e ar tio ,n a dn s o )htrof nifed ed ni ht e ib nary, as we ll as t eh mem sreb of cae h
yt ep (pr po er it es, met doh s, ev ne ts, na d os on). Th na k uf l yl , it is always t eh j bo of t eh
oc mpil re n( ot t eh p or g ar mmer) ot e tim t eh latest dna gr ae et st yt pe me at - data .
ceB a esu . EN T met da a at is os iw cke ld y met ci ulous, sa semblies are oc mpletely self-
ed scribing en tit ei s—so m cu h ,os in af ct, ht at TEN. bina ir es h va e no need to be
regist re ed into ht e system reg tsi ry. T o lli ustrate ht e format of .NET t epy met ada t ,a
le ’t s ta ek a l koo at the metadata t ah t ha s detareneg rof the dA d() me ht do of the C#
C la c class you axe m eni d rp ve i suo ly ( ht e met ada ta g ne e ar ted rof ht e BV .NET ve sr ion
of the A (dd ) me ht od is s imi al r):
feDepyT 2# )30000020(
--- --- - --- -- - ---- - --- - -- -- - ---- -- ---- - --- - ---- - -- --- ---
yT p NfeD ema : C ucla otal rE max p aC.el lc (0 002 0 300 )
Flags ]cilbuP[ ]tuoyaLotuA[ ]ssalC[
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 51
A[ n lCis ssa ] [ eB iFerof e nIdl it] 100( 0 00 10 )
sdnetxE : 10000010 ]feRepyT[ tcejbO.metsyS
dohteM 1# )30000060(
--- --- - --- -- - ---- - --- - -- -- - ---- -- ---- - --- - ---- - -- --- ---
ddA 0060( 0 00 3)
[H Bedi y giS ] R[ e Sesu ol ]t 000( 00 0 68 )
VR A : 09020000x0
sgalFlpmI : ]LI[ ]deganaM[ )00000000(
Cal nCl v ntn :
sihTsah
:epyTnruteR
2 stnemugrA
tnemugrA :1#
tnemugrA :2#
2 sretemaraP
)1( nekoTmaraP : )10000080( emaN : x :sgalf ]enon[ )00000000(
)2( nekoTmaraP : )20000080( emaN : y :sgalf ]enon[ )00000000(
eM tadata is u des yb un merous asp ce ts of the N. ET ru mitn e vne ir no m ne ,t sa we ll as
by suoirav oleved pm ne t t sloo . oF r maxe p ,el ht e I tn ell neSi se ef uta re pr divo ed yb
iV sual oidutS adatem s’ylbmessa na gnidaer yb elbissop edam si 5002 ngised ta at
si atadateM .emit ggubed ,seitilitu gnisworb tcejbo suoirav yb desu osla ,sloot gni
relipmoc #C eht dna oremun fo enobkcab eht si atadatem ,erus eb oT .flesti TEN. su
gnidulcni seigolonhcet er dna ,secivres bew LMX ,gnidnib etal ,noitcelfer ,gnitom
.noitazilaires tcejbo
tsefinaM ylbmessA eht fo eloR ehT 01.1
lbmessa TEN. a taht rebmemer ,tsael ton tub tsaL taht atadatem sniatnoc osla y
finam a demret yllacinhcet( flesti ylbmessa eht sebircsed ,sliated rehto gnomA .)tse
eht iuqer seilbmessa lanretxe lla stnemucod tsefinam ot ylbmessa tnerruc eht yb der
rypoc ,rebmun noisrev s’ylbmessa eht ,yltcerroc noitcnuf os dna ,noitamrofni thgi
o boj eht syawla si ti ,atadatem epyt ekiL .htrof t relipmoc eht f eht etareneg o
eht fo sliated tnaveler emos era ereH .tsefinam s’ylbmessa
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 61
:tsefinamexe.rotaluclaCprahSC
bilrocsm nretxe ylbmessa.
{
) 98 0E 43 91 65 C5 A7 7B( = nekotyekcilbup.
0:0:0:2 rev.
}
rotaluclaCprahSC ylbmessa.
{
40080000x0 mhtirogla hsah.
ev. 0:0:0:0 r
}
exe.rotaluclaCprahSC eludom.
00000400x0 esabegami.
30000000x0 metsysbus.
215 tnemngila elif.
10000000x0 sgalfroc.
yb deriuqer seilbmessa lanretxe fo tsil eht stnemucod tsefinam siht ,llehstun a nI
e ylbmessa. eht aiv(exe.rotaluclaCprahSC suoirav sa llew sa )evitceridnretx
ylbmessa eht fo scitsiretcarahc
metsyS epyT nommoC eht gnidnatsrednU 11.1
fo dlrow eht nI ”.sepyt“ tcnitsid fo rebmun yna niatnoc yam ylbmessa nevig A
rf rebmem a ot refer ot desu mret cireneg a ylpmis si ”epyt“ ,TEN. ,ssalc{ tes eht mo
a gnisu snoitulos dliub uoy nehW .}etageled ,noitaremune ,ecafretni ,erutcurts
TEN. - roF .sepyt eseht fo hcae htiw tcaretni ylekil tsom lliw uoy ,egaugnal erawa
rebmun emos stnemelpmi taht ssalc elgnis a enifed yam ylbmessa ruoy ,elpmaxe fo
a sekat sdohtem ecafretni eht fo eno spahreP .secafretni na sa epyt noitaremune n
tupni aceR .rellac eht ot erutcurts a snruter dna retemarap epyT nommoC eht taht ll
metsyS pyt woh stnemucod taht noitacificeps lamrof a si )STC( denifed eb tsum se
redro ni ot slaudividni ylno eht ,yllacipyT .RLC eht yb detsoh eb ylpeed era ohw
htiw denrecnoc STC eht fo sgnikrow renni eht sloot gnidliub esoht era
eht tegrat tahtsrelipmocro/dna TEN. lla rof ,revewoh ,tnatropmi si tI .mroftalp TEN.
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 71
oh tuoba nrael ot sremmargorp w rieht ni STC eht yb denifed sepyt evif eht htiw krow ot
a si ereH .eciohc fo egaugnal .weivrevo feirb
sepyT ssalC STC
TEN. yrevE - eht ,tsael yrev eht ta ,stroppus egaugnal erawa hcihw ,epyt ssalc a fo noiton eht si
tcejbo fo enotsrenroc - rgorp detneiro gnimma desopmoc eb yam ssalc A .)POO( fo rebmun yna fo
dohtem ,seitreporp sa hcus( srebmem stniop atad dna )stneve dna ,s era sessalc ,#C nI .)sdleif(
gnisu deralced
.epyt ssalc #C A //
ssalc cilbup
{
)y tni ,x tni(ddA tni cilbup
} ;y + x nruter {
}
alC ss efiL ni gninaeM citsiretcarahC alc delaeS ?ton ro ”delaes“ ssalc eht sI sa noitcnuf tonnac sess
esab a noitcelloc a si ecafretni nA ?secafretni yna tnemelpmi ssalc eht seoD .sessalc rehto ot ssalc
t srebmem tcartsba fo neewteb tcartnoc a edivorp tah eht a swolla STC ehT .resu tcejbo dna tcejbo
elpmi ot ssalc .secafretni fo rebmun yna tnem sessalc tcartsbA ?etercnoc ro tcartsba ssalc eht sI
onnac era tub ,detaerc yltcerid eb t devired rof sroivaheb nommoc enifed ot dednetni .sepyt
eb nac sessalc etercnoC erc ?ssalc siht fo ”ytilibisiv“ eht si tahW .yltcerid deta eb tsum ssalc hcaE
derugifnoc nifed tiart siht ,yllacisaB .etubirtta ytilibisiv a htiw yb desu eb yam ssalc eht fi se
pleh etavirp a ,.g.e( ylbmessa gninifed eht nihtiw morf ylno ro ,seilbmessa lanretxe .)ssalc re
sepyT erutcurtS STC
TC eht rednu dezilamrof osla si erutcurts a fo tpecnoc ehT ,dnuorgkcab C a evah uoy fI .S uoy
resu eseht taht wonk ot desaelp eb dluohs - fo dlrow eht ni devivrus evah )sTDU( sepyt denifed
ffid tib a evaheb yeht hguohtla( TEN. eb nac erutcurts a ,tup ylpmiS .)dooh eht rednu yltnere
vah epyt ssalc thgiewthgil a sa fo thguoht eulav gni - roF .scitnames desab eht no sliated erom
.3 retpahC ees ,serutcurts fo seiteltbus tseb era serutcurts ,yllacipyT cirtemoeg gniledom rof detius
m dna ,atad lacitamehta ni detaerc era dna :drowyektcurts
.epyt erutcurts #C A //
tnioP tcurts
{
.sdleif niatnoc nac serutcurtS //
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 81
,soPx tni cilbup
.srotcurtsnoc deziretemarap niatnoc nac serutcurtS //
)y tni ,x tni(tnioP cilbup
};y = soPy ;x = soPx {
// rtS serutcu yam enifed .sdohtem
cilbup diov )(yalpsiD
{
,}0{("(eniLetirW.elosnoC ,"}1{ ,soPx ;)soPy
}
STC ecafretnI sepyT
secafretnI era n to hi gn more ht na a named collection of abs rt a tc member d ife n ti i no s,
which m ya be sup op r det ( ,.e.i mi ple em nted) yb a given c sal s or st ur erutc . lnU ike
CO ,M
a oc mm no sab e int re face such as knUI n nwo . nI ,#C
ecafretni sepyt era denifed gnisu eht afretni ce yek - row d, for examp el :
// A #C ecafretni epyt .
cilbup ecafretni warDI
{
diov ;)(warD
}
nO ht e ri own, in et rfac se are of ttil le u es . How eve ,r w neh a cla ss or str cu ture
mi pleme tn s a g vi ne i tn er af ce in ti s nu ique way, you are a lb e to uqer est ac ec ss to t eh
s pu p il de fu itcn ano til y isu ng na ni t cafre e refe cner e in a op yl morphic am nn re .
CTS nE um re ation Types
Enumera it ons are a h ydna rgorp ma gnim tcurtsnoc taht a ll o sw y uo ot gro pu
eulav/eman sriap . roF example, as us me you are cr ae it gn a vi ed o-game pa ilp ac it no
t ah t dluoc b dliu a tsuc om enu arem tion using t eh une m keyword:
// A #C noitaremune epyt .
mune cilbup epyTretcarahC
{
. EN T i tn e fr ca es od not d re evi
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 91
draziW = ,001
rethgiF = ,002
feihT = 003
}
By d afe u ,tl ht e s rot age used to oh ld each item is a 32-b ti ni et ge ;r h wo e rev , it is
op s is bl e to a tl er this s ot ar eg slot if een d be e( g. ., when pr go ra imm gn rof a low-
memory device su hc sa a oP ck te CP ). lA os , t eh STC deman sd that enumerat de types
ed ri ev rf mo a oc mm no esab class, syS t E.me num. As oy u wi ll see in ahC p ret 3, this ab se
c al ss defines a nu ebm r of inte er sti gn membe sr ht at a ll ow uoy to e tx r ca t,
mani up l ta e, a dn nart s of rm eht dnu erl gniy na em /va ul e riap s rp ogramm acita l yl .
CTS geleD a et Ty ep s
Dele ag set ra e ht e . EN T equiva el nt of a t epy -sa ef C-style function op in et r. hT e key
a .N TE delegate is a ssalc ht at deri sev fr mo
Sys met . luM it c Dtsa e gel ate , rather th na a simple op i tn er to a raw em mory ad rd e ss . nI
,#C delega et s ra e ed clar de using the d gele ate ek yword:
cilbup etageled tni tni(pOyraniB ,x tni ;)y
setageleD era lufesu nehw uoy hsiw ot edivorp a way of r eno ne t yti to of rwa dr a c lla
rehtona ot ,ytitne dna edivorp eht noitadnuof rof eht TEN. tneve erutcetihcra . tageled es
evah cisnirtni oppus rt rof gnitsacitlum ,.e.i( gnidrawrof a tseuqer ot elpitlum
)stneipicer dna suonorhcnysa dohtem snoitacovni .
STC T srebmeM epy
Now t ah t uoy evah rp eviewed ea hc fo the yt pes forma il dez yb the C ST , r ae il ze ht at
m tso yt ep s take na y num eb r of me ebm rs. F mro a ll y speaki gn , a ty ep member si
deniartsnoc yb eht set noc{ s rotcurt , ,rezilanif citats rtsnoc u tc o ,r en s det t py e,
ope tar o ,r ,dohtem porp e ,ytr rexedni , ,dleif daer ylno f dlei , constant, ve ne t}. The
TC S ed f ni e s av r oi us da“ orn nem ts” that may be associa et d iw th a ig ven mem eb r. roF
xe ampl ,e e ca h me ebm r has a g evi n iv is bility trait (e.g., p bu lic, pr vi ate, pro et cted, and
so for ht ) . Some mem eb rs may be d ce al red sa sba tr ca t to enforce a op lymor hp ic
vaheb ior no ed riv de t py es as well sa autriv l ot de nif e a c na ned (b tu ov re ri ad b )el
im lp em ne at t noi . Als ,o tsom srebmem may be noc figured as sta it c b( o dnu at t eh cl ssa
nereffid ce is ht a t
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 02
leve )l or i sn tan ec (bound at t eh o jb ce t le ev l). ehT noc st ur ction fo t py e mem eb sr is
axe mi den over t eh oc u esr of the n xe t ves e ar l ahc tp ers.
cisnirtnI STC taD a Ty sep
ehT lanif tcepsa fo eht STC ot eb a eraw of for ht e ti em nieb g si ht ta it e ts ba il s eh s a
well ed f deni set of co er da at t py es. tlA h guo h a given language typ ci ally ah s a unique
rowyek d u des to ed cla er an intrinsic CTS data t py e, a ll language k ye ow rds u itl mately
ssa me ylb na em d csm or d.bil ll . redisnoC lbaT e
1- ,3 wh hci cod u stnem woh yek STC da at yt pes are pxe er dess ni suoirav . EN T
ugnal a eg s .
Ta elb 1-3. ehT rtnI ni sic CTS D ata Types
ataD STC T epy BV N. ET eK yword #C eK yword deganaM
E snoisnetx of r ++C K wye dro
Sys met . tyB e yB te tyb e dengisnu rahc
Sys met . yBS te S yB te sb ty e dengis rahc
Sys met . tnI 16 S oh rt sh ro t trohs
Sys met . tnI 32 I tn e reg ni t ni t or gnol
Sys met . tnI 64 Long long 46tni__
Sys met . nIU t16 hSU ort u rohs t dengisnu trohs
Sys met . IU nt32 nIU t rege niu t dengisnu ni tor dengisnu gnol
Sys met . nIU t64 oLU ng ul no g dengisnu 46tni__
Sys met . niS gle niS gle olf at taolF
Sys met . uoD ble uoD ble uod ble elbuoD
Sys met . jbO ect jbO ect jbo ect O tcejb ^
Sys met . ahC r hC ar ahc r t_rahcw
Sys met . rtS ing rtS ing s nirt g S gnirt ^
Sys met . ceD ami l eD ci am l dec ami l lamiceD
Sys met . ooB ael n oB ol ae n ob ol looB
1. 21 U edn sr ta dn i gn the Co mm on Language Sp ce ifi ac oit n
As oy u era a ,eraw fid f tnere segaugnal xe p sser ht e s ma e orp g ar imm gn tsnoc r stcu in
,euqinu egaugnal cificeps smret . roF elpmaxe , ni C# uoy etoned s gnirt netacnoc a noit
vloser e to the as me ty ep ed fined in an
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 12
gnisu eht sulp rotarepo ,)+( elihw in BV .N TE uoy ty ip c lla y am ke use of t eh am ep r as dn
(&). nevE ehw n wt o id s cnit t la segaugn pxe ser s t eh same pr go ramma it c idiom (e.g ,. a
uf oitcn n tiw h no retu nr value ,) t eh chances are v re y doog that ht e s xatny w li l a pp ear
etiuq tnereffid no eht :ecafrus
' BV TEN. dohtem gninruter gnihton .
cilbuP buS )(dohteMyM
' emoS gnitseretni edoc ...
dnE buS
// #C dohtem gninruter .gnihton
cilbup diov )(dohteMyM
{
// emoS gnitseretni c edo . ..
}
As uoy ah ve a erl a yd seen, these im on r s ny tactic av riatio sn ra e in oc sn qe uential in t eh
. TEN ,emitnur g nevi taht ht e ser pe vitc e pmoc i el rs ( bv .c xe e ro xe.csc e, in
this ca es ) em ti a simi al r es t of CIL i sn rt u itc no s. Ho ew v re , l na gua eg s nac la so d fi fer
iw th ger a dr ot ht e ri ov re a ll el vel of functio an il ty. roF ,elpmaxe a TEN. egaugnal yam
ro yam ton evah a drowyek ot tneserper dengisnu ,atad dna yam ro yam ton troppus
retniop epyt s. neviG eseht elbissop ,snoitairav ti dluow eb laedi ot evah a enilesab ot
hcihw a ll
. TEN - erawa segaugnal era detcepxe ot mrofnoc . hT e Co mm no Langua eg
Sp ce ifica it no ( SLC ) is a es t of r lu es that ed scr bi e in v divi deta li t eh im in lam a dn
com lp e et set fo ef a serut a vig en .NET-awa er c ipmo ler must su tropp to rp o ud ec
code that nac be h so ted by the C RL , wh li e at the as me time be dessecca in a
unif ro m mann re by all l na gu ega s ht at t gra et the N. ET platform . In m na y w ya s, the
LC S ac n be viewed as a us bs te of the full f nu ctiona il yt defin de yb the CTS .
The CLS is itlu mately a set of ru el s that compi el r bu li d re s must conform to, if they
intend their products to cnuf it no sea lm e ss ly nihtiw ht e .NET nu ive sr e. E ca h rule is
ssa igned a s mi p el name (e.g ,. “CLS Rule 6”) and describ se how iht s rule affects
ht ose w oh bu li d t eh c lipmo ers as we ll as those who (in some w ya ) inte car t htiw
them. The emèrc ed al crè em of the C SL si the im thg y Rule :1
• uR el 1: CLS ru el s pa ply no ly to ht so e ap rts of a type that are expo es d ou ist de ht e
ye se of ht e
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 22
ed fini gn lbmessa y. viG en this rule, oy u can (correctly) ni fer ht at the remaining ru el s
of the CL S do n to app yl to t eh ol g ci used to ub i dl eht ni n re ow r gnik s of a N. ET pyt e.
The no yl a eps cts of a t py e t ah t m su t con of rm ot t eh CLS a er the me bm er
de tinif i no s eht mselv se .e.i( , nami gn conve tn i no ,s parameters, and er ut nr pyt es).
hT e mi pleme tn a oit n ol gic for a mem eb r m ya esu na y num reb of on n- LC S
t ce hniques , as the outs di e ow rld t’now k on w ht e di reff e cn e. si ton SLC - tnailpmoc , sa
eht para tem e sr a dn ter u nr va ul se make use of uns gi ned ad ta cihw( h is not a
requ ri e em nt of ht e LC S :)
cilbup lc ssa claC
{
// desopxE dengisnu atad si ton SLC !tnailpmoc
cilbup gnolu ddA ( gnolu ,x gnolu )y
{ nruter x + };y
}
,revewoH fi uoy erew ot mis p yl ekam esu fo u ngisn ed atad etni rn la ly sa
f lo l swo :
cilbup ssalc claC
{
cilbup tni tni(ddA ,x tni )y
{
// sA t sih gnolu elbairav si ylno desu ,yllanretni
// ew era llits SLC tnailpmoc .
gnolu ;pmet
...
nruter x + ;y
}
}
uoy evah llits demrofnoc to ht e r lu es of ht e C SL , dna ac n tser a ss ur de ht at all . TEN
lba e to i vn oke ht e dA d() m hte od. fO ,esruoc ni noitidda ot uR el ,1 eht
SLC senifed suoremun rehto selur . roF exampl ,e eht C SL ed cs ri seb how a given
l gna u ega um st r pe ser ent t xe t strin sg , how e un em itar no s shou dl be erper sented
in et rna yll ( ht e b sa e yt pe us de for egarots ,) h wo to d fe ni e ats tic em m eb r ,s dna so for ht .
,ylikcuL uoy t’nod evah ot timmoc eseht selur ot yromem ot eb a tneiciforp TEN.
eved l epo r. ,niagA yb dna ,egral na mitni a et gnidnatsrednu fo eht STC dna LC S
ugnal a eg s ra e
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 32
snoitacificeps si ylno fo tseretni ot relipmoc/loot sredliub .
nE s ru ing CLS Com lp ian ec
As y uo iw ll see over t eh cou sr e of this book, C# d eo s def ni e a numb re of
pr go ra imm ng noc structs that are on t SLC - oc mpliant. The oog d new ,s howev re , is
that you ca n ni struct ht e #C compiler to hc eck uoy r doc e for SLC oc pm lia ecn su i gn a
nis g el EN. T tta r tubi e:
// lleT eht #C relipmoc ot kcehc rof SLC .ecnailpmoc
a[ s bmes yl : yS ts SLC.me C lpmo i t(tna r eu )]
1.13 hT e Assem lb y/Nam se pace/Type Dis nit ct noi
hcaE fo su rednu s sdnat ht e impo tr a cn e of oc ed il braries. The iop nt of bil ar ir es s cu h
sa ,CFM ,EE2J and ATL is to gi ev deve ol pers a we ll -defined es t of exis it gn doc e ot
leverage ni their pa ilp ca oit sn . ,revewoH eht #C egaugnal seod ton emoc htiw a
egaugnal - cificeps edoc yrarbil . taR h ,re C# de srepolev evel r ga e the la gn ua eg -ne tu r la
. EN T l bi raries. To ek ep lla ht e epyt s wi iht n the base c al ss l bi ar seir llew orga ezin d, ht e
. TEN p mroftal kam se e netx s evi esu fo ht e na capsem e co pecn t. oT clarif ,y Fi ug re 1-4
sh swo a s rc een s oh t fo the Vi us al oidutS 2005 O ejb tc worB er u it l ti y. T sih tool all wo s
you ot xe a enim eht ssa e seilbm fer ere decn by ruoy tnerruc p jor e ,tc t eh an mes secap
iw thin a ap rticu al r sa es mbl ,y the t py es iw thin a gi ev n na sem pace, and the memb re s
of a ht at ld.bilrocsm l co tn ains am yn di eff r ne t names cap es, ea hc with its own
es mantical yl rela et d yt pes.
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 42
erugiF 1-4. A single a ss me bly can ah ve na y numb re of an em aps c se .
1.14 hT e A ss emb /yl Namespa ec /Ty ep D si ti tcn oi n
hcaE fo su rednu s sdnat ht e impo tr a cn e of oc ed il braries. The iop nt of bil ar ir es s cu h
sa ,CFM ,EE2J and ATL is to gi ev deve ol pers a we ll -defined es t of exis it gn doc e ot
leverage ni their pa ilp ca oit sn . ,revewoH eht #C egaugnal seod ton emoc htiw a
egaugnal - cificeps edoc yrarbil . taR h ,re C# de srepolev evel r ga e the la gn ua eg -ne tu r la
. EN T l bi raries. To ek ep lla ht e epyt s wi iht n t eh base c al ss l bi ar seir llew orga ezin d, ht e
. TEN pl mrofta kam se e netx s evi esu fo ht e na capsem e co pecn t. miS p yl pu ,t a
an m se pa ec is a gr puo ing of relat de typ se noc tai den in an as es mbly. roF xe amp ,el
Sys met .IO na ecapsem niatnoc s lif e I/O ler ated t epy s, the Sy mets . aD ta namespa ec senifed
cisab esabatad ,sepyt dna os no . tI si yrev tnatropmi ot tniop tuo taht a elgnis
ssa embly s( uc h as ocsm r d.bil ll) nac niatnoc yna bmun er fo na em spa ,sec ae ch of
ihw ch can niatnoc any nu bm er of ty sep .
ht e
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 52
1.15 eD olp ying the .NET R nu time
tI sho lu d come as no surpr si e t ah t EN. T assemblies can be ex ce uted only on a
am chine th ta sah ht e . TEN F ar mework ins at l el d. sA an individ au l hw o bu li ds .NET
softwa ,er this hs o lu d nev re be na si s ,eu sa uoy r tnempoleved am c nih e w li l eb
pr epo r yl noc f ugi er d at eht emit uoy tsni a ll eht yleerf elbaliava . TEN krowemarF
0.2 KDS (as llew as laicremmoc TEN. tnempoleved emnorivne nts hcus sa iV su la
tS u oid 2 00 5). ,revewoH fi uoy yolped an ylbmessa ot a co retupm ht at seod ton evah
TEN. i sn ellat d, it wi ll fail ot nur . F ro this rea os n, Mi rc osoft p or div es a set pu
package nameddo ent tf e.x xe t ah t ac n be rf ee yl pihs ped and installed along with uoy r
otsuc m softw era . sihT ni stall ta ion margorp si ni c edul d tiw h the .NET
Framework 2.0 DS K, and ti si also free yl d wo ln oad ba le from M ci rosoft. ecnO
entod t xe.xf e si ,dellatsni eht at tegr enihcam lliw won niatnoc eht TEN. esab ssalc
,seirarbil TEN. emitnur ( ocsm r .ee dll ,) a dn a dd i noit al . TEN erutcurtsarfni ( hcus sa eht
CAG ).
1.16 hT e Plat of rm- dnI ependent Nat ru e fo .NET
To close this ahc pter, a woll me to rb ief yl oc mment on t eh platform-i dn e nep d ne t
an t ru e of t eh .N TE lp a roft m. To t eh us rpri es of most ed velope sr , .NET as es mb il es
ac n be ed vel depo and ucexe t de on non - iM rc osoft op re gnita systems ( aM c SO X,
emun r uo s xuniL d noitubirtsi s, ,SOeB dna ,DSBeerF ot an me a few). oT dnu e sr t na d
how this i s po iss bl ,e oy u n dee to oc me to terms to ey t ona ther bba re iv ation in the
EN. T u in verse: LC I C( o mm on aL ng au ge nI fra ts ruc rut )e . Wh ne M ci rosoft re ael sed
t eh C# gorp immar ng al n ug ga e and the . TEN platfor ,m ti also craft de a set of formal
ucod m ne ts t ah t descri eb d the nys tax dna sem na it sc of eht C# dna CIL lang au g se , t eh
. TEN assemb yl format, core .NET na em space ,s and the em chanics of a hypothet ci al
. EN T runtime en ig ne k( nown as the V ri laut exE cu it no S sy te ,m or VE )S . Be tt er ey ,t
th se e mi tt de to Ecma In et nr at lanoi sa o ff laici in et rna noit al s dradnat s . ehT
etni fo snoitacificeps r a tse r e
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 62
TINU -2
snoitacilppA #C gnidliuB
dnammoC #C ehT 1.2 - )exe.csc( relipmoC eniL
ipmoc ot esu yam uoy seuqinhcet fo rebmun a era erehT noitidda nI .edoc ecruos #C el lausiV ot
driht suoirav sa llew sa( 5002 oidutS - t elba era uoy ,)sEDI TEN. ytrap etaerc o dnammoc #C eht -
,relipmoc enil C rof sdnatscsc erehw(exe.csc - TEN. eht htiw dedulcni si loot sihT .)relipmoC prahS
emarF eurt si ti elihW .KDS 0.2 krow t ediced reven yam uoy taht egral a dliub o - lppa elacs noitaci
dnammoc eht gnisu - enil u ot tnatropmi si ti ,relipmoc ot woh fo scisab eht dnatsredn nac I .dnah
:ssecorp eht no pirg a teg dluohs uoy snosaer wef a fo kniht
m uoy taht tcaf elpmis eht si nosaer suoivbo tsom ehT • h ton thgi lausiV fo ypoc a eva oidutS
.5002
.tnAN ro dliuBSM sa hcus sloot dliub detamotua fo esu ekam ot nalp uoY •
,snoitac dliub ot sEDI lacihparg esu uoy nehW .#C fo gnidnatsrednu ruoy nepeed ot tnaw uoY •
talupinam ot wohexe.csc gnitcurtsni yletamitlu era uoy tupni #C ruoy e . yb ecin rehtonA - tcudorp
gnitalupinam elbatrofmoc erom hcum taht emoceb uoy taht si war eht niexe.csc htiw gnikrow fo
dnammoc rehto - ees lliw uoy sA .KDS 0.2 krowemarF TEN. eht htiw dedulcni sloot enil
ropmi fo rebmun a ,koob siht tuohguorht .enil dnammoc eht morf ylno elbissecca era seitilitu tnat
dnammoC #C eht gnirugifnoC - #C eht fo esu ekam ot nigeb nac uoy erofeB relipmoC eniL
dnammoc - fI .exe.csc fo ecnetsixe eht sezingocer enihcam tnempoleved ot deen uoy ,relipmoc enil
on si enihcam ruoy yrotcerid eht ot htap lluf eht yficeps ot decrof era uoy ,yltcerroc derugifnoc t
ot enihcam tnempoleved ruoy piuqe oT .selif #C ruoy elipmoc nac uoy erofebexe.csc gniniatnoc
eseht wollof ,yrotcerid yna morf selifsc.* elipmoc
:)ylthgils reffid
thgiR .1 - ilc pop eht morf seitreporP tceles dna noci retupmoC yM eht kc - .unem pu
.nottub selbairaV tnemnorivnE eht kcilc dna bat decnavdA eht tceleS .2
elbuoD .3 - .xob tsil selbairaV metsyS eht morf elbairav htaP eht kcilc
eht fo dne eht ot enil gniwollof eht ddA .4 eht ni eulav hcae eton( eulav htaP tnerruc
:)nolocimes a yb detarapes si elbairav htaP
:C \ swodniW \ TEN.tfosorciM \ krowemarF \ 51205.0.2v
eht fo noitacol dna noisrev tnerruc ruoy no desab detsujda eb ot deen yam yrtne ruoy ,esruoc fO
( KDS 0.2 krowemarF TEN. uoy ecnO .)rerolpxE swodniW gnisu kcehc ytinas a od ot erus eb os
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 72
ni nepo swodniw dnammoc yna gnisolc yb nur tset a ekat yam uoy ,elbairav htaP eht detadpu evah
gniretne dna wodniw dnammoc wen a gninepo neht dna ,)sgnittes eht timmoc ot( dnuorgkcab eht
sc ?/ c
#C eht yb detroppus snoitpo fo tsil a ees dluohs uoy ,yltcerroc pu sgniht tes uoy fI
.relipmoc
dnammoC TEN. lanoitiddA gnirugifnoC - slooT eniL
ot elbairav htaP lanoitidda gniwollof eht dda ,exe.csc etagitsevni ot nigeb uoy erofeB
metsyS eht
erid :)yrotc
:C \ seliF margorP \ 8 oidutS lausiV tfosorciM \ KDS \ 0.2v \ niB
dnammoc lanoitidda sniatnoc yrotcerid siht taht llaceR - ylnommoc era taht sloot enil
eb won dluohs uoy ,dehsilbatse shtap owt eseht htiW .tnempoleved TEN. gnirud desu
u TEN. yna nur ot elba siht mrifnoc ot hsiw uoy fI .wodniw dnammoc yna morf ytilit
dna ,wodniw dnammoc wen a nepo ,swodniw dnammoc nepo yna esolc ,gnittes wen
fo snoitpo eht weiv ot dnammoc gniwollof eht retne
?/ litucag
exe.csc gnisU snoitacilppA #C gnidliuB 2.2
taht woN elgnis elpmis a dliub ot si laog txen eht ,exe.csc sezingocer enihcam tnempoleved ruoy
dnammoc #C eht gnisuexe.ppAtseT deman ylbmessa elif - uoy ,tsriF .dapetoN dna relipmoc enil
:gniwollof
.noitacilppa #C elpmis A //
;metsyS gnisu
ppAtseT ssalc
{
lbup )(niaM diov citats ci
{
;)"3 ,2 ,1 !gnitseT"(eniLetirW.elosnoC
}
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 82
:C ,.g.e( noitacol tneinevnoc a ni elif eht evas ,dehsinif evah uoy ecnO \ .sc.ppAtseT )elpmaxEcsC
t si tseretni fo tniop tsrif ehT .relipmoc #C eht fo snoitpo eroc eht wonk ot teg s’tel ,woN o
noitacilppa elosnoc a ,.g.e( etaerc ot ylbmessa fo epyt dna eman eht yficeps ot woh dnatsrednu
hcaE .)htrof os dna ,exe.ppAniWyM deman noitacilppa smroF swodniW a ,lld.biLhtaM deman
oc a saexe.csc otni dessap galf cificeps a yb detneserper si ytilibissop dnamm - enil
2 elbaT ees( retemarap - 2 elbaT .)2 - tuptuO .2 - relipmoC #C eht fo snoitpO cirtnec
eht ,tluafed yB .detaerc eb ot ylbmessa eht fo eman eht yficeps ot desu si noitpo sihT tuo/
i( elif sc.* tupni laitini eht fo eman eht sa emas eht si eman ylbmessa eht ro )lld.*a fo esac eht n
epyt eht fo eman
.)exe.* na fo esac eht ni( dohtem)(niaM
tuptuo elif tluafed eht si sihT .noitacilppa elosnoc elbatucexe na sdliub noitpo sihT exe:tegrat/
siht gnidliub nehw dettimo eb yam suht dna ,epyt at/ .epyt noitacilppa noitpo sihT yrarbil:tegr
elgnis a sdliub - era seludoM .eludom a sdliub noitpo sihT eludom:tegrat/ .ylbmessalld.* elif
elifitlum fo stnemele .)11 retpahC ni debircsed ylluf( seilbmessa
swodniW dliub ot eerf era uoy hguohtlA exeniw:tegrat/ - noitacilppa desab .s
gniniatnoc eht ot egnahc ,exe.ppAtseT deman noitacilppa elosnoc a otnisc.ppAtseT elipmoc oT
dnammoc taht eton( tes dnammoc gniwollof eht retne dna elif edoc ecruos ruoy - tsum sgalf enil
:)retfa ton ,selif tupni eht fo eman eht erofeb emoc e:tegrat/ csc ton did I ereH sc.ppAtseT ex
taht nevig ,exe.ppAtseT deman eb lliw elbatucexe eht erofereht ,galftuo/ na yficeps ylticilpxe
taht erawa eb oslA .)dohtem)(niaM eht( tniop yrtne s’margorp eht gninifed ssalc eht sippAtseT
troppus sgalf relipmoc #C eht fo tsom nac uoy( tegrat/ naht rehtart/ sa hcus ,noisrev detaiverbba na
sc.ppAtseT exe:t/ csc :)tpmorp dnammoc eht ta?/ csc gniretne yb snoitaiverbba lla weiv
osla dluoc uoy ,relipmoc #C eht yb desu tuptuo tluafed eht si galfexe:t/ eht taht nevig ,eromrehtruF
ipmoc eht morf nur eb won nacexe.ppAtseT sc.ppAtseT csc gnipyt yb ylpmissc.ppAtseT el
.enil dnammoc
seilbmessA lanretxE gnicnerefeR
etarapes a ni denifed sepyt fo esu sekam taht noitacilppa na elipmoc ot woh enimaxe s’tel ,pu txeN
w fo gnikaepS .ylbmessa TEN. eht ot ecnerefer ruoy woh gnirednow era uoy esac ni tsuj ,hcih
.)galfbildtson/ siht elbasid ot hsiw uoy nosaer egnart emos rof fi( morf llacer ,epytelosnoC.metsyS
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 92
cilppappAtseT eht etadpu s’tel ,seilbmessa lanretxe gnicnerefer fo ssecorp eht etartsulli oT ot noita
ruoy nepO .xob egassem smroF swodniW a yalpsid
:swollof sa ti yfidom dna elifsc.ppAtseT
;metsyS gnisu
!siht ddA //
;smroF.swodniW.metsyS gnisu
ppAtseT ssalc
{
)(niaM diov citats cilbup
{
;)"3 ,2 ,1 !gnitseT"(eniLetirW.elosnoC
!siht ddA //
seM ;)"...olleH"(wohS.xoBegas
}
}
drowyekgnisu #C eht aiv ecapsemansmroF.swodniW.metsyS eht ot ecnerefer eht ecitoN
desu secapseman eht tsil ylticilpxe uoy nehw taht llaceR .)1 retpahC ni decudortni(
sc.* nevig a nihtiw
tiw seliF ecruoS elpitluM gnilipmoC exe.csc h
edoc ecruossc.* elgnis a gnisu detaerc saw noitacilppaexe.ppAtseT eht fo noitanracni tnerruc ehT
,elifsc.* elgnis a ni denifed sepyt TEN. ruoy fo lla evah ot elbissimrep yltcefrep si ti elihW .elif
lifsc.* elpitlum fo desopmoc era stcejorp tsom .elbixelf erom tib a esab edoc ruoy peek ot se
:sc.gsMolleH deman elif wen a ni deniatnoc ssalc lanoitidda na derohtua evah uoy emussA
ssalc egasseMolleH ehT //
;metsyS gnisu
;smroF.swodniW.metsyS gnisu
egasseMolleH ssalc
{
)(kaepS diov cilbup
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 03
{
gasseM ;)"...olleH"(wohS.xoBe
}
}
tuo tnemmoc dna ,epyt wen siht fo esu ekam ot ssalcppAtseT laitini ruoy etadpu ,woN
erp eht
;metsyS gnisu
.eromyna siht deen t'noD //
;smroF.swodniW.metsyS gnisu //
ppAtseT ssalc
{
)(niaM diov citats cilbup
{
etirW.elosnoC ;)"3 ,2 ,1 !gnitseT"(eniL
.rehtie eromyna siht deen t'noD //
;)"...olleH"(wohS.xoBegasseM //
!ssalc egasseMolleH eht esicrexE //
;)(egasseMolleH wen = h egasseMolleH
;)(kaepS.h
}
}
csc :ylticilpxe elif tupni hcae gnitsil yb selif #C ruoy elipmoc nac uoY
swolla relipmoc #C eht ,evitanretla na sA sc.gsmolleh sc.ppatset lld.smroF.swodniW.metsyS:r/
ni deniatnoc selifsc.* lla edulcni otexe.csc mrofni ot )*( retcarahc dracdliw eht fo esu ekam ot uoy
yS:r/ csc :dliub tnerruc eht fo trap sa yrotcerid tcejorp eht sc.* lld.smroF.swodniW.mets uoy nehW
si snoitacilppa owt eht neewteb ecnereffid ylno ehT .lacitnedi si tuptuo eht ,niaga margorp eht nur
.selif elpitlum gnoma tilps neeb sah cigol tnerruc eht taht tcaf eht
seilbmessA lanretxE elpitluM gnicnerefeR
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 13
a nO miS ?exe.csc gnisu seilbmessa lanretxe suoremun ecnerefer ot deen uoy fi tahw ,eton detaler
:swollof egasu elpmas emos tub ,elpmaxe tnerruc eht rof seilbmessa lanretxe elpitlum yficeps
sc.* lld.gniwarD.metsyS;lld.smroF.swodniW.metsyS:r/ csc
iw gnikroW 3.2 seliF esnopseR exe.csc ht
ruoy ,tpmorp dnammoc eht ta noitacilppa #C xelpmoc a dliub ot erew uoy fi ,sseug thgim uoy sA
pleh oT .selif tupnisc.* suoremun yficeps taht sgalf eht ni epyt uoy sa niap fo lluf eb dluow efil
c #C eht ,nedrub gnipyt ruoy nessel selif esnopser #C .selif esnopser fo esu eht sronoh relipmo
)esnopser(psr.*a ni tnerruc ruoy fo noitalipmoc eht gnirud desu eb ot snoitcurtsni eht lla niatnoc
eht sniatnoc tahtpsr.ppAtseT deman elif esnopser a detaerc evah uoy taht emussA .noisnetxe
wollof era stnemmoc ,ees nac uoy sa( stnemugra gni
:)retcarahc# eht htiw detoned
elif esnopser eht si sihT #
ppa exe.ppAtseT eht rof #
.2 retpahC fo #
.secnerefer ylbmessa lanretxE #
lld.smroF.swodniW.metsyS:r/
dracdliw gnisu( elipmoc ot selif dna tuptuo # .)xatnys
sc.* exe.ppAtseT:tuo/ exe:tegrat/
era uoy eb ot selif edoc ecruos #C eht sa yrotcerid emas eht ni devas si elif siht gnimussa ,woN
eht fo esu eht eton( swollof sa noitacilppa eritne ruoy dliub ot elba
psr.ppAtseT@ csc:)lobmys@
luohs deen eht fI ,.g.e( tupni sa selifpsr.* elpitlum yficeps ot elba osla era uoy ,esira d
od ,hcaorppa siht ekat uoy fI .)psr.eliFdrihT@ psr.eliFdnoceS@
!deretnuocne era yeht sa snoitpo dnammoc eht sessecorp relipmoc
a ni snoitpo edirrevo nac elifpsr.* retal a ni stnem
dirrevo eb lliw elif esnopser a erofeb enil dnammoc eht no ylticilpxe detsil sgalf taht eton oslA
retne
exe.ppAlooCyM:tuo/ csc
,)exe.ppAlooCyM naht rehtar(exe.ppAtseT eb llits dluow ylbmessa eht fo eman eht
eht nevig
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 23
ht ni detsil galfexe.ppAtseT:tuo/ ehT retfa sgalf tsil uoy fi ,revewoH .elif esnopserpsr.ppAtseT e
)psr.csc( eliF esnopseR tluafeD
na sah relipmoc #C eht taht si selif esnopser gnidrager edam eb ot tniop lanif ehT
sa yrotcerid emas eht ni detacol si hcihw ,)psr.csc( elif esnopser
rciM TEN.tfoso \ krowemarF \ dnif lliw uoy ,dapetoN gnisu elif siht nepo ot erew uoy fI .)51205.0.2v
,exe.csc gnisu smargorp #C ruoy gnidliub era uoy nehW .galf:r/ eht gnisu deificeps neeb ydaerla
c a ylppus uoy nehw neve ,decnerefer yllacitamotua eb lliw elif siht eht neviG .elifpsr.* motsu
tnerruc eht ,elif esnopser tluafed eht fo ecneserp
dnammoc gniwollof eht gnisu delipmoc yllufsseccus eb dluoc noitacilppaexe.ppAtseT
:)psr.csc nihtiw decnerefer silld.smroF.swodniW.metsyS sa( tes
sc.* exe.ppAtseT:tuo/ csc
ht nI nac uoy ,psr.csc fo gnidaer citamotua eht elbasid ot hsiw uoy taht tneve e
:noitpogifnocon/ eht yficeps
gifnocon/ psr.ppAtseT@ csc
dnammoc #C eht ,ylsuoivbO - ot desu eb nac taht snoitpo rehto ynam sah relipmoc enil
lbmessa TEN. gnitluser eht woh lortnoc erom nrael ot hsiw uoy fI .detareneg eb ot si y
htiw gnikroW“ deltit elcitra ym pu kool ,exe.csc fo ytilanoitcnuf
.moc.tfosorcim.ndsm//:ptth ta enilno ”relipmoC eniL dnammoC 0.2 #C eht
dnammoC ehT 4.2 - )exe.gbdroc( reggubeD eniL
ruo ot no gnivom erofeB ot ekil dluow I ,daPtxeT gnisu snoitacilppa #C gnidliub fo noitanimaxe
loot sihT .exe.gbdroc dema a htiw pihs seod KDS 0.2 krowemarF TEN. eht taht tuo tniop ylfeirb
yb meht weiv yam uoY .ylbmessa ruoy gubed ot uoy wolla taht snoitpo fo snezod sedivorp
eps :galf ?/ eht gniyfic
?/ gbdroc
2 elbaT - yb dezingocer sgalf eht fo )lla ton ylniatrec tub( emos stnemucod 3
htiw(exe.gbdroc
.noisses gniggubed a deretne evah uoy ecno )noitaton dnahtrohs evitanretla eht
2 elbaT - dnammoCexe.gbdroc lufesU fo lufdnaH A .3 - sgalF eniL
efiL ni gninaeM galF
.stniopkaerb tnerruc yalpsid ro teS ]kaer[b
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 33
.stniopkaerb erom ro eno evomeR ]ete[led
.reggubed eht tixE ]ti[xe
txen gnittih litnu ssecorp tnerruc eht gniggubed eunitnoC ]o[g
.tniopkaerb
f tnerruc eht fo tuo petS ]tu[o .noitcnu
.).cte ,stnemugra ,lacol( selbairav dedaol lla tnirP ]tnir[p
.enil txen eht otni petS is
.enil txen eht revo petS os
rehtob ton lliw I ,5002 oidutS lausiV eht fo esu ekam ot esoohc lliw uoy fo tsom taht emussa I sA
fo galf hcae no tnemmoc ot eht ,detseretni era ohw uoy fo esoht rof ,revewoH .exe.gbdroc
klaw laminim a stneserp noitces gniwollof - eht ta gniggubed fo ssecorp cisab eht fo hguorht
.enil dnammoc
eniL dnammoC eht ta gniggubeD
,exe.gbdroc gnisu noitacilppa ruoy gubed nac uoy erofeB gniggubed etareneg ot si pets tsrif eht
ot ,elpmaxe roF .exe.csc fo galfgubed/ eht gniyficeps yb noitacilppa tnerruc ruoy rof slobmys
gniwollof eht retne ,exe.ppAtseT rof atad gniggubed etareneg
:tes dnammoc
gubed/ psr.ppatset@ csc
wen a setareneg sihT bdp.* detaicossa na evah ton od uoy fI .bdp.ppatset )esac siht ni( deman elif
ruoy weiv ot elba eb ton lliw uoy ,revewoh ;exe.gbdroc fo esu ekam ot elbissop llits si ti ,elif
EDI TEN. oidutS lausiV ,ehT gnisU 5.2
pmis gnitaerc rof enif si dapetoN elihW yaw eht ni gnihton sreffo ti ,smargorp TEN. el
,steppins edoc ,gniroloc drow taht rotide na gnisu selifsc.* rohtua ot laedi eb dluow tI .ytivitcudorp
.daPtxeT :tsixe seod loot a hcus ,ti evah dluow kcul sA .relipmoc #C a htiw noitargetni dna
na si daPtxeT gnimmargorp suoremun rof edoc elipmoc dna rohtua ot esu nac uoy rotide
esu ot elpmis yrev si ti taht tcaf eht si tcudorp siht fo egatnavda feihc ehT .#C gnidulcni ,segaugnal
aPtxeT .stroffe gnidoc ruoy ecnahne ot seltsihw dna slleb hguone tsuj sedivorp dna ot etagivan ,d
uoy ecnO .)gnitirw siht fo emit eht ta noisrev tnerruc eht daolnwod dnamoc.daptxet.www//:ptth
erutaef a evah lliw uoy ,tcudorp eht dellatsni evah - loot siht ,revewoh ;daPtxeT fo noisrev etelpmoc
.eraweerf ton si
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 43
:sserpxE 5002 cisaB lausiV • ecivon rof laedi loot gnimmargorp denilmaerts A
resu eht gnisu snoitacilppa dliub ot woh nrael ot tnaw ohw sremmargorp - xatnys yldneirf
#J lausiV dna ,sserpxE 5002 ++C lausiV ,sserpxE 5002 #C lausiV TEN. cisaB lausiV fo
s rof sEDI detegraT :sserpxE 5002 eht nrael ot hsiw ohw stsaisuhtne dna stnedut
eciohc fo xatnys rieht ni ecneics retupmoc fo slatnemadnuf
yrtne nA :sserpxE 5002 revreS LQS • - drawot deraeg metsys tnemeganam esabatad level
srepoleved tneduts dna ,stsaisuhtne ,stsiybboh
sA yeK rehtO 6.2 EDI TEN.SV eht fo stcep
ton si ytilibapac siht tub( yllausiv sessalc ngised ot ytiliba eht su sevig 5002 oidutS lausiV
yfidom dna weiv ot uoy swolla ytilitu rengiseD ssalC ehT .)sserpxE 5002 #C lausiV ni dedulcni
,sessalc( sepyt eht fo spihsnoitaler eht ruoy ni )setageled dna ,snoitaremune ,serutcurts ,secafretni
dna epyt a )morf ro( ot srebmem )evomer ro( dda yllausiv ot elba era uoy ,loot siht gnisU .tcejorp
C nevig a yfidom uoy sa ,llew sA .elif #C gnidnopserroc eht ni detcelfer snoitacifidom ruoy evah #
,5002 oidutS lausiV fo tcepsa siht htiw krow oT .margaid ssalc eht ni detcelfer era segnahc ,elif
ot si hcihw fo eno ,os od ot syaw ynam era erehT .elif margaid ssalc wen a tresni ot si pets tsrif eht
ituloS no detacol nottub margaiD ssalC weiV eht kcilc edis thgir s’rerolpxE no
sevitceriD rossecorperP #C 7.2
uoy wolla taht slobmys suoirav fo esu eht stroppus #C ,ylimaf C eht ni segaugnal rehto ynam ekiL
,sevitcerid rossecorperp #C suoirav gninimaxe erofeB .ssecorp noitalipmoc eht htiw tcaretni ot
’tel nI .etarucca yleritne ton si ”evitcerid rossecorperp #C“ mret ehT .tcerroc ygolonimret ruo teg s
,#C nI .segaugnal gnimmargorp ++C dna C eht htiw ycnetsisnoc rof ylno desu si mret siht ,ytilaer
gnissecorperp ,rehtaR .pets gnissecorperp etarapes on si ereht fo trap sa dessecorp era sevitcerid
sevitcerid rossecorperp #C eht fo xatnys eht ,esac yna nI .relipmoc eht fo esahp sisylana lacixel eht
syawla era sevitcerid eht taht ni ,ylimaf C eht fo sreb mem rehto eht fo taht ot ralimis yrev si
op eht htiw dexiferp 9 elbaT .)#( ngis dnu - sevitcerid desu ylnommoc erom eht fo emos senifed 4
.)sliated etelpmoc rof noitatnemucod KDS 0.2 krowemarF TEN. eht tlusnoc(
9 elbaT - sevitceriD rossecorperP #C nommoC .4
efiL ni gninaeM sevitceriD
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 53
s kram ot desU noigerdne#,noiger# edoc ecruos elbispalloc fo snoitce
slobmys noitalipmoc lanoitidnoc enifednu dna enifed ot desU fednu#,enifed#
desab( edoc ecruos fo snoitces piks yllanoitidnoc ot desU fidne#,esle#,file#,fi#
no
)slobmys noitalipmoc deificeps
snoigeR edoC gniyficepS
P dnanoiger# era sevitcerid rossecorperp lla fo lufesu tsom eht fo emos spahre
gnisU .noigerdne#
pleh nac snoiger fo esU .rekram lautxet yldneirf a
maxe roF .elbaeganam erom selifsc.* yhtgnel peek
f os dna ,seitreporp epyt rof rehtona ,srotcurtsnoc s’epyt :htro
raC ssalc
{
;emaNtep gnirts etavirp
;pSrruc tni etavirp
srotcurtsnoC noiger#
)(raC cilbup
...
)emaNtep gnirts ,pSrruc tni(raC raC cilbup
}...{
noigerdne#
seitreporP noiger#
deepS tni cilbup
} ... {
emaN gnirts cilbup
}...{
noigerdne#
}
8.2 tnemnorivnE.metsyS ehT :edisA gnitseretnI nA
ssalC
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 63
ot uoy swolla ssalc sihT .liated retaerg ni ssalctnemnorivnE.metsyS eht enimaxe s’teL
mun a niatbo
etadpu ,ssenlufesu s’ssalc siht etartsulli oT .srebmem citats
l gniwollof eht htiw dohtem)(niaM ruoy :cigo
)sgra ][gnirts(niaM tni citats cilbup
{
...
?ppa siht gninnur SO //
;)noisreVSO.tnemnorivnE ," }0{ :SO tnerruC"(eniLetirW.elosnoC
?ppa siht gniniatnoc yrotceriD //
," }0{ :yrotceriD tnerruC"(eniLetirW.elosnoC
;)yrotceriDtnerruC.tnemnorivnE
// .enihcam siht no sevird eht tsiL
;)(sevirDlacigoLteG.tnemnorivnE = sevird ][gnirts
)++i ;htgneL.sevird < i ;0 = i tni(rof
;)]i[sevird ,i ," }1{ : }0{ evirD"(eniLetirW.elosnoC
?ppa siht gninnur si mroftalp TEN. eht fo noisrev hcihW //
E"(eniLetirW.elosnoC ," }0{ :TEN. fo noisrev gnitucex
;)noisreV.tnemnorivnE
...
}
eht ni detneserp esoht naht rehto srebmem senifed epyttnemnorivnE.metsyS ehT
suoiverp
3 elbaT .elpmaxe - erus eb ,revewoh ;tseretni fo seitreporp lanoitidda emos stnemucod 1
EN. eht tuo kcehc ot .sliated lluf rof noitatnemucod KDS 0.2 krowemarF T
3 elbaT - tnemnorivnE.metsyS fo seitreporP tceleS .1
ytreporP efiL ni gninaeM
emaNenihcaM enihcam tnerruc eht fo eman eht steG
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 73
eniLweN tnemnorivne tnerruc eht rof lobmys enilwen eht steG
rP tnuoCrosseco enihcam tnerruc eht no srossecorp fo rebmun eht snruteR
yrotceriDmetsyS yrotcerid metsys eht ot htap lluf eht snruteR
emaNresU noitacilppa siht detrats taht ytitne eht fo eman eht snruteR
TINU -3
ehT #C nimmargorP g L na ug age 1.3 ehT An ymota fo a lpmiS e C# rP go mar
#C demands t ah t a ll orp gram l go ic is noc tai den w ti hin a t py e defin iti on Un ekil in
,)++(C ni C# ti is n to p so s elbi to rc eate labolg noitcnuf s or lg o lab po tni s of data. nI sti
simp tsel f ro m, a C# pr go ar m c na eb
nettirw as fol wol :s
// yB ,noitnevnoc #C selif dne htiw a sc.* elif .noisnetxe
gnisu ;metsyS
ssalc ssalColleH
{
cilbup citats tni ][gnirts(niaM )sgra
{
oC n elos rW. eti niL e( eH" l ol W ro dl ! )" ;
Con los e eR. da L (eni ;)
nruter ;0
}
}
,ereH a ifed nit oi n is cre ta ed f ro a cl sa s pyt e (He Coll l sa s) aht t su opp tr s a nis gle meth do
named iaM (n ). Every xe ecutable C# applica it on must contain a cl sa s ed fini gn a
(niaM ) m te h do , hw ich si u des to s gi nify the ne try op tni of ht e ppa il ac oit n. As you can
es e, t ih s sig an ture of aM i (n ) si denroda iw th the up b il c dna sta it c drowyek s. etaL r in
this c ,retpah y uo wi ll be suppli de with a formal defi
U tn li ht ne , dnu erstand ht at bup il c mem sreb are cca e ss ible from other t py e ,s wh li e
sta it c me bm ers are ocs ped at t eh class level (rather t ah n ht e object level) dna can
t uh s be inv deko w ti uoh t the een d to f ri st rc eate a new cl sa s i sn ta ecn .
n iti on fo “ bup cil ” dna “sta it c.”
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 83
snoitairaV no the aM in )( Me ht do
The rp ve io su i et rati no of aM i (n ) was ed fined to take a single parameter (an arr ya of
strings) na d ret ru n an integer data yt pe. ihT s is n to ht e lno y op s bis le form of aM in(),
// oN nruter ,epyt yarra fo sgnirts sa tnemugra .
cilbup citats diov ][gnirts(niaM
{
}
// oN nruter ,epyt on .stnemugra
cilbup citats diov )(niaM
{
}
// regetnI nruter ,epyt on .stnemugra
cilbup citats tni )(niaM
{
}
rP dnammoC gnisseco - stnemugrA eniL
otssalColleH etadpu ot hsiw won uoy taht emussA dnammoc elbissop ssecorp - enil :sretemarap
dnammoc yna tnes neeb evah uoy fi kcehc ,emit sihT // - .stnemugra enil
;metsyS gnisu
{ssalColleH ssalc
[gnirts(niaM tni citats cilbup )sgra ]
{
;)"***** sgra enil dnammoC *****"(eniLetirW.elosnoC
)++i ;htgneL.sgra < i ;0 = i tni(rof
;)]i[sgra ," }0{ :grA"(eniLetirW.elosnoC
...
}
}
sgnirts fo yarra eht fi ees ot gnikcehc era uoy ,ereH smeti fo rebmun emos sniatnoc htgneL
etsyS fo ytreporp ees ll’uoy sa( yarrA.m #C lla ,retpahc siht ni retal saila yllautca syarra
dna ,epytyarrA.metsySeht fo tes nommoc a evah erofereht meti hcae revo pool uoy sA .)srebmem
gra )s
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 93
v sti ,yarra eht ni elosnoc eht ot detnirp si eula eht ta stnemugra eht gniylppuS .wodniw mmoc dna
.elpmis sa yllauqe si enil vo etareti yam uoy ,poolrof dradnats eht ot evitanretla gnirts gnimocni re
gnisu syarra ialpxe ylluf si xatnys fo tib sihT .drowyekhcaerof #C eht tub ,retpahc siht ni retal den
:egasu elpmas emos si ereh
evah uoy ecitoN // eht kcehc ot deen on
.'hcaerof'
)sgra ][gnirts(niaM tni citats cilbup
{
...
)sgra ni s gnirts(hcaerof
;)s ," }0{ :grA"(eniLetirW.elosnoC
...
}
dnammoc ssecca ot elba osla era uoy ,yllaniF - dnammoCteG citats eht gnisu stnemugra enil
eht fo dohtem)(sgrAeniL orivnE.metsyS fo eulav nruter ehT .epyttnemn xedni tsrif ehT .sgnirts
di yrotcerid tnerruc eht seifitne gniniamer eht elihw ,flesti noitacilppa eht gniniatnoc ni stnemele
niatnoc yarra eht dnammoc laudividni eht - gnisu nehw( stnemugra enil oy ,euqinhcet siht on u
regnol at sa dohtem)(niaM eht enifed ot deen )retemarap yarra gnirts a gnik
)sgra ][gnirts(niaM tni citats cilbup
{
..
tsyS gnisu .tnemnorivnE.me ;)(sgrAeniLdnammoCteG.tnemnorivnE =
;)]0[sgrAeht ,"}0{ :si ppa siht ot htaP"(eniLetirW.elosnoC
...
}
C 2.3 gnitaer tcejbO s C: ons scisaB rotcurt
woN taht uoy evah eht r elo of M nia () dnu er your eb ,tl le ’t s move no to t eh t po ic of
tcejbo ion . llA o ejb ct-ori ne et d (OO) langu ga es am ke a clear dist ni c it no be ewt en
cla ess s and objects. A ssalc is a defini it no o( r, fi you w ,lli a blu nirpe t) for a resu -
denifed epyt ( DU T). nA jbo ce t is simply a et rm ed scr nibi g a gi nev inst na ce fo a
par it uc lar class in memory. In ,#C t eh en w drowyek si eht de ob ej ct. ekilnU rehto OO
segaugnal hcus( as ++C ), it is on t op ss ible to al etacol a class t py e on the stack;
the er fore, if uoy attempt ot use a class vari ba le that h sa on t been wen“ -e ”,d uoy era
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 04
deussi a c elipmo - emit e rorr . hT su t eh f llo o iw ng C# oc ed si elli gal:
gnisu ;metsyS
ssalc ssalColleH
citats tni ][gnirts(niaM )sgra
esU fo u dengissan lacol .'wen' esu tsuM !elbairav
ssalColleH ;1c
c1. moS e teM oh d )( ;
...
}
}
To ulli st ar te the pro ep r procedu er s of r bo ject c aer it no , bo s re ve ht e llof o iw ng
u adp te :
gnisu ;metsyS
ssalc ssalColleH
citats tni ][gnirts(niaM )sgra
uoY nac eralced na d etaerc a wen tcejbo ni a elgnis enil . ..
ssalColleH 1c = wen ;)(ssalColleH
// .. . ro kaerb noitaralced dna noitaerc otni owt .senil
ssalColleH ;2c
2c
dna ca iuq nir g su ff ici ne t omem ry from the nam aged heap. Here, you h eva a ll ocat de owt
rE r ro !
{ cilbup
{ //
{ cilbup
{ //
= wen ;)(ssalColleH ...
} }
hT e new drowyek is ni egrahc fo c lucla a nit g t eh c ro rect ebmun r of b sety for eht eps cified
tcejbo
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 14
bo j ce ts fo the lleH o salC s salc s epyt . natsrednU d ht ta #C ob cej t av r selbai era er ylla a
ecnerefer to the bo j ce t in memory, not the ac ut al ob ej ct it les f. hT su , in this il thg , c1 a dn
c2 hcae re ef re ecn a u qin ue H lle o salC s aeh p.
.3 3 The Compo is tion fo a C# ehT suoiverp ColleH lass bo jects vah e eeb n c no structed u is ng the defa lu t oc sn tructor , never
ta ek s ar mug en st . revE y C# c sal s si ua tomat ci a ll y provided tiw h a erf e d fe au tl
con ts r cu ,rot whi hc you may er d ife ne if en de eb . ehT fed a lu t rotcurtsnoc e sn u ser taht lla
me rebm atad is s te to an a pp or priate default value ( iht s roivaheb is true of r la l
c tsno ruc ot )sr . tsartnoC siht ot ,++C erehw ininu - data p io n st to garbage s( mo eti sem ht e
li ltt e th sgni em an a lo )t . ,yllacipyT sessalc orp v edi lanoitidda oc n srotcurts dnoyeb eht
def tlua . nI iod gn ,os uoy eht edivorp resu tcejbo htiw a s mi p el yaw ot itini a ezil eht etats fo
na tcejbo ta eht emit fo rc e noita . kiL e in Java a dn C+ ,+ in #C co tsn ruc ot rs era na dem
ident ci ally to the c al ss they are div e a re nrut ton( eulav e nev iov d). He er si eht
ColleH lass t epy cno e again, iw th a cu ts om oc n rts uct ,ro
dna a point of pu lb ic s rt ing data:
// ,ssalColleH htiw srotcurtsnoc .
gnisu ;metsyS
ssalc ssalColleH
{
// A tniop fo etats .atad
// tluafeD .rotcurtsnoc
cilbup lColleH a )(ss
{ tluafeD"(eniLetirW.elosnoC tc ro ;)"!dellac }
// sihT motsuc rotcurtsnoc sngissa etats atad
// ot a resu - deilppus eulav .
cilbup ssalColleH gnirts( )gsm
{
W.elosnoC r eti eniL ( uC" mots c ot r c ;)"!della
egasseMresu
}
a er d nife ed fed au tl co rtsn u tc ,ro
= ;gsm
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 24
// margorP yrtne tniop .
cilbup citats tni ][gnirts(niaM )sgra
llaC tluafed .rotcurtsnoc
ssalColleH 1c = wen ;)(ssalColleH
eulaV"(eniLetirW.elosnoC fo :egasseMresu }0{ \ ,"n ;)egasseMresu.1c
// llaC deziretemarap .rotcurtsnoc
ssalColleH ;2c
2c = wen ,gnitseT"(ssalColleH ,1 ,2 ;)"3
eulaV"(eniLetirW.elosnoC fo :egasseMresu { ,"}0 ;)egasseMresu.2c
Con los e eR. da L (eni ;)
nruter ;0
}
}
.3 4 afeD ult A ss ign em nt na d vari lba e ocs pe
,yltnerruC ht e He lColl sa s epyt sah neeb c no s detcurt ot pe ofr rm owt du seit .
riF st, the lc ass d ife nes the entry op int of t eh pa lp i ac it no (t eh aM i (n ) em ht do ).
Seco dn ,
lColleH ass maint ia ns a poi tn of fiel d
dna ,doog ti yam es em a bit str egna la( hguoht nys
Mai (n ) method erc ates an i sn nat ec of t eh very class ni whi hc ti
ssalc ssalColleH
{
...
)sgra ][gnirts(niaM tni citats cilbup
{
(ssalColleH wen = 1c ssalColleH ;)
...
}
}
ek ot tsuj ,hcaorppa siht ekat selpmaxe laitini ym fo ynaM eht gnitartsulli no desucof pe .dnah
ow ngised larutan erom a ,revewoH tnerruc eht rotcafer ot eb dlu tcnitsid owt otni epytssalColleH
assalColleH :sessalc #C dliub uoy nehW .ppAolleH dn pa ot nommoc etiuq semoceb ti ,snoitacilp
{ //
atad dna a ef w co sn t ur ctors. W lih e th si si a ll w le l at c it c ylla well-for em d) that the static
was def ni ed:
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 34
f epyt eno evah noitacilppa“ eht sa gninoitcnu dna )dohtem)(niaM eht senifed taht epyt eht( ”tcejbo
eht demret si siht ,ecnalrap OO nI egral ta noitacilppa eht etutitsnoc taht sepyt rehto suoremun
nrecnoc fo noitarapes elbisnopser eb dluohs ssalc a taht setats elpicnirp ngised siht ,llehstun a nI .s
rebmem wen a taht eciton( gniwollof eht reenigneer dluoc ew ,suhT .krow fo tnuoma tsael eht rof
eht ot dedda neeb sah)(egasseMtnirP deman
:)epytssalColleH
ssalColleH ssalc
{
;egasseMresu gnirts cilbup
)(ssalColleH cilbup
} ;)"!dellac rotc tluafeD"(eniLetirW.elosnoC {
)gsm gnirts(ssalColleH cilbup
{
;)"!dellac rotc motsuC"(eniLetirW.elosnoC
egasseMresu
}
)(egasseMtnirP diov cilbup
{
su ,"}0{ :si egasseM"(eniLetirW.elosnoC ;)egasseMre
}
}
ppAolleH ssalc
{
)sgra ][gnirts(niaM tni citats cilbup
{
;)"...ereht yeH"(ssalColleH wen = 1c ssalColleH
;)(egasseMtnirP.1c
...
}
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 44
xatnyS noitazilaitnI rebmeM #C 5.3
ruoc eht revo detaerc snoitacilppa elpmaxe eht fo ynaM srif eseht fo es sretpahc wef t eht fo esu
c a elihW .ssalcelosnoC.metsyS si )IUC( ecafretni resu elosno ylrae eht gnitcirtser ,IU bew ro
selpmaxe lliw IUC a ot animaxe rednu stpecnoc eht no desucof peek ot su wolla naht rehtar ,noit
htiw gnilaed sti sA noC eht ,seilpmi eman ssalcelos maerts rorre dna ,tuptuo ,tupni setaluspacne
m elosnoc rof snoitalupina - desab snoCeht ,0.2 TEN. fo esaeler eht htiW .snoitacilppa sah epytelo
htiw decnahne neeb 3 elbaT .ytilanoitcnuf lanoitidda - fo srebmem wen )lla ton tub( emos stsil 2
.tseretni
3 elbaT - 0.2 TEN. tceleS .2 – elosnoC.metsyS fo srebmeM cificepS
rebmeM efiL ni gninaeM
roloCdnuorgkcaB rof sroloc dnuorgerof/dnuorgkcab eht tes seitreporp esehT
eht tnerruc
.tuptuo roloCdnuorgeroF eht fo rebmem yna dengissa eb yam yehT
losnoC roloCe
.noitaremune
thgieHreffuB s’elosnoc eht fo htdiw/thgieh eht lortnoc seitreporp esehT
reffub
.aera
htdiWreffuB
yalpsid elosnoc dna reffub eht sraelc dohtem sihT )(raelC
.elosnoc tnerruc eht fo eltit eht stes ytreporp sihT eltiT .aera
odniW thgieHw ht lortnoc seitreporp esehT noitaler ni elosnoc eht fo snoisnemid e ot
htdiWwodniW .reffub dehsilbatse eht
poTwodniW
tfeLwodniW
ssalC elosnoC eht htiw tuptuO dna tupnI cisaB 6.3
3 elbaT ni srebmem eht ot noitidda nI - fed epytelosnoC eht ,2 ot sdohtem fo tes a seni
tupni erutpac xet a spmup)(eniLetirW ,nees evah uoy sA .level ssalc eht a gnidulcni( gnirts t
egairrac p dohtem )(etirW ehT .maerts tuptuo eht ot )nruter maerts tuptuo eht ot txet spmu tuohtiw
oy swolla)(eniLdaeR .nruter egairrac a ecer ot u tupni eht morf noitamrofni evi eht litnu pu maerts
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 54
aeR elihw ,nruter egairrac elgnis a erutpac ot desu si)(d t gnisu O/I cisab etartsulli oT elosnoC eh
eht redisnoc ,ssalc of resu eht stpmorp dna noitamrofni fo stib emos r eht ot meti hcae seohce
ats .maerts tuptuo dradn
3 erugiF - .nur tset a swohs 5
.O/I cisab mrofrep ot ssalc elosnoC eht fo esu ekaM //
)sgra ][gnirts(niaM diov citats
{
//
;)(eniLdaeR.elosnoC =
;)s ," }0{ ,olleH"(eniLetirW.elosnoC
;)" :ega ruoy retnE"(etirW.elosnoC
aeR.elosnoC = s ;)(eniLd
;)s ,"dlo sraey }0{ era uoY"(eniLetirW.elosnoC
}
sepyT ecnerefeR dna sepyT eulaV gnidnatsrednU 7.3
mun a senifed #C ,egaugnal gnimmargorp yna ekiL tneserper taht sdrowyek fo reb sepyt atad cisab
tad retcarahc ,srebmun elohw sa hcus gnitaolf ,a - iop dna ,srebmun tn emoc uoy fI .seulav naelooB
,dnuorgkcab ++C a morf taht wonk ot yppah eb lliw uoy ni stnatsnoc dexif era sepyt cisnirtni eseht
esrevinu eht etaerc uoy nehw taht gninaem , TEN. lla ,tniop atad regetni na - segaugnal erawa
rednu n dexif eht dnats siht fo eruta .gnildnah fo elbapac si ti egnar eht no eerga lla dna ,epyt
eulav eb yam epyt atad TEN. a ,gnikaeps yllacificepS -b ecnerefer ro desa - eulaV .desab - hcihw
sepyt atad laciremun lla edulcni sa llew sa ,).cte ,taolf,tni( G .kcats eht no detacolla vi siht ne
sepyt eulav ,diotcaf :epocs gninifed eht fo tuo llaf yeht ecno yromem morf devomer ylkciuq eb nac
!sepyt eulav era sregetnI //
)(dohteMemoS diov cilbup
{
;0 = i tni
;)i(eniLetirW.elosnoC
!ereh kcats eht ffo deppop
t epyt eulav eno ngissa uoy nehW rebmem a ,rehtona o - yb - yb deveihca si ypoc rebmem
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 64
eht si ypoc ot ”rebmem“ ylno eht ,sepyt atad naelooB ro laciremun fo smret nI .tluafed
:flesti elbairav eht fo eulav
ni stluser sepyt eulav cisnirtni owt gningissA //
eht no selbairav tnednepedni owt // .kcats
)(dohteMemoS diov cilbup
{
;99 = i tni
;i = j tni
.99 llits si 'i' ,tnemngissa gniwollof eht retfA //
;2378 j
}
srednu ,hsalfswen rojam on si elpmaxe suoiverp eht elihW dna( serutcurts TEN. taht dnat
iht ni retal denimaxe era hcihw ,snoitaremune era )retpahc s ,serutcurtS .sepyt eulav osla ylpmis
erab eht eveihca ot yaw a edivorp ,tup - atneiro tcejbo fo stifeneb senob ,.e.i( noit )noitaluspacne
kcats fo ycneiciffe eht gnivah elihw - ,ssalc a ekiL .atad detacolla srotcurtsnoc ekat nac serutcurts
ivorp( yeht ded yna enifed dna )stnemugra evah icilpmi era serutcurts llA ssalc a morf devired ylt
deman yS fo esoprup ylno eht ,yllanoitcnuF .epyTeulaV.metsyS ”edirrevo“ ot siepyTeulaV.mets
ircsed(tcejbO.metsyS yb denifed sdohtem lautriv eht t )tnemom a tsuj ni deb ronoh o eulav - ,desab
ecnerefer susrev - tnames ,desab htem ecnatsni eht ,tcaf nI .sci ot lacitnedi eraepyTeulaV.metsySyb
:tcejbO.metsyS fo esoht
.epyTeulaV.metsyS dnetxe snoitaremune dna serutcurtS //
tcejbo : epyTeulaV ssalc tcartsba cilbup
{
lautriv cilbup ;)jbo tcejbo(slauqE loob
;)(edoChsaHteG tni lautriv cilbup
;)(epyTteG epyT cilbup
;)(gnirtSoT gnirts lautriv cilbup
}
:drowyektcurts #C eht gnisu ,tnioPyM deman erutcurts #C a detaerc evah uoy emussA
!sepyt eulav era serutcurtS //
tnioPyM tcurts
{
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 74
ilbup ;y ,x tni c
}
mees yam hcihw ,drowyekwen eht fo esu ekam yam uoy ,epyt erutcurts a etacolla oT
fo trap si sihT .noitacolla paeh seilpmi syawlawen kniht yllacipyt ew taht nevig evitiutniretnuoc
w ,sremmargorp sA .RLC eht yb deniatniam srorrim dna ekoms eht na si gnihtyreve emussa nac e
morf devired epyt a sretnuocne emitnur eht nehw ,revewoH .sepyt eulav wen dna tcejbo
kcats ,epyTeulaV.metsyS
!kcats eht no llitS //
;)(tnioPyM wen = p tnioPyM
eht gnisu tuohtiw detacolla eb nac serutcurts ,evitanretla na sA :drowyekwen
;1p tnioPyM
;001 = x.1p
;001 = y.1p
erofeb atad dleif fo eceip hcae ezilaitini tsum uoy ,revewoh ,hcaorppa siht ekat uoy fI
.esu
.rorre relipmoc a ni stluser os od ot gniliaF
rotarepO tnemngissA eht dna ,sepyT secnerefeR ,sepyT eulaV
tats )sgra ][gnirts(niaM diov ci
{
;)"***** sepyT ecnerefeR / sepyT eulaV *****"(eniLetirW.elosnoC
"(eniLetirW.elosnoC - ;)"1p gnitaerC >
;)(tnioPyM wen = 1p tnioPyM
;001 = x.1p
;001 = y.1p
"(eniLetirW.elosnoC - 1p ot 2p gningissA > \ ;)"n
2p tnioPyM
si ereH // .1p
;)x.1p ,"}0{ = x.1p"(eniLetirW.elosnoC
;)y.1p ,"}0{ = y.1p"(eniLetirW.elosnoC
.2p si ereH //
;)x.2p ,"}0{ = x.2p"(eniLetirW.elosnoC
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 84
;)y.2p ,"}0{ = y.2p"(eniLetirW.elosnoC
.x.1p egnahc TON lliw sihT .x.2p egnahC //
"(eniLetirW.elosnoC - x.2p gnignahC > ;)"009 ot
;009 = x.2p
.niaga tnirP //
"(eniLetirW.elosnoC - ;)"...niaga seulav X eht era ereH >
;)x.1p ,"}0{ = x.1p"(eniLetirW.elosnoC
;)x.2p ,"}0{ = x.2p"(eniLetirW.elosnoC
;)(eniLdaeR.elosnoC
}
.sepyt ecnerefer syawla era sessalC //
N =< // tnioPyM ssalc !ssalc a wo
{
;y ,x tni cilbup
}
sepyT ecnerefeR gniniatnoC sepyT eulaV
effid eht rof gnileef retteb a evah uoy taht woN dna sepyt eulav neewteb secner ,sepyt ecnerefer
elpmoc erom a enimaxe s’tel eht evah uoy emussA .elpmaxe x ssalc( ecnerefer gniwollof taht epyt )
mrofni na sniatniam tes eb nac taht gnirts lanoita :rotcurtsnoc motsuc a gnisu
ofnIepahS ssalc
{
;gnirtSofni gnirts cilbup
)ofni gnirts(ofnIepahS cilbup
} ;ofni = gnirtSofni {
}
pyt ssalc siht fo elbairav a niatnoc ot tnaw uoy taht emussa woN epyt eulav a nihtiw e
sa( rotcurtsnoc motsuc a renni eht fo eulav eht tes ot dlrow edistuo eht wolla oT .elgnatceRyM
:)denifeder eb tonnac dna devreser si erutcurts a fo rotcurtsnoc tluafed eht ,tib a tsuj ni denialpxe
elgnatceRyM tcurts
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 94
{
erutcurts // .rebmem epyt ecnerefer a sniatnoc
;thgir ,mottob ,tfel ,pot tni cilbup
)ofni gnirts(elgnatceRyM cilbup
ofnItcer = wen ;)ofni(ofnIepahS
pot = tfel = ;01
mottob = thgir = ;001
}
}
citats diov ][gnirts(niaM
{
// etaerC eht tsrif .elgnatceRyM
iLetirW.elosnoC "(en -> gnitaerC 1r )" ;
elgnatceRyM 1r = wen sihT"(elgnatceRyM si ym tsrif ;)"tcer
// woN ngissa a wen elgnatceRyM ot .1r
"(eniLetirW.elosnoC -> gningissA 2r "1r ;)
elgnatceRyM ;2r
r2
// egnahC seulav fo 2r .
"(eniLetirW.elosnoC -> gnignahC lla seulav fo )"2r ;
gnirtSofni.ofnItcer.2r = sihT" si wen ;"!ofni
mottob.2r = ;4444
// tnirP seulav
"(eniLetirW.elosnoC -> seulaV retfa ;)":egnahc
(eniLetirW.elosnoC "-> 1r r. nItce f :gnirtSofni.o { "}0 ,
r er.1 Itc fn ni.o f irtSo gn );
(eniLetirW.elosnoC "-> 2r r. nItce f :gnirtSofni.o { "}0 ,
r er.2 Itc fn ni.o f irtSo gn );
"(eniLetirW.elosnoC -> :mottob.1r ,"}0{ ;)mottob.1r
"(eniLetirW.elosnoC -> :mottob.2r ,"}0{ ;)mottob.2r
}
eulaV dna ecnerefeR :sepyT laniF sliateD
To wrap pu this to ip c, dnop er the informa it on in baT le 3-8, ihw ch
ra sg )
ot
= ;1r
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 05
summ ra i ez s t eh co er id s it cn it ons betwe ne av l eu t sepy a dn re ef rence t py es.
elbaT 3-8. laV ue yT pes na d R erefe n ec Ty ep s iS de by Side
gniugirtnI noitseuQ eulaV T epy ecnerefeR
T epy
erehW si iht s epyt detacollA no ht e s kcat . detacollA no eht
mana deg
detacolla ? aeh p.
woH is a av ri ba le Value type vari ba les are ecnerefeR epyt
av r lbai se
serper ent de ? local era
seipoc p. o nitni g ot the
memory o cc upied
yb th e
colla a det
ni s nat ce.
tahW si ht e esab epyt ? Mu ts ed r vi e rf om Can ed ri ev rf om
any othe r
type
tsyS :edoN retsaM ehT 8.3 tcejbO.me
.tcejbO.metsyS :ssalc esab nommoc a morf devired yletamitlu si epyt yreve ,TEN. nI
ssalctcejbO ehT
,ssalc esab sti yficeps ylticilpxe ton seod taht ssalc a
:tcejbO.metsyS morf evired ylticilpmi uoy
.tcejbO.metsyS morf gnivired ylticilpmI //
ssalColleH ssalc
}...{
oc #C eht ,noisnetni ruoy htiw raelc erom eb ot hsiw uoy fI ot uoy swolla ):( rotarepo nol ylticilpxe
esab s’epyt a yficeps :)tcejbO.metsyS sa hcus( ssalc gnivired ylticilpxe era ew sesac htob nI //
.tcejbO.metsyS morf
IepahS ssalc tcejbO.metsyS : ofn
}...{
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 15
tcejbo : ofnIepahS ssalc
}...{
ecnatsni fo tes a senifedtcejbO.metsyS - ssalc dna level - vel taht etoN .srebmem )citats( le fo emos
ecnatsni eht - su deralced era srebmem level nac dna drowyek lautriv eht gni neddirrevo eb erofereht
tcejbO.metsyS :esrevinu TEN. eht ni ssalc tsompot ehT //
ecapseman
{
tcejbO ssalc cilbup
{
;)(tcejbO cilbup
;)jbo tcejbO(slauqE naelooB lautriv cilbup
;)(edoChsaHteG 23tnI lautriv cilbup
;)(epyTteG epyT cilbup
;)(gnirtSoT gnirtS lautriv cilbup
etcetorp ;)(ezilaniF diov lautriv d
;)(enolCesiwrebmeM tcejbO detcetorp
;)Bjbo tcejbo ,Ajbo tcejbo(slauqE loob citats cilbup
;)Bjbo tcejbo ,Ajbo tcejbo(slauqEecnerefeR loob citats cilbup
}
}
tcejbO.metsyS fo roivaheB tluafeD ehT
uafed eht fo emos etartsulli oT ,ssalc esabtcejbO.metsyS eht yb dedivorp roivaheb tl
ssalc a emussa
:sdohteMtcejbO deman ecapseman motsuc a ni denifednosreP deman
siht fo dne eht ta denimaxe ylluf si drowyek 'ecapseman' ehT //
sdohteMtcejbO ecapseman
{
nosreP ssalc
{
(nosreP cilbup )a etyb ,s gnirts ,emanl gnirts ,emanf gnirts
{
emaNtsrif
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 25
;emanl = emaNtsal
;s = NSS
;a = ega
}
}{)(nosreP cilbup
.nosrep a fo etats ehT //
;emaNtsal gnirts cilbup;emaNtsrif gnirts cilbup
;NSS gnirts cilbup
;ega etyb cilbup
}
}
tem)(niaM ruo nihtiw ,woN :os sa epytnosreP eht fo esu ekam ew ,doh
)sgra ][gnirts(niaM diov citats
{
***** tcejbO htiw gnikroW *****"(eniLetirW.elosnoC \ ;)"n
111" ,"kralC" ,"derF"(nosreP - 11 - ;)02 ,"1111
"(eniLetirW.elosnoC - >
"(eniLetirW.elosnoC - >
ot secnerefer rehto emos ekaM // .'derf'
;derf = 2p nosreP
;2p = o tcejbo
?yromem ni tcejbo emas eht ot gnitniop
&& )derf(slauqE.o(fi
;)"!tcejbo emas eht gnicnerefer era o dna 2p ,derf"(eniLetirW.elosnoC
;)(eniLdaeR.elosnoC
}
tSoT fo noitatnemelpmi tluafed eht woh eciton ,tsriF s)(gnir ylluf eht snruter ylpmi eman deifilauq
ecapseman ,.g.e( epyt eht fo seveirter)(epyTteG .)emanepyt. a senifed hcihw ,tcejboepyT.metsySa
B deman ytreporp siht ,sseug nac uoy sa(epyTesa lluf eht yfitnedi lliw eht fo eman deifilauq y
s’epyt uqE eht segarevel taht deganam eht no decalp si tcejbonosreP wen a ,ereH .dohtem)(sla
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 35
rderf eht ni derots si tcejbo siht ot ecnerefer eht dna ,paeh fo osla si2p.elbairav ecnerefe epyt
ni wen a gnitaerc ton era uoy ,revewoh ,nosreP tub ,ssalcnosreP eht fo ecnats rf ot 2p gningissa .de
htob era2p dnaderf ,eroferehT ni tcejbo emas eht ot gnitniop epyt fo(o elbairav eht si sa ,yromem
aw hcihw ,tcejbo .)erusaem doog rof ni nworht s a o dna ,2p ,derf taht neviG emas eht ot tniop ll
ni tcejbo .sdeeccus
irrevO fo sroivaheB tluafeD emoS gnid .metsyS fo roivaheb dennac eht hguohtlA eht tif nactcejbO
tsom ni llib vo ot sepyt motsuc ruoy rof nommoc etiuq si ti ,sesac detirehni eseht fo emos edirre
animaxe etelpmoc a sedivorp 4 retpahC .sdohtem a ni tub ,#C rednu POO fo noit ,llehstun
t si gnidirrevo corp eh roivaheb eht gninifeder fo sse tsuj evah uoy sA .ssalc devired a ni rebmem
syS ,nees fo rebmun a senifed tcejbO.met uqE dna)(gnirtSoT =sa hcus( sdohtem lautriv taht ))(sla
tnemelpmi dennac a enifed od devired a rof srebmem lautriv
rrevO O.metsyS gnidi )(gnirtSoT.tcejb ot yaw a sedivorp dohtem)(gnirtSoT eht gnidirrevO ylkciuq
tnerruc s’tcejbo na fo tohspans a niag edirrevo s’tel ,etartsulli oT .ssecorp
lautxet a nruter ot)(gnirtSoT.tcejbO.metsyS
en a gnisu era ew eton( etats s’nosrep a fo noitatneserper deman ecapseman w
:)txeT.metsyS
ssecca ot txeT.metsyS ecnerefer ot deeN //
;metsyS gnisu
;txeT.metsyS gnisu
{
.)(gnirtSoT.tcejbO.metsyS gnidirrevO //
)(gnirtSoT gnirts edirrevo cilbup
{
;)(redliuBgnirtS wen = bs redliuBgnirtS
"(tamroFdneppA.bs
ppA.bs "(tamroFdne
,"]}0{=egA "(tamroFdneppA.bs
;)(gnirtSoT.bs nruter
}
...
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 45
oT.tcejbO.metsyS morf denruter gnirts eht tamrof uoy woH fo rettam a ylegral si)(gnirtS nI .eciohc
ap eulav/eman eht ,elpmaxe siht nihtiw deniatnoc neeb evah sri e htiw ,stekcarb erauqs riap hca
ocimes a yb detarapes nihtiw euqinhcet nommoc a( nol eciton oslA .)seirarbil ssalc esab TEN. eht
xe siht taht ,epyt wen a fo esu sekam elpma osla si hcihw(redliuBgnirtS.txeT.metsyS
ehT .retpahc eht ni retal liated retaerg ni debircsed ,rewsna trohs taht si ,revewoh a siredliuBgnirtS
itanretla tneiciffe erom .noitanetacnoc gnirts #C ot ev evO )(slauqE.tcejbO.metsyS gnidirr s’teL
ot )(slauqE.tcejbO.metsyS fo roivaheb eht edirrevo osla eulav htiw krow - desab llaceR .scitnames
uter)(slauqE ,tluafed yb taht no eurt snr gnieb secnerefer owt eht fi yl eht no tcejbo emas eht ot
aeh uoy ,revewoh ,sesac ynam nI .p emas eht ot gnitniop era secnerefer owt fi erac yrassecen t’nod
,yromem ni tcejbo tub eht evah stcejbo owt eht fi detseretni erom era uoy atad etats emas
:)nosrePa fo esac eht niega dna ,NSS,eman( )o tcejbo(slauqE loob edirrevo cilbup
{
dilav a tnes rellac eht erus ekaM //
.gnideecorp erofeb tcejbo nosreP //
)nosreP si o && llun =! o( fi
{
nosreP gnimocni eht fi ees woN //
itamrofni emas tcaxe eht sah // sa no
.)siht( tcejbo tnerruc eht //
;o)nosreP( = pmet nosreP
&& emaNtsrif.siht == emaNtsrif.pmet( fi
&& emaNtsal.siht == emaNtsal.pmet
&& NSS.siht == NSS.pmet
)ega.siht == ega.pmet
;eurt nruter
}
!emas eht toN // ;eslaf nruter
}
irev tsrif era uoy ereH eedni did rellac eht gniyf eht ot tcejbonosrePa ni ssap d gnisu ohtem)(slauqE
iop siht retfA .drowyeksi #C eht eht gninimaxe tuoba og uoy ,tn retemarap gnimocni eht fo seulav
t fo seulav eht tsniaga atad dleif s’tcejbo tnerruc eh wyeksiht eht fo esu eht eton( srefer hcihw ,dro
elgnis a sekat)(slauqE.tcejbO.metsyS fo epytotorp ehT ,suhT .tcejbo epyt fo tnemugra era uoy
ht nihtiw tsac ticilpxe na mrofrep ot deriuqer eht fo srebmem eht ssecca ot dohtem)(slauqE e
nosreP reht dna atad etats emas eht htiw stcejbo owt nruter erofe si atad fo tniop yna fI .eurt ton
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 55
etsyS edirrevo uoy fI .eslaf nruter uoy ,lacitnedi nevig a rof)(gnirtSoT.tcejbO.m ekat nac uoy ,ssalc
revo nehw tuctrohs elpmis yrev a .)(slauqE.tcejbO.metsyS gnidir ruter eulav eht taht neviG den
)(gnirtSoT morf ekat dluohs elbissop dna( ssalc tnerruc eht fo selbairav rebmem ni deralced atad
,)sessalc esab :sepyt gnirts eht fo seulav eht erapmoc ylpmis nac)(slauqE
)o tcejbo(slauqE loob edirrevo cilbup
{
)nosreP si o && llun =! o( fi
{
tSoT.o == )(gnirtSoT.siht( fi ))(gnir
;eurt nruter
esle
;eslaf nruter
}
;eslaf nruter
}
ssap ot tpmetta dna ,raC deman epyt a evah uoy emussa ,tnemugra fo ekas eht rof ,woN
:os sa dohtem)(slauqE.nosreP eht ot ecnatsni raCa ni
!elpoep ton era sraC //
;)(raC wen = c raC
n = p nosreP ;)(nosreP we
;)c(slauqE.p
eurt a rof kcehc emitnur ruoy neviG - eht )rotareposi eht aiv( tcejbonosreP eulb
dohtem)(slauqE
!spoO //
;)(nosreP wen = p nosreP
;)llun(slauqE.p
.ecnerefer llun gnimocni na rof kcehc ruoy nevig ,efas eb osla dluow sihT
dirrevO )(edoChsaHteG.tcejbO.metsyS gni
arp tseb ,dohtem )(slauqE eht sedirrevo ssalc a nehW dluohs uoy taht etatcid secitc edirrevo osla
f uoy fI .)(edoChsaHteG.tcejbO.metsyS a deussi era uoy ,os od ot lia fo elor ehT .gninrawrelipmoc
ot si )(edoChsaHteG a nruter taht eulav laciremun ats lanretni sti no desab tcejbo na seifitnedi et
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 65
owt evah uoy fi ,suhT .atad dna ,NSS ,eman tsal ,eman tsrif lacitnedi na evah taht stcejbonosreP
.edoc hsah emas eht niatbo ,ega
etaerc ot desu eb nac taht smhtirogla ynam era erehT ah a edoc hs — srehto ,ycnaf emos os ton
lliw eulav hsah s’tcejbo na ,denoitnem sA .ycnaf sA .atad etats sti no desab eb ssalcgnirtS.metsyS
sah fo noitatnemelpmi dilos yrev a edoChsaHteG s’gnirts eht no desab si taht)( dleif gnirts a yfitnedi
euqinu eb dluohs taht stcejbo gnoma
:noitatneserper gnirts s’dleif eht no)(edoChsaHteG llac ylpmis nac uoy ,)dleifNSS
.NSS s'nosrep eht no desab edoc hsah a nruteR //
)(edoChsaHteG tni edirrevo cilbup
{
;)(edoChsaHteG.NSS nruter
}
atad fo tniop elgnis a yfitnedi tonnac uoy fI neddirrevo evah tub ,ssalc ruoy ni
uoy ,)(gnirtSoT
motsuc ruoy morf denruter gnirts eht fo edoc hsah eht nruter ylpmis nac
:noitatnemelpmi)(gnirtSoT
.)(gnirtSoT motsuc ruo desab edoc hsah a nruteR //
)(edoChsaHteG tni edirrevo cilbup
{
nirtSoT nruter ;)(edoChsaHteG.)(g
}
a sepyT eulaV neewteB gnitrevnoC 01.3 dna gnixoB :sepyT ecnerefeR dn gnixobnU
snoitarepO
yt fo seirogetac rojam owt senifed TEN. taht neviG ecnerefer dna desab eulav( sep yam uoy ,)desab
elbairav a tneserper ot deen yllanoisacco no fo elbairav a sa yrogetac e #C .yrogetac rehto eht fo
nahcem elpmis yrev a sedivorp trevnoc ot ,gnixob demret ,msi yt eulav a .epyt ecnerefer a ot ep
emussA .epyt eulav trohs a ekaM //
;52 = s trohs
serper ot hsiw uoy ,noitacilppa ruoy fo esruoc eht gnirud ,fI a sa epyt eulav siht tne
:swollof sa eulav eht ”xob“ dluow uoy ,epyt ecnerefer
.ecnerefer tcejbo na otni eulav eht xoB //
;s = trohSjbo tcejbo
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 75
lticilpxe fo ssecorp eht sa denifed yllamrof eb nac gnixoB otni epyt eulav a gnitrevnoc y gnidnops
t ecnerefer W .tcejbO.metsySa ni elbairav eht gnirots yb epy uoy neh setacolla RLC eht ,eulav a xob
dna paeh eht no tcejbo wen a eulav s’epyt eulav eht seipoc .ecnatsni taht otni )52 ,esac siht ni(
y ot denruter si tahW ylwen eht ot ecnerefer a si uo U .tcejbo detacolla TEN. ,euqinhcet siht gnis
on evah srepoleved a fo esu ekam ot deen kcats taert yliraropmet ot desu sessalc repparw fo tes
d paeh sa ata - .stcejbo detacolla ixobnu hguorht dettimrep osla si noitarepo netisoppo ehT .gn
gnitrevnoc fo ssecorp eht si gnixobnU eht a otni kcab ecnerefer tcejbo eht ni dleh eulav
opserroc .kcats eht no epyt eulav gnidn eht taht gniyfirev yb snigeb noitarepo gnixobnu ehT
viecer ot tnelaviuqe si epyt atad gni lacol a otni kcab eulav eht seipoc ti ,os fi dna ,epyt dexob eht
kcats - esab irav d roF .elba ufsseccus skrow gniylrednu eht taht nevig ,yll sitrohSjbo eht fo epyt
#C eht enimaxe ll’uoy(trohsa deedni ni liated ni rotarepo gnitsac rof thgit dloh os ,retpahc txen eht
:)won
.trohs gnidnopserroc a otni kcab ecnerefer eht xobnU //
htona trohs ;trohSjbo)trohs( = trohSre
eht ,suhT .epyt atad etairporppa na otni xobnu uoy taht yrotadnam si ti ,niagA
gniwollof
no sliated erom( noitpecxenoitpecxEtsaCdilavnI na setareneg cigol gnixobnu
gnildnah noitpecxe
.gnixobnu lagellI //
ts(niaM diov citats )sgra ][gnir
{
...
!trohs a tub ,tni a TON si xob eht ni deniatnoc epyt ehT
;trohSjbo)tni( = i tni
}
)e noitpecxEtsaCdilavnI(hctac
{
!SPOO"(eniLetirW.elosnoC \ ;))(gnirtSoT.e ," }0{n
}
}
selpmaxE gnixoB)nU( lacitcarP emoS
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 85
uow nehw ,gnikniht eb yam uoy ,oS ot deen yllaer uoy dl atad a )xobnu ro( xob yllaunam ehT ?epyt
i evitartsulli ylerup saw elpmaxe suoiverp doog on saw ereht sa ,erutan n t ehT .tniop atadtrohs htur
uoy taht si rettam eht fo modles lliw — reve fi — nam ot deen atad xob yllau yllacitamotua relipmoc
airporppa nehw selbairav sexob a ssap uoy fi ,elpmaxe roF .et na gniriuqer dohtem a otni epyt eulav
marap tcejbo eht dniheb srucco gnixob ,rete .sniatruc
ssalc
{
)sgra ][gnirts(niaM diov citats
{
.)epyt eulav( tni na etaerC //
;99 = tnIym tni
esuaceB // a otni dessap si tnIym
,tcejbo na ekat ot depytotorp dohtem //
.yllacitamotua 'dexob' si tnIym //
;)tnIym(tcejbOsihTesU
;)(eniLdaeR.elosnoC
}
)o tcejbo(tcejbOsihTesU diov citats
{
;)o ,"}0{ :si o fo eulaV"(eniLetirW.elosnoC
}
}
cco osla gnixob citamotuA ssalc esab TEN. eht fo sepyt eht htiw gnikrow nehw sru
ni denimaxe yllamrof( ecapsemansnoitcelloC.metsyS eht ,elpmaxe
,sepyt noitcelloc tsom ekiL .tsiLyarrA deman epyt ssalc a senifed )7 retpahC
niatbo ,tresni ot uoy wolla taht srebmem sedivorptsiLyarrA :smeti evomer dna ,
,tcejbo : tsiLyarrA.snoitcelloC.metsyS ssalc cilbup
,tsiLI.snoitcelloC.metsyS
,noitcelloCI.snoitcelloC.metsyS
,elbaremunEI.snoitcelloC.metsyS
elbaenolCI
{
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 95
...
;)eulav tcejbo(ddA tni lautriv cilbup
xedni tni(tresnI diov lautriv cilbup ;)eulav tcejbo ,
;)jbo tcejbo(evomeR diov lautriv cilbup
} ;tes ;teg{ ]xedni tni[siht tcejbo lautriv cilbup
}
taht neviG .sepyttcejbO.metsyS cireneg no etarepo srebmem eseht ,ees nac uoy sA
gnihtyreve
:lagel yltcefrep
)sgra ][gnirts(niaM diov citats
{
...
;)(tsiLyarrA wen = stnIym tsiLyarrA
;)88(ddA.stnIym
;)33.3(ddA.stnIym
;)eslaf(ddA.stnIym
}
sepyt eulav fo gnidnatsrednu ruoy nevig ,revewoH thgim uoy ,sepyt ecnerefer dna decalp saw tahw
iLyarrA eht otni fo seipoC ?secnerefeR( .epytts seipoC ?secnerefer eht htiw ekil tsuJ )?serutcurts fo
verp ti ,dohtem)(tcejbOsihTesU suoi atad23tnI.metsyS eht fo hcae taht raelc eb dluohs erew sepyt
erofeb dexob deedni pyttsiLyarrA eht otni decalp gnieb morf meti na eveirter oT .e
eht obnu ot deriuqer era uoy ,epyttsiLyarrA :ylgnidrocca x
)(stnIxobnUdnAxoB diov citats
{
.tsiLyarrA otni stni xoB //
;)(tsiLyarrA wen = stnIym tsiLyarrA
;)88(ddA.stnIym
;)33.3(ddA.stnIym
;)eslaf(ddA.stnIym
.tsiLyarrA morf meti tsrif xobnU //
;]0[stnIym)tni( = metItsrif tni
F"(eniLetirW.elosnoC ;)metItsrif ,"}0{ si meti tsri
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 06
}
,tniartser tuohtiw desu fi ,dna emit gnissecorp emos sekat sepyt gnixobnu dna gnixob ,erus eb oT
ot elba era uoy ,euqinhcet TEN. siht htiw ,revewoH .noitacilppa ruoy fo ecnamrofrep eht truh dluoc
av no etarepo yllacirtemmys eul - ecnerefer dna desab - .sepyt desab
magorP gninifeD 11.3
ad enifed ot woh ees s’tel ,selbairav ssalc eralced ot woh nees evah uoy taht woN taht at eb
ot drowyektsnoc eht sreffo #C .dengissaer ,dexif a htiw selbairav enifed eht ecnO .eulav elbaretlanu
av eb sah tnatsnoc a fo eul ot tpmetta yna ,dehsilbatse ne luser ti retla ekilnU .rorre relipmoc a ni st
evreser si dna ,seulav nruter ro sretemarap yfilauq ot desu ro lacol fo noitaerc eht rof d ecnatsni -
ht taht dnatsrednu ot tnatropmi si tI .atad level eulav e tnatsnoc a ot dengissa eb tsum elbairav
ofereht dna ,emit elipmoc ta nwonk eb tonnac rebmem tnatsnoc a er cnerefer tcejbo na ot dengissa e
si eulav esohw( a ,drowyektsnoc eht fo esu :epyt ssalc gniwollof eht emuss ataDtsnoC ssalc
{
a ot dengissa eulav ehT // nwonk eb tsum tsnoc
.emit elipmoc ta //
;"sevlowrebmiT" = maeTabNtseB gnirts tsnoc cilbup
;41.3 = IPelpmiS elbuod tsnoc cilbup
loob tsnoc cilbup
;hturT! = ytislaF loob tsnoc cilbup
}
lipmoc fo emit eht ta nwonk si tnatsnoc hcae fo eulav eht taht ecitoN eseht weiv fi ,tcaf nI .noita
drah eulav eht dnif dluow uoy ,exe.msadli gnisu stnatsnoc - messa eht otni yltcerid dedoc
stcurtsnoC noitaretI #C 21.3
sah noitidnoc gnitanimret a litnu edoc fo skcolb taeper ot syaw edivorp segaugnal gnimmargorp llA
tem neeb stnemetats noitareti #C eht ,tsap eht ni desu evah uoy egaugnal hcihw fo sseldrageR .
eht sedivorp #C .noitanalpxe elttil eriuqer dluohs dna sworbeye ynam oot esiar ton dluohs
gniwollof
:stcurtsnoc noitareti ruof
poolrof •
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 16
poolni/hcaerof •
poolelihw •
poolelihw/od •
.nrut ni tcurtsnoc gnipool hcae enimaxe ylkciuq s’teL
pooL rof ehT
mun dexif a edoc fo kcolb a revo etareti ot deen uoy nehW eht si tnemetatsrof eht ,semit fo reb
noc noc gnitanimret eht sa llew sa ,flesti staeper edoc fo kcolb htiW .noitid eht gnirobaleb tuo ,tniop
:xatnys eht fo elpmas a si ereh
.pool rof cisab A //
)sgra ][gnirts(niaM diov citats
{
.pool rof eht fo epocs eht nihtiw elbisiv ylno
)++i ;01 < i ;0 = i tni(rof
{
;)i ," }0{ :si rebmuN"(eniLetirW.elosnoC
.ereh elbisiv ton
llA oY .tnemetatsrof #C a gnidliub nehw dloh llits skcirt avaJ dna ,++C ,C dlo ruoy fo u etaerc nac
ldne dliub ,snoitidnoc gnitanimret xelpmoc kaerb dna ,eunitnoc,otog eht fo esu ekam dna ,spool sse
DS 0.2 krow eriuqer uoy fi noitatnemucod K ht no sliated rehtruf .drowyekrof #C e
pooL hcaerof ehT
lla revo etareti ot uoy swolla drowyekhcaerof #C ehT tuohtiw ,yarra na nihtiw smeti ot deen eht
owt era ereH .timil reppu s’yarra eht rof tset ot eno ,hcaerof gnisu selpmaxe fo yarra na esrevart
sgnirts
arra etaretI // .hcaerof gnisu smeti y
)sgra ][gnirts(niaM diov citats
{
,"smhtiroglA xelpmoC"{
,"?MOC cissalC rebmemeR uoy oD"
;}"mroftalP TEN. eht dna #C"
)skoob ni s gnirts( hcaerof
;)s(eniLetirW.elosnoC
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 26
;} 04 ,03 ,02 ,01 { = stnIym ][tni
)stnIym ni i tni( hcaerof
;)i(eniLetirW.elosnoC
}
la sihcaerof ,syarra elpmis revo gnitareti ot noitidda nI metsys revo etareti ot elba os ro deilppus
resu - ed eht no ffo dloh ll’I .snoitcelloc denifed siht sa ,7 retpahC litnu sliat hcaerof eht fo tcepsa
idnatsrednu na sliatne drowyek ecafretni fo gn - rotaremunEI eht fo elor eht dna gnimmargorp desab
.secafretnielbaremunEI dna
stcurtsnoC gnipooL elihw/od dna elihw ehT
elihw ehT dluohs lufesu si tcurtsnoc gnipool fo kcolb a etucexe ot hsiw uoy emos litnu stnemetats
itidnoc gnitanimret W .dehcaer neeb sah no fo epocs eht nihti si tneve gnitanimret siht erusne ot
eht ,elpmaxe gniwollof eht nI .pool sseldne na ni kcuts eb lliw uoy ,esiwrehto ;dehsilbatse deedni
detnirp ylsuounitnoc eb lliw ”pool elihw nI“ egassem t setanimret resu eht litnu eh gniretne yb pool
:tpmorp dnammoc eht ta sey
][gnirts(niaM diov citats
{
;"on" = enoDsIresu gnirts
ssalc rewol a no tseT //
=! )(rewoLoT.enoDsIresu(elihw
{
;)" :]on[ ]sey[ ?enod uoy erA"(etirW.elosnoC
;)(eniLdaeR.elosnoC = enoDsIresu
eniLetirW.elosnoC ;)"pool elihw nI"(
}
}
etatselihw/od eht si poolelihw eht ot detaler ylesolC ,poolelihw elpmis a ekiL .tnem taht si elihw/od
spoolelihw/od eht etucexe ot deetnaraug era noc ni( ecno tsael ta edoc fo kcolb gnidnopserroc -
ssop si ti ,tsart elpmis a taht elbi w eslaf si noitidnoc gnitanimret eht fi etucexe reven yam poolelih
)sgra ][gnirts(niaM diov citats
{
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 36
;"" = enoDsIresu gnirts
{
nI"(eniLetirW.elosnoC
erA"(etirW.elosnoC
;)(eniLdaeR.elosnoC = enoDsIresu
mes eht etoN // ;)"sey" =! )(rewoLoT.enoDsIresu(elihw} !noloci
}
stcurtsnoC wolf lortnoC #C 31.3
eht ,stnemetats fo kcolb a revo etareti nac uoy taht woN ot woh si tpecnoc detaler txen eht lortnoc
owt senifed #C .noitucexe margorp fo wolf eht retla ot stcurtsnoc elpmis ,margorp ruoy fo wolf
suoirav no desab :seicnegnitnoc
tnemetatsesle/fi ehT •
tnemetatshctiws ehT •
tnemetatS esle/fi ehT
tnemetatsesle/fi eht ,revewoh ,++C dna C ni ekilnU .tnemetatsesle/fi eht dneirf doog ruo si pu tsriF
hcus seulav coh da ton ,snoisserpxe naelooB no ylno setarepo #C ni sa – esle/fi ,siht neviG .0 ,1
3 elbaT ni nwohs - .eulav naelooB laretil a niatbo ot redro ni 6
3 elbaT - srotarepO ytilauqE dna lanoitaleR #C .6
egasU elpmaxE rotarepO lanoitaleR/ytilauqE #C efiL ni gninaeM
eurt snruteR si noisserpxe hcae fi ylno
eurt snruteR noisserpxe hcae fi ylno
eurt snruteR ssel si A noisserpxe fi
,ot lauqe ro naht ssel ,naht retaerg
noisserpxe ot lauqe ro naht retaerg ro
noitidnoc a gnitset fo skcirt dlo eht taht erawa eb ot deen sremmargorp ++C dna C ,niagA a rof
era uoy gnirts eht fi ees ot tnaw uoy yas s’teL .#C ni krow ton lliw ”orez ot lauqe ton“ eulav
etirw ot detpmet eb yam uoY .sretcarahc orez naht regnol si htiw gnikrow \
.loob a ton ,tni na snruter htgneL taht nevig ,lagelli si sihT //
hguoht gnirts ;"skcirt wen god dlo na hcaet NAC uoY" = yaDehTfOt
)htgneL.yaDehTfOthguoht(fi
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 46
{
:swollof sa noisserpxe lanoitidnoc ruoy yfidom ot deen uoy
.eslaf ro eurt rehtie ot sevloser siht sa ,lageL //
)htgneL.yaDehTfOthguoht =! 0 (fi
{
...
}
oc eb yam tnemetatsfi nA mrofrep ot stnem niatnoc nac dna llew sa snoisserpxe xelpmoc fo desopm
erom - morf devomer raf oot ton dna( avaJ dna )++(C ot lacitnedi si xatnys ehT .gnitset xelpmoc
arepo lanoitidnoc fo tes detcepxe na sreffo #C ,snoisserpxe xelpmoc dliub oT .)cisaB lausiV sa ,srot
3 elbaT ni nwohs - .7
3 elbaT - srotarepO lanoitidnoC #C .7
efiL ni gninaeM elpmaxE rotarepO
DNA lanoitidnoC ))"derF" == eman( && )03 == ega((fi &&
rotarepo
RO lanoitidnoC ))"derF" == eman( || )03 == ega((fi ||
rotarepo
lanoitidnoC )looBym!(fi ! rotarepo TON
tnemetatS hctiws ehT
desab C rehto ni sA .tnemetatshctiws eht si #C yb dereffo tcurtsnoc noitceles elpmis rehto ehT
fo tes denifederp a no desab wolf margorp eldnah ot uoy swolla tnemetatshctiws eht ,segaugnal
lof eht ,elpmaxe roF .seciohc fo eno no desab egassem gnirts cificeps a stnirp cigol)(niaM gniwol
:)noitceles dilavni na seldnah esactluafed eht( snoitceles elbissop owt
.eulav laciremun a no hctiwS //
][gnirts(niaM diov citats
{
;)"]BV[ 2 ,]#C[ 1"(eniLetirW.elosnoC
lP"(etirW.elosnoC ;)" :ecnereferp egaugnal ruoy kcip esae
;)(eniLdaeR.elosnoC = eciohCgnal gnirts
;)eciohCgnal(esraP.tni = n tni
)n( hctiws
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 56
{
:1 esac
;)".egaugnal enif a si #C ,eciohc dooG"(eniLetirW.elosnoC
;kaerb
:2 esac
,gnidaerhtitlum ,POO :TEN. BV"(eniLetirW.elosnoC ;)"!erom dna
;kaerb
:tluafed
;)"!taht htiw kcul doog...lleW"(eniLetirW.elosnoC
;kaerb
}
}
ot noitidda ni atad gnirts etaulave nac uoy taht si tnemetatshctiws #C eht fo erutaef ecin enO
yrev siht seod taht tnemetatshctiws detadpu na si ereH .atad ciremun deen on evah ew eciton( gniht
:)hcaorppa
)sgra ][gnirts(niaM diov citats
{
#C"(eniLetirW.elosnoC
;)" :ecnereferp egaugnal ruoy kcip esaelP"(etirW.elosnoC
;)(eniLdaeR.elosnoC = eciohCgnal gnirts
)eciohCgnal( hctiws
{
:"#C" esac
c dooG"(eniLetirW.elosnoC ;)".egaugnal enif a si #C ,ecioh
;kaerb
:"BV" esac
;)"!erom dna gnidaerhtitlum ,POO :TEN. BV"(eniLetirW.elosnoC
;kaerb
:tluafed
;)"!taht htiw kcul doog...lleW"(eniLetirW.elosnoC
;kaerb
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 66
}
}
C fo tes etelpmoc ehT 41.3
lamiced seY lamiceD.metsyS ot 001 69 A 8201 - dengis tib
gnirts rebmun seY a stneserpeR yromem metsys yb detimiL gnirtS.metsyS
ssalc esab ehT derots eb nac epyt ynA tcejbO.metsyS seY tcejbo sretcarahc edocinU fo tes
TEN. eht ni sepyt elbairav tcejbo na ni lla fo
esrevinu
ohteM 51.3 sreifidoM retemaraP d
ekilnu ,revewoH .rellac eht yb ni dessap sretemarap ekat ot dnet )level ecnatsni dna citats( sdohteM
woh lortnoc taht sreifidom retemarap fo tes a sedivorp #C ,segaugnal gnimmargorp emos
enruter ylbissop dna( otni tnes era stnemugra 3 elbaT ni nwohs sa ,dohtem nevig a )morf d - .5
3 elbaT - sreifidoM retemaraP #C .5
reifidoM retemaraP efiL ni gninaeM
)enon( si ti ,reifidom retemarap a htiw dekram ton si retemarap a fI
dohtem dellac eht gninaem ,eulav yb dessap eb ot demussa
.atad lanigiro eht fo ypoc a seviecer
tuo issa era sretemarap tuptuO dellac gnieb dohtem eht yb deng
,sretemarap tuptuo ngissa ot sliaf dohtem dellac eht fI .)ecnerefer yb dessap erofereht dna(
.rorre relipmoc a deussi era uoy
smarap emarap sihT elbairav a ni dnes ot uoy swolla reifidom ret
lacigol elgnis a sa stnemugra depyt yllacitnedi fo rebmun
,reifidomsmarap elgnis a ylno evah nac dohtem A .retemarap
fo retemarap lanif eht eb tsum ti dna
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 76
t yb dengissa yllaitini si eulav ehT fer .dohtem eht yb dengissaer yllanoitpo eb yam dna ,rellac eh
eht fi detareneg si rorre relipmoc oN .)ecnerefer yb dessap osla si atad eht sa( dohtem dellac eht
.retemarapfera ngissa ot sliaf dohtem dellac
retemaraP tluafeD ehT - roivaheB gnissaP
ni rennam tluafed ehT od uoy fi ,tup ylpmiS .eulav yb si noitcnuf a otni tnes si retemarap a hcihw
retemarap a htiw tnemugra na kram ton - eht otni dessap si elbairav eht fo ypoc a ,reifidom cirtnec
:noitcnuf
.tluafed yb eulav yb dessap era stnemugrA //
ni(ddA tni citats cilbup )y tni ,x t
{
sna tni
segnahc eseht ees ton lliw rellaC //
eht fo ypoc a gniyfidom era uoy sa //
lanigiro //
;00001 = x
;88888 = y
;sna nruter
}
uoy fi ,eroferehT .eulav yb dessap eb lliw sretemarap regetni gnimocni eht ,ereH
ht fo seulav eht egnahc si rellac eht ,rebmem eht fo epocs eht nihtiw sretemarap e
s’rellac eht fo seipoc fo seulav eht gnignahc era uoy taht nevig ,erawanu yllufssilb
:sepyt atad regetni
)sgra ][gnirts(niaM diov citats
{
;01 = y ,9 = x tni
erofeB"(eniLetirW.elosnoC
.elosnoC rewsnA"(eniLetirW
retfA"(eniLetirW.elosnoC
}
ot llac eht retfa dna erofeb lacitnedi niamery dnax fo seulav eht ,epoh dluow uoy sA
.)(ddA
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 86
neeb evah taht sdohteM .sretemarap tuptuo fo esu eht evah ew ,txeN reifidoM tuo ehT
etemarap tuptuo ekat ot denifed etairporppa na ot meht ngissa ot noitagilbo rednu era sr
eviecer lliw uoy ,siht erusne ot liaf uoy fi( noitseuq ni dohtem eht gnitixe erofeb eulav
taht dohtem)(ddA eht fo noisrev evitanretla na si ereh ,etartsulli oT
nisu sregetni owt fo mus eht snruter eulav nruter lacisyhp eht eton( reifidomtuo #C eht g
:)diov won si dohtem siht fo
.rebmem eht yb detacolla era sretemarap tuptuO //
)sna tni tuo ,y tni ,x tni(ddA diov citats cilbup
{
;y + x = sna
}
seriuqer osla sretemarap tuptuo htiw dohtem a gnillaC .reifidomtuo eht fo esu eht
taht llaceR
:elpmaxe rof ,)llac eht retfa tsol si eulav lanigiro eht ,os od uoy fi( esu erofeb
)sgra ][gnirts(niaM diov citats
{
#C eht ,revewoH .retemarap tuptuo na gnisu noitammus ruoy fo eulav eht // O tu seod reifidom
vres elgnis a morf seulav nruter elpitlum niatbo ot rellac eht swolla ti :esoprup lufesu yrev a e
.noitacovni dohtem
.sretemarap tuptuo elpitlum gninruteR //
)c loob tuo ,b gnirts tuo ,a tni tuo(seulaVesehTlliF diov citats
;".gnirts ruoy yojnE"
;eurt = c
}
hT :dohtem gniwollof eht ekovni ot elba eb dluow rellac e
)sgra ][gnirts(niaM diov citats
{
;i tni
;rts gnirts
;b loob
tuo ,i tuo(seulaVesehTlliF
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 96
:si tnI"(eniLetirW.elosnoC
;)rts ,"}0{ :si gnirtS"(eniLetirW.elosnoC
;)b ,"}0{ :si naelooB"(eniLetirW.elosnoC
}
reifidoM fer ehT
wolla ot hsiw uoy era sretemarap ecnerefeR .reifidom retemarapfer #C eht fo esu eht redisnoc woN
eht ni deralced stniop atad suoirav )fo seulav eht egnahc yllausu dna( no etarepo ot dohtem a
ppaws ro gnitros a sa hcus( epocs s’rellac dna tuptuo neewteb noitcnitsid eht etoN .)enituor gni
eht ot dessap yeht erofeb dezilaitini eb ot deen ton od sretemarap tuptuO •:sretemarap ecnerefer
ecnerefeR • .gnitixe erofeb sretemarap tuptuo ngissa tsum dohtem ehT ?siht rof nosaer ehT .dohtem
temarap era uoY ?siht rof nosaer ehT .dohtem eht ot dessap era yeht erofeb dezilaitini eb tsum sre
eb dluow taht ,eulav laitini na ot ti ngissa t’nod uoy fI .elbairav gnitsixe na ot ecnerefer a gnissap
.elbairav lacol dengissanu na no gnitarepo fo tnelaviuqe eht
:sgnirts owt spaws taht dohtem a fo yaw yb drowyekfer eht fo esu eht tuo kcehc s’teL
.retemarap ecnerefeR //
)2s gnirts fer ,1s gnirts fer(sgnirtSpawS diov citats cilbup
{
;1s = rtSpmet gnirts
;2s = 1s
2s
}
:os sa dellac eb nac dohtem sihT
M diov citats ][gnirts(nia
{
;"gnirts tsriF" = s gnirts
;"gnirts rehto yM" = 2s gnirts
;)2s ,s ," }1{ ,}0{ :erofeB"(eniLetirW.elosnoC
;)2s fer ,s fer(sgnirtSpawS
;)2s ,s ," }1{ ,}0{ :retfA"(eniLetirW.elosnoC
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 07
rts lacol ot eulav laitini na dengissa sah rellac eht ,ereH ot llac eht ecnO .)2s dna s( atad gni
tsriF" eulav eht stroper 2s elihw ,"gnirts rehto yM" eulav eht sniatnoc won s ,snruter )(sgnirtSpawS
."gnirts
reifidoM smarap ehT
tnes a etaerc ot uoy swolla hcihw ,reifidomsmarap eht si reifidom retemarap lanif ehT fo tes a ot
eht raelc oT .gnisufnoc eb nac siht ,seY .retemarap lacigol elgnis a sa stnemugra depyt yllacitnedi
emos' fo egareva nruteR //:selbuod fo rebmun yna fo egareva eht snruter taht dohtem a emussa ,ria
.selbuod fo 'rebmun
AetaluclaC elbuod citats )seulav ][elbuod smarap(egarev
{
;0 = mus elbuod
;0 = i tni( rof
;]i[seulav =+ mus
;)htgneL.seulav / mus( nruter
}
tcaf ni si dohtem siht tahW .selbuod fo yarra retemarap a ekat ot denifed neeb sah dohtem sihT
dna selbuod fo rebmun yna em dneS“ ,si gniyas neviG ”.egareva eht etupmoc ll’I
ni reifidomsmarap eht fo esu ekam ton did uoy fi( syaw gniwollof eht fo yna ni)(egarevAetaluclaC
relipmoc a ni tluser dluow dohtem siht fo noitacovni tsrif eht ,)(egarevAetaluclaC fo noitinifed eht
(niaM diov citats:)rorre )sgra ][gnirts
{
ammoc a ni ssaP // - ...selbuod fo tsil detimiled
;egareva elbuod
,2.3 ,0.4(egarevAetaluclaC = egareva
,2.3 ,0.4 fo egarevA"(eniLetirW.elosnoC
.selbuod fo yarra na ssap ro... //
;} 7.5 ,2.3 ,0.4 { = atad ][elbuod
egarevAetaluclaC = egareva ;)atad(
;)egareva ,"}0{ :si atad fo egarevA"(eniLetirW.elosnoC
;)(eniLdaeR.elosnoC
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 17
eht ni retal cipot siht tisiver ll’eW .sreifidom retemarap ta kool laitini ruo pu sparw tahT
sepyt ecnerefer dna sepyt eulav neewteb noitcnitsid eht enimaxe ew nehwretpahc s’tel ,pu txeN .
.egaugnal gnimmargorp #C eht fo snoitcurtsnoc noisiced dna noitareti eht tuo kcehc
#C ni noitalupinaM yarrA 61.3
era taht ,epyt atad denifed emas eht fo ,stniop atad fo noitcelloc a si yarra na ,gnikaeps yllamroF
remun a gnisu dessecca yB .yarrA.metsyS deman evired dna sepyt secnerefer era syarrA .xedni laci
rewol yrartibra na htiw yarra na etaerc ot elbis a evah syawla syarra TEN. ,tluafed
.dohtem)(ecnatsnIetaerC.yarrA.metsyS
lla fo tsriF .syaw fo lufdnah a ni deralced eb nac syarra #C esohw yarra na gnitaerc era uoy fi ,
tey ot eud spahrep( emit retal a ta deificeps eb lliw seulav - ot - eb - eht fo ezis resu deniatbo yarra
stekcarb erauqs gnisu :elpmaxe rof ,noitacolla sti fo emit eht ta
0{ stnemele 3 gniniatnoc yarra gnirts a ngissA // - }2
][gnirts
;]3[gnirts wen = MOCnOskoob
0{ derebmun ,yarra gnirts meti 001 a ezilaitinI // - }99
;]001[gnirts wen = teNtoDnOskoob ][gnirts
hcae llif ot xatnys rexedni eht fo esu ekam nac uoy ,yarra na deralced evah uoy ecnO
:eulav a htiw meti
,etaerC // .sgnirts eerht fo yarra na tnirp dna ,etalupop
;MOCnOskoob ][gnirts
;]3[gnirts wen = MOCnOskoob
;"0.3 LTA dna MOC ot pohskroW s'repoleveD"
;"MOC edisnI"
edisnI"
)MOCnOskoob ni s gnirts( hcaerof
;)s(eniLetirW.elosnoC
wonk uoy fi ,noitaton dnahtrohs a sA yficeps yam uoy ,noitaralced fo emit eht ta seulav s’yarra na
si ezis yarra eht ,esac siht ni taht etoN .stekcarb ylruc nihtiw seulav eseht
detaluclac si ti sa( lanoitpo
:lacitnedi era snoitaralced
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 27
ta nwonk eb tsum seulav( noitaralced yarra dnahtrohS // .)noitaralced fo emit
;} 0 ,32 ,22 ,02 { ][tni wen = n ][tni
;} 0 ,32 ,22 ,02 { = 3n ][tni
:epyt yarra na etaerc nac uoy hcihw ni rennam lanif eno si erehT
0{ ,stnemele 4 // ;} 0 ,32 ,22 ,02 { ]4[tni wen = 2n ][tni - }3
s eulav ciremun eht ,esac siht nI eht ton ,yarra eht ni stnemele fo rebmun eht stneserper deificep
fo rebmun eht dna ezis deralced eht neewteb hctamsim a si ereht fI .dnuob reppu eht fo eulav
laitini - wa eb ,yarra na eralced uoy woh fo sseldrageR .rorre emit elipmoc a deussi era uoy ,srezi era
uoy litnu seulav tluafed evitcepser rieht ot tes yllacitamotua era yarra TEN. a ni stnemele eht taht
ni 0.0 ro( 0 ot tes si rebmem hcae ,sepyt laciremun fo yarra na evah uoy fi ,suhT .esiwrehto etacidni
gnitaolf fo esac eht - era stcejbo ,)srebmun tniop .eslaf ot tes era sepyt naelooB dna ,llun ot tes
)seulaV nruteR dna( sretemaraP sA syarrA
roF .eulav a sa ti eviecer dna retemarap a sa ti ssap ot eerf era uoy ,yarra na detaerc evah uoy ecnO
a gnimocni na sekat dohtem)(yarrAtnirP gniwollof eht ,elpmaxe rebmem hcae stnirp dna stni fo yarr
ot ti snruter dna sgnirts fo yarra na setalupop =dohtem)(yarrAgnirtSteG eht elihw ,elosnoc eht ot
:rellac eht
)stnIym ][tni(yarrAtnirP diov citats
{
)++i ;htgneL.stnIym < i ;0 = i tni(rof
si }0{ metI"(eniLetirW.elosnoC ;)]i[stnIym ,i ,"}1{
}
)(yarrAgnirtSteG ][gnirts citats
{
;} "yarrAgnirtSteG" ,"morf" ,"olleH" { = sgnirtSeht ][gnirts
;sgnirtSeht nruter
}
:os sa dohtem)(niaMa morf dekovni eb yam sdohtem esehT
)sgra ][gnirts(niaM diov citats
{
,32 ,22 ,02{ = sega ][tni ; }0
;)sega(yarrAtnirP
;)(yarrAgnirtSteG = srts ][gnirts
)srts ni s gnirts(hcaerof
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 37
;)s(eniLetirW.elosnoC
;)(eniLdaeR.elosnoC
}
syarrA lanoisnemiditluM htiw gnikroW
elgnis eht ot noitidda nI - owt stroppus osla #C ,raf suht nees evah uoy syarra noisnemid fo seiteirav
yarra na ylpmis si hcihw ,yarra ralugnatcer a demret si eseht fo tsrif ehT .syarra lanoisnemiditlum
a llif dna eralced oT .htgnel emas eht fo si wor hcae erehw ,snoisnemid elpitlum fo
:swollof sa deecorp ,yarra ralugnatcer lanoisnemiditlum
ts ][gnirts(niaM diov cita
{
...
.yarra DM ralugnatcer A //
;xirtaMym ],[tni
;]6,6[tni wen = xirtaMym
.yarra )6 * 6( etalupoP //
)++i ;6 < i ;0 = i tni(rof
)++j ;6 < j ;0 = j tni(rof
;j * i = ]j ,i[xirtaMym
.yarra )6 * 6( tnirP //
i ;6 < i ;0 = i tni(rof )++
{
)++j ;6 < j ;0 = j tni(rof
" + ]j ,i[xirtaMym(etirW.elosnoC \ ;)"t
;)(eniLetirW.elosnoC
}
...
}
eman eht sA .yarra deggaj a demret si yarra lanoisnemiditlum fo epyt dnoces ehT
,seilpmi
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 47
cihw fo hcae ,syarra renni fo rebmun emos niatnoc syarra deggaj euqinu a evah yam h
:elpmaxe rof ,timil reppu
)sgra ][gnirts(niaM diov citats
{
...
.)syarra fo yarra na ,.e.i( yarra DM deggaj A //
.syarra tnereffid 5 fo yarra na evah ew ereH //
;][]5[tni wen = yarrAgaJym ][][tni
.yarra deggaj eht etaerC //
tni( rof )++i ;htgneL.yarrAgaJym < i ;0 = i
;]7 + i[tni wen = ]i[yarrAgaJym
)!orez ot detluafed si tnemele hcae ,rebmemer( wor hcae tnirP //
)++i ;5 < i ;0 = i tni(rof
{
: }1{ si }0{ wor fo htgneL"(etirW.elosnoC \ ;)htgneL.]i[yarrAgaJym ,i ,"t
m < j ;0 = j tni(rof )++j ;htgneL.]i[yarrAgaJy
;)" " + ]j[]i[yarrAgaJym(etirW.elosnoC
;)(eniLetirW.elosnoC
}
}
ruo nrut s’tel ,syarra #C etalupop dna dliub ot woh dnatsrednu uoy taht woN
eht ot noitnetta
ssalC esaB yarrA.metsyS ehT
citamotua si etaerc uoy yarra TEN. yrevE a senifed ssalc sihT .yarrA.metsyS morf devired ylla
3 elbaT .elbatalap erom hcum syarra htiw gnikrow ekam taht sdohtem lufpleh fo rebmun - a sevig 41
.srebmem gnitseretni erom eht fo )lla ton tub( emos fo nwodnur
3 elbaT - yarrA.metsyS fo srebmeM tceleS .41
efiL ni gninaeM rebmeM
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 57
yarra eht fI .meti nevig a rof yarra )detros ylsuoiverp( a sehcraes dohtem citats sihT )(hcraeSyraniB
eht tnemelpmi tsum noitseuq ni epyt eht ,detaerc evah uoy sepyt motsuc fo desopmoc si
ot )7 retpahC ees( ecafretnirerapmoCI
e .hcraes yranib a ni egagn
ot yarra eht ni stnemele fo egnar a stes dohtem citats sihT )(raelC
seulav ytpme
.)sepyt ecnerefer rof llun ;sepyt eulav rof 0(
eht otni yarra ecruos eht morf stnemele ypoc ot desu si dohtem sihT )(oTypoC
L .yarra noitanitsed daer sihT htgne - ni stnemele fo rebmun eht enimreted ot desu si ytreporp ylno
sihT )(esreveR .yarra tnerruc eht fo snoisnemid fo rebmun eht snruter ytreporp sihT knaR .yarra na
eno a fo stnetnoc eht sesrever dohtem citats - htem sihT )(troS .yarra lanoisnemid eno a stros do -
,ecafretnirerapmoCI eht tnemelpmi yarra eht ni stnemele eht fI .sepyt cisnirtni fo yarra lanoisnemid
.)7 retpahC ees ,niaga( sepyt motsuc ruoy tros osla nac uoy
eht fo esu sekam edoc gniwollof ehT .noitca ni srebmem eseht fo emos ees s’teL )(esreveR citats
fo yarra na tuoba noitamrofni emos tuo pmup ot )ytreporphtgneL eht dna( sdohtem)(raelC dna
:elosnoc eht otsemaNtsrif deman sgnirts
.srebmem yarrA.metsyS emos esicrexe dna syarra gnirts emos etaerC //
)sgra ][gnirts(niaM diov citats
{
/ .sgnirts fo yarrA /
; }"ydlaB" ,"wollawS" ,"cinimoD" ,"evetS" { = semaNtsrif ][gnirts
deralced sa seman tnirP //
;)":yarra eht si ereH"(eniLetirW.elosnoC
)++i ;htgneL.semaNtsrif < i ;0 = i tni(rof
}0{ :emaN"(etirW.elosnoC \ ;)]i[semaNtsrif ,"t
elosnoC "(eniLetirW. \ ;)"n
.tnirp dna yarra esreveR //
;)semaNtsrif(esreveR.yarrA
;)":desrever ecno yarra eht si ereH"(eniLetirW.elosnoC
)++i ;htgneL.semaNtsrif < i ;0 = i tni(rof
}0{ :emaN"(etirW.elosnoC \ ;)]i[semaNtsrif ,"t
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 67
"(eniLetirW.elosnoC \ ;)"n
elC // .ydlaB tub lla tuo ra
;)"...ydlaB tub lla tuo deraelC"(eniLetirW.elosnoC
;)3 ,1 ,semaNtsrif(raelC.yarrA
)++i ;htgneL.semaNtsrif < i ;0 = i tni(rof
}0{ :emaN"(etirW.elosnoC \ ;)]i[semaNtsrif ,"t
;)(eniLdaeR.elosnoC
}
#C ni noitalupinaM gnirtS 71.3
ts #C ehT rebmun a sedivorp hcihw ,epytgnirtS.metsyS eht fo noitaton dnahtrohs a si drowyekgnir
.srebmem gnitseretni eht fo )lla ton tub( emos stsil
3 elbaT - gnirtS.metsyS fo srebmeM tceleS .21
rebmeM efiL ni gninaeM
htgneL o htgnel eht snruter ytreporp sihT .gnirts tnerruc eht f
gnirts tnerruc eht fi enimreted ot desu si dohtem sihT )(sniatnoC
.gnirts deificeps a sniatnoc tcejbo
)(tamroF si dohtem citats sihT laretil gnirts a tamrof ot desu rehto gnisu
na )sgnirts rehto dna atad laciremun ,.e.i( sevitimirp noitaton}0{ eht d
.retpahc siht ni reilrae denimaxe
)(tresnI t desu si dohtem sihT tnerruc eht fo ypoc a eviecer o taht gnirts
.atad gnirts detresni ylwen sniatnoc
)(tfeLdaP neeb sah taht gnirts tnerruc eht fo seipoc nruter sdohtem esehT
deddap
hgiRdaP )(t .atad cificeps htiw
)(evomeR snoitacifidom htiw ,gnirts a fo ypoc a eviecer ot sdohtem eseht esU
)(ecalpeR .)decalper ro devomer sretcarahc(
)(gnirtsbuS eht fo gnirtsbus a stneserper taht gnirts a snruter dohtem sihT
.gnirts tnerruc
oT )(yarrArahC .gnirts tnerruc eht gnitneserper yarra retcarahc a snruter dohtem sihT
)(reppUoT ro esacreppu ni gnirts nevig a fo ypoc a etaerc sdohtem esehT
.esacrewol
)(rewoLoT
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 77
snoitarepO gnirtS cisaB
snoc ,snoitarepo gnirts cisab emos etartsulli oT :dohtem)(niaM gniwollof eht redi
][gnirts(niaM diov citats
{
;)"***** sgnirtS htiw nuF *****"(eniLetirW.elosnoC
si siht ,yoB" = s gnirts
"(eniLetirW.elosnoC -- :?'yo' sniatnoc s >
"(eniLetirW.elosnoC -- :?'yoB' sniatnoc s >
,'.'(ecalpeR.s(eniLetirW.elosnoC
oC ,0(tresnI.s(eniLetirW.elosn
;)(eniLdaeR.elosnoC
}
srotarepo ytilauqe eht ,epyt ecnerefer a signirts hguohtla taht erawa eb dluohs uoY
)=! dna==(
:eurt ot setaulave nosirapmoc gniwollof eht ,eroferehT .refer yeht hcihw
;" olleH" = 1s gnirts
" = 2s gnirts ;" olleH
;)2s == 1s ,"}0{ :2s == 1s"(eniLetirW.elosnoC
:eslaf ot setaulave nosirapmoc siht saerehw
;" olleH" = 1s gnirts
;"!dlroW" = 2s gnirts
;)2s == 1s ,"}0{ :2s == 1s"(eniLetirW.elosnoC
ht gnirts wen a otni sgnirts gnitsixe etanetacnoc ot hsiw uoy nehW lla fo mus eht si ta #C
sedivorp gniwollof eht ,siht neviG .dohtem)(tacnoC.gnirtS citats eht sa llew sa rotarepo+ eht
:tnelaviuqe yllanoitcnuf era stnemetats
.sgnirts fo noitanetacnoC //
;2s + 1s + s = gnirtSwen gnirts
}0{ = 2s + 1s + s"(eniLetirW.elosnoC ;)gnirtSwen ,"
lufpleh rehtonA;))2s ,1s ,s(tacnoC.gnirts ,"}0{ = )2s ,1s ,s(tacnoC.gnirts"(eniLetirW.elosnoC
retcarahc laudividni hcae revo etareti ot ytiliba eht si epytgnirts eht fo erutaef rieht ot ssecca
l ll’uoY .dohtem rexedni na fo esu ekam stnetnoc ,revewoh ;9 retpahC ni srexedni dliub ot woh nrae
eht ot tcejbo gnirts1s eht fo retcarahc hcae stnirp edoc gniwollof eht ,tpecnoc eht etartsulli ot
:elosnoc
hcae ssecca ot rexedni na senifed osla gnirtS.metsyS //
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 87
.gnirts eht ni retcarahc //
= k tni( rof )++k ;htgneL.1s < k ;0
;)]k[1s ,k ,"}1{ si }0{ rahC"(eniLetirW.elosnoC
#C eht desu eb osla nac ssalc gnirts eht ,rexedni s’epyt eht htiw gnitcaretni ot evitanretla na sA
tsyS laudividni fo yarra na gniniatniam signirtS.metsyS taht neviG .tcurtsnochcaerof ,sepytrahC.me
:elosnoc eht ot1s fo retcarahc hcae stnirp osla edoc gniwollof eht
)1s ni c rahc(hcaerof
;)c(eniLetirW.elosnoC
sretcarahC epacsE
C rehto ni ekiL - hcihw ,sretcarahc epacse suoirav niatnoc yam slaretil gnirts #C ni ,segaugnal desab
woh yfilauq snigeb retcarahc epacse hcaE .maerts tuptuo eht ot detnirp eb dluohs atad retcarahc eht
dniheb sgninaem eht no ytsur tib a era uoy esac nI .nekot cificeps a yb dewollof ,hsalskcab a htiw
3 elbaT ,sretcarahc epacse eseht - .snoitpo nommoc erom eht stsil 31
3 elbaT - sretcarahC epacsE laretiL gnirtS .31
retcarahC efiL ni gninaeM
\ stresnI ' .laretil gnirts a otni etouq elgnis a
\ stresnI " .laretil gnirts a otni etouq elbuod a
\\ stresnI d nehw lufpleh etiuq eb nac sihT .laretil gnirts a otni hsalskcab a .shtap elif gninife
\ a oidua na eb nac siht ,snoitacilppa elosnoc roF .)peeb( trela metsys a sreggirT
.resu eht ot eulc
\ n .)smroftalp 23niW no( enil wen a stresnI
\ r .nruter egairrac a stresnI
\ t retil gnirts eht otni bat latnoziroh a stresnI .la
ekam nac uoy ,drow hcae neewteb bat a sniatnoc taht gnirts a tnirp ot ,elpmaxe roF
\ epacset :retcarahc
.sretcarahc epacse fo rebmun yna niatnoc yam sgnirts laretiL //
olleH" \ erehTt \ ;"niagAt
;)3s(eniLetirW.elosnoC
iw uoy emussa ,elpmaxe rehtona sA noitatouq sniatnoc taht laretil gnirts a etaerc ot hs
stresni taht laretil gnirts lanif a dna ,htap yrotcerid a senifed taht rehtona ,skram
,srorre relipmoc tuohtiw os od oT .atad retcarahc eht gnitnirp
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 97
eht fo esu ekam ot deen dluow uoy \ ,"
\\ dna , \ sen :sretcarahc epac
sevol enoyrevE"(eniLetirW.elosnoC \ dlroW olleH" \ ;)""
:C"(eniLetirW.elosnoC \\ ppAyM \\ nib \\ ;)"gubed
.dehsinif llA"(eniLetirW.elosnoC \n\n\ ;)"n
sgnirtS mitabreV #C htiw gnikroW
@ eht secudortni #C - ev a demret noitaton laretil gnirts dexiferp gnisU .gnirts mitabr mitabrev
.shtap krowten dna yrotcerid gnitneserper sgnirts htiw gnikrow nehw = lufesu tsom ,sgnirts
fo esu gnikam naht rehtar ,eroferehT \\ epacse
mitabrev detnirp si gnirts gniwollof ehT // :gniwollof
sretcarahc epacse lla ,suht // .deyalpsid era
:C"@(eniLetirW.elosnoC \ ppAyM \ nib \ ;)"gubed
taht sgnirts rof ecaps etihw evreserp ot desu eb nac sgnirts mitabrev taht eton oslA
:senil elpitlum revo wolf
.sgnirts mitabrev htiw devreserp si ecaps etihW //
si sihT"@ = gnirtSgnoLym gnirts yrev a
yrev
yrev
;"gnirts gnol
;)gnirtSgnoLym(eniLetirW.elosnoC
rof ,nekot" eht gnilbuod yb gnirts laretil a otni etouq elbuod a tresni osla nac uoY
:elpmaxe
redliuBgnirtS.txeT.metsyS fo eloR ehT
per ot hsiw uoy nehw tcefrep si epytgnirts eht elihW eb nac ti tsrif( selbairav gnirts cisab tneser
ot sah nosaer ehT .atad = lautxet fo esu yvaeh sekam taht margorp a gnidliub era uoy fi tneiciffeni
ecno deifidom eb tonnac gnirts a fo eulav eht :sgnirts TEN. gnidrager tcaf tnatropmi yrev a htiw od
hsilbatse talf a ekil sdnuos siht ,ecafrus eht nO.elbatummi era sgnirts #C .de - ew taht nevig ,eil tuo
,gnirtS.metsyS fo sdohtem eht enimaxe uoy fi ,revewoH .selbairav gnirts wen gningissa syawla era
gnirts a yfidom yllanretni ot mees taht sdohtem eht taht eciton uoy fo ypoc deifidom a nruter tcaf ni
maxe roF .gnirts lanigiro eht gnitsixe na fo reffub gniylrednu eht gniyfidom =ton era uoy ,tcejbo
:mrof esacreppu ni tcejbo gnirts wen a eviecer tub ,tcejbo gnirts
)sgra ][gnirts(niaM diov citats
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 08
{
...
t segnahc ekaM // !epoN ?dexiFrts o
;"efil nageb I woh si sihT" = dexiFrts gnirtS.metsyS
;)dexiFrts(eniLetirW.elosnoC
;)(reppUoT.dexiFrts = noisreVreppu gnirts
;)dexiFrts(eniLetirW.elosnoC
}0{"(eniLetirW.elosnoC \n\ ;)noisreVreppu ,"n
...
ngissa uoy nehw ,niev ralimis a nI} yllautca evah uoy ,eulav wen a ot tcejbo gnirts gnitsixe na
egabrag eb yllautneve lliw tcejbo gnirts lanigiro eht( ssecorp eht ni gnirts wen a detacolla
gnirts fo tnuoma eht ecuder pleh oT .noitanetacnoc gnirts htiw srucco ssecorp ralimis A .)detcelloc
oc ruo gnirud nees tsrif(redliuBgnirtS deman ssalc a senifed ecapsemantxeT.metsyS eht ,gniyp
sedivorpredliuBgnirtS,gnirtS.metsyS ekilnU .)retpahc siht ni reilraetcejbO.metsyS fo noitanimaxe
nirtS ,gnirtS.metsyS ekiL .reffub gniylrednu eht ot ssecca tcerid uoy suoremun sedivorpredliuBg
noitatnemucod KDS 0.2 krowemarF evomer dna ,tresni ,tamrof ,dneppa ot uoy wolla taht srebmem
.)sliated lluf rof
laitini eht )tnemugra rotcurtsnoc a aiv( yficeps yam uoy ,tcejboredliuBgnirtSa etaerc uoy nehW
ht sretcarahc fo rebmun a fo yticapac tluafed eht ,os od ton od uoy fI .niatnoc nac tcejbo e
elba si = ti nahtredliuBgnirtSa ot atad retcarahc erom dda uoy fi ,esac rehtie nI .61 si redliuBgnirtS
si reffub eht ,dloh ot
:epyt ssalc siht htiw gnikrow fo elpmaxe
;metsyS gnisu
nisu .ereh sevil redliuBgnirtS // ;txeT.metsyS g
ppAgnirtS ssalc
{
)sgra ][gnirts(niaM diov citats
{
;)"atad gnirts yM"(redliuBgnirtS wen = reffuBym redliuBgnirtS
,"}0{ :redliuBgnirtS siht fo yticapaC"(eniLetirW.elosnoC
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 18
;)yticapaC.reffuBym
dneppA.reffuBym ;)" :atad laciremun emos sniatnoc "(
;)99 ,44 ,".}1{ ,}0{"(tamroFdneppA.reffuBym
,"}0{ :redliuBgnirtS siht fo yticapaC"(eniLetirW.elosnoC
;)yticapaC.reffuBym
;)reffuBym(eniLetirW.elosnoC
}
}
ruoy eb lliwgnirtS.metsyS ,sesac ynam ni taht dnatsrednu od ,woN roF .eciohc fo tcejbo lautxet
txet a gnidliub era uoy fi ,revewoH .elbigilgen eb lliw atad retcarahc fo - evisnetni
gnisu taht dnif ylekil tsom lliw uoy ,)margorp rossecorp drow a sa hcus( noitacilppa
.ecnamrofrep sevorpmiredliuBgnirtS.txeT.metsyS
81.3 snoitaremunE TEN. htiw gnikroW
eulav TEN. eht fo rebmem rehto eht era )smune ylpmis ro( snoitaremune ,serutcurts ot noitidda nI
seman cilobmys fo tes a etaerc ot tneinevnoc netfo si ti ,margorp a dliub uoy nehW .yrogetac epyt
lav laciremun gniylrednu rof uoy ,metsys lloryap eeyolpme na gnitaerc era uoy fi ,elpmaxe roF .seu
,1 ,0{ sa hcus seulav laciremun elpmis naht rehtarPV dna ,rotcartnoC,tnurG,reganaM yam
si ereh ,elpmaxe roF .nosaer yrev siht rof snoitaremune motsuc = fo noiton eht stroppus #C .}3 ,2
:noitaremuneepyTpmE eht
.noitaremune motsuc A //
epyTpmE mune
{
,reganaM
,tnurG
,rotcartnoC
PV
}
laciremun cificeps ot gnidnopserroc stnatsnoc deman ruof senifed noitaremuneepyTpmE ehT
t egnahc ot eerf era uoY .noissergorp 1 + n na yb dewollof ,tluafed uoy sa roivaheb sih
.201 ta gnirebmun nigeB
epyTpmE mune
{
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 28
,201 = reganaM
301 = // ,tnurG
401 = // ,rotcartnoC
501 = // PV
}
ot esnes doog emos rof( fI .redro laitneuqes a wollof ot deen ylirassecen ton od snoitaremunE
wollof saepyTpmE ruoy hsilbatse :yppah eb ot seunitnoc relipmoc eht ,s
!laitneuqes eb ton deen noitaremune na fo stnemelE //
epyTpmE mune
{
,01 = reganaM
,1 = tnurG
,001 = rotcartnoC
9 = PV
}
uoY .tluafed yb ot spam noitaremune na ni meti hcae rof desu epyt egarots eht ,dooh eht rednU era
eulav egarots gniylrednu eht tes ot tnaw uoy fi ,elpmaxe roF .gnikil ruoy ot siht egnahc ot eerf osla
:gniwollof eht etirw dluow uoy ,tni na naht rehtaretyb a eb otepyTpmE fo
.etyb gniylrednu na ot spam epyTpmE ,emit sihT //
etyb : epyTpmE mune
{
M ,01 = regana
,1 = tnurG
,001 = rotcartnoC
9 = PV
}
sepyt laciremun eht fo yna rof rennam ralimis a ni denifed eb nac snoitaremune #C etoN
rof gnimmargorp era uoy fi lufpleh eb nac sihT .)gnolu ro ,gnol,tniu,tni,trohsu ,trohs,etybs,etyb(
wol - ecived yromem TEN. ro sCP tekcoP sa hcus s - .senohp ralullec delbane
os fo ecalp nac uoy ,noitaremune ruoy fo epyt egarots dna egnar eht dehsilbatse evah uoy ecnO -
epyTpmE gnikat ,noitcnuf citats a gninifed ssalc a evah uoy emussA .srebmun cigam dellac
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 38
oFksA diov citats )e epyTpmE(sunoBr
{
)e(hctiws
{
:rotcartnoC.epyTpmE esac
;)"...hsac hguone teg ydaerla uoY"(eniLetirW.elosnoC
;kaerb
:tnurG.epyTpmE esac
;)"...gniddik eb ot tog evah uoY"(eniLetirW.elosnoC
;kaerb
:reganaM.epyTpmE esac
o kcots tuoba woH"(eniLetirW.elosnoC ;)"?daetsni snoitp
;kaerb
:PV.epyTpmE esac
;)"!riS ,DOOG YREV"(eniLetirW.elosnoC
;kaerb
;kaerb :tluafed
}
}
:os sa dekovni eb nac dohtem sihT
][gnirts(niaM diov citats
{
.epyt rotcartnoc a ekaM //
;derf epyTpmE
;rotcartnoC.epyTpmE = derf
;)derf(sunoBroFksA
}
ylticilpmi yeht taht si snoitaremune TEN. tuoba gniht gnitseretni ehT ssalC esaB munE.metsyS ehT
3 elbaT .noitaremune nevig a mrofsnart dna sihT .munE.metsyS morf evired - emos stnemucod 9
.citats era hcihw fo lla ,tseretni fo smeti
3 elbaT - tS tceleS .9 munE.metsyS fo srebmeM cita
rebmeM efiL ni gninaeM
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 48
)(tamroF sti ot epyt detaremune deificeps a fo eulav a strevnoC
tamrof deificeps eht ot gnidrocca noitatneserper gnirts tnelaviuqe
)(emaNteG of )seman lla gniniatnoc yarra na ro( eman a seveirteR ni tnatsnoc eht r
)(semaNteG eulav deificeps eht sah taht noitaremune deificeps eht
t atad gniylrednu eht snruteR )(epyTgniylrednUteG rof seulav eht dloh ot desu epy nevig a
noitaremune
)(seulaVteG i stnatsnoc eht fo seulav eht fo yarra na seveirteR noitaremune deificeps a n
)(denifeDsI eulav deificeps a htiw tnatsnoc a rehtehw fo noitacidni na snruteR
noitaremune deificeps a ni stsixe
)(esraP eno fo eulav ciremun ro eman eht fo noitatneserper gnirts eht strevnoC
itats eht fo esu ekam nac uoY sgalf gnittamrof gnirts tcaxe emas eht dna dohtem)(tamroF.munE c
etsyS fo noitanimaxe ruo gnirud retpahc eht ni reilrae denimaxe uoy ,elpmaxe roF .elosnoC.m
yam ,F,D( eulav ciremun ro ,)X( eulav lamicedaxeh eht ,)G gniyficeps yb( eman gnirts eht tcartxe
.cte fo ecnatsni na snruter dohtem sihT .)(seulaVteG deman dohtem citats a senifed fo )
ot gnidnopserroc yarra eht ni meti hcae htiw ,)retpahc siht ni retal denimaxe(yarrA.metsyS
:gniwollofn eulav/eman
)sgra ][gnirts(niaM diov citats
{
rof noitamrofni tnirP // .noitaremune epyTpmE eht
;))epyTpmE(foepyt(seulaVteG.munE = jbo yarrA
;)htgneL.jbo ,".srebmem }0{ sah mune sihT"(eniLetirW.elosnoC
)jbo ni e epyTpmE(hcaerof
{
,",}0{ :eman gnirtS"(etirW.elosnoC
,",)}0{( :tni "(etirW.elosnoC
)}0{( :xeh "(etirW.elosnoC \ ,"n
uoy emussa ,elpmaxe roF .noitaremune tnerruc eht fo rebmem a si eman
uoy ,os od oT .noitaremuneepyTpmE eht fo trap sinosrePselaS eulav eht fi wonk ot hsiw
#C eht aiv enod eb nac hcihw( noitaremune eht fo noitamrofni epyt eht ti dnes tsum
)rotarepofoepyt hsiw uoy eulav eht fo eman gnirts eht dna
:)21 retpahC ni liated retaerg hcum ni denimaxe eb lliw
)sgra ][gnirts(niaM diov citats
{
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 58
...
?eulav nosrePselaS a evah epyTpmE seoD //
))"nosrePselaS" ,)epyTpmE(foepyt(denifeDsI.munE(fi
,peY"(eniLetirW.elosnoC ;)".elpoep selas evah ew
esle
;)"...stiforp on evah ew ,oN"(eniLetirW.elosnoC
}
gnirts a morf eulav tcerroc eht ot tes noitaremune na etareneg ot elbissop osla si tI
aiv laretil
.metsyS cireneg a snruter)(esraP taht neviG .dohtem)(esraP.munE citats eht ,tcejbO
deen lliw uoy
"reganaM a si yllaS" :stnirP //
;)"reganaM" ,)epyTpmE(foepyt(esraP.munE)epyTpmE( = yllas epyTpmE
;))(gnirtSoT.yllas ,"}0{ a si yllaS"(eniLetirW.elosnoC
u eht troppus snoitaremune #C taht tuo gnitniop htrow si ti ,tsael ton tub tsaL fo es
:elpmaxe rof ,seulav dengissa eht tsniaga tset hcihw ,srotarepo suoirav
)sgra ][gnirts(niaM diov citats
{
...
?eulav laciremun tsetaerg eht sah selbairav epyTpmE owt eseht fo hcihW //
;PV.epyTpmE = eoJ epyTpmE
;tnurG.epyTpmE = narF epyTpmE
oJ(fi )narF < e
;)".eulav s'narF naht ssel si eulav s'eoJ"(eniLetirW.elosnoC
esle
;)".eulav s'eoJ naht ssel si eulav s'narF"(eniLetirW.elosnoC
}
#C ni serutcurtS gninifeD 91.3
edivorp taht seitreporp eulaVniM dna eulaVxaM troppus TEN. fo sepyt laciremun ehT
;00003 =
;)eulaVxaM.61tnIU ," }0{ :si 61tnIU na
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 68
;)eulaVniM.61tnIU ," }0{ :si 61tnIU na
;)61tnIUym ," }0{ :si
;))(epyTteG.61tnIUym ," }0{ :a ma
.)trohsu a ,.g.e( dnahtrohs 61tnIU.metsyS ni woN //
;00021 = 61tnIUrehtOym trohsu
a rof xaM"(eniLetirW.elosnoC ;)eulaVxaM.trohsu ," }0{ :si 61tnIU n
;)eulaVniM.trohsu ," }0{ :si 61tnIU na rof niM"(eniLetirW.elosnoC
;)61tnIUrehtOym ," }0{ :si eulaV"(eniLetirW.elosnoC
;))(epyTteG.61tnIUrehtOym ," }0 I"(eniLetirW.elosnoC
;)(eniLdaeR.elosnoC
}
aVniM eht ot noitidda nI enifed yam epyt metsys nevig a ,seitreporpeulaVxaM/eul
eht niatbo ot uoy swolla epytelbuoD.metsyS eht ,elpmaxe roF .srebmem lufesu rehtruf
dna nolispE rof seulav
"(eniLetirW.elosnoC - ;)nolispE.elbuod ,"}0{ :nolispE.elbuod >
"}0{ :ytinifnIevitisoP.elbuod ;)ytinifnIevitisoP.elbuod ,
;)ytinifnIevitageN.elbuod ,"}0{ :ytinifnIevitageN.elbuod
;)eulaVxaM.elbuod ,"}0{ :eulaVxaM.elbuod
;)eulaVniM.elbuod,"}0{ :eulaVniM.elbuod
a tnemngissa dilav ylno eht ,)++(C ekilnU .epyt atadnaelooB.metsyS eht redisnoc ,txeN
#C | eurt{ tes eht morf si ekat nacloob
,.g.e( – ,loob #C a ot )1 ,0 ,1
troppus ton seodnaelooB.metsyS taht raelc eb dluohs ti ,tniop siht neviG
:gnirtSeslaF/gnirtSeurT rehtar tub ,tes ytreporpeulaVxaM/eulaVniMa
!#C ni sepyt naelooB coh da erom oN //
loob !lagellI // ;0 = b
= 2b loob - !lagelli oslA // ;1
.melborp oN // ;eurt = 3b loob
.melborp oN // ;eslaf = 4b loob
"(eniLetirW.elosnoC - ;)gnirtSeslaF.loob ,"}0{ :gnirtSeslaF.loob >
"(eniLetirW.elosnoC - ;)gnirtSeurT.loob ,"}0{ :gnirtSeurT.loob >
lautxet #C TEN. llA .sepyt atadrahc dna gnirts #C cisnirtni eht yb detneserper si atad -
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 78
dnagnirtS.metsyS( sepyt gniylrednu emas eht ot atad lautxet pam segaugnal erawa
era hcihw fo htob ,)rahC.metsyS
lanoitcnuf fo laed taerg a htiw uoy sedivorp epytrahC.metsyS ehT ytiliba eht dnoyeb yti
dloh ot
retcarahc nevig a fi enimreted ot elba era uoy ,rahC.metsyS fo sdo
tniop a ,lacitebahpla ,laciremun si
:gniwollof eht
][gnirts(niaM diov citats
{
...
...stnemetats gniwollof eht fo hturt eht tseT //
"(eniLetirW.elosnoC ->
"(eniLetirW.elosnoC - >
"(eniLetirW.elosnoC - >
"(eniLetirW.elosnoC - >
"(eniLetirW.elosnoC - >
;))5 ,"erehT olleH"(ecapSetihWsI.rahc
"(eniLetirW.elosnoC - ,"}0{ :)6 ,'erehT olleH'(ecapSetihWsI.rahc >
;))6 ,"erehT olleH"(ecapSetihWsI.rahc
tigiDrOretteLsI.rahc ,"}0{ :)'?'(
;))'?'(tigiDrOretteLsI.rahc
,"}0{ :)'!'(noitautcnuPsI.rahc
;))'!'(noitautcnuPsI.rahc
,"}0{ :)'>'(noitautcnuPsI.rahc
;))'>'(noitautcnuPsI.rahc
,"}0{ :)','(noitautcnuPsI.rahc
;))','(noitautcnuPsI.rahc
...
}
m citats eseht fo hcae ,ees nac uoy sA :snoitnevnoc gnillac owt sahrahC.metsyS fo srebme
elgnis a
.tset ot retcarahc
secapsemaN motsuC gninifeD 02.3
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 88
esrevinu TEN. gnitsixe gnigarevel smargorp tset llams gnidliub neeb evah uoy ,tniop siht ot pU
nwo ruoy dliub uoy nehW .)ralucitrap nimetsyS( ot lufpleh yrev eb nac ti ,snoitacilppa = motsuc
emussA eht gnisu dehsilpmocca si siht ,#C nI .secapseman motsuc otni sepyt detaler ruoy puorg
rieht neviG dna ,elcriC,erauqS deman sessalc cirtemoeg fo noitcelloc a gnipoleved era uoy
dluow uoy ,seitiralimis ,tsriF .sehcaorppa cisab owt evah uoY a otni rehtegot lla meht puorg ot ekil
sepahs( elif elgnis a nihtiw ssalc hcae enifed ot esoohc yam uoy - :swollof sa )sc.bil
sc.bilsepahs //
.ssalc elcriC
} /* ...sdohtem gnitseretnI */ {elcriC ssalc
salc nogaxeH // .s
*/ {nogaxeH ssalc
.ssalc erauqS //
*/ {erauqS ssalc
.sepyt eseht fo ”reniatnoc“ lautpecnoc eht sa stca ecapsemansepahSyM eht woh ecitoN
anretlA
:ecapseman emas eht ni snoitinifed ssalc nevig eht parw
sc.elcric //
;metsyS gnisu
sepahSyM ecapseman
{
.ssalc nogaxeH //
.ssalc erauqS
}
tcnitsid a nihtiw stcejbo esu ot sehsiw ecapseman rehtona nehw ,wonk ydaerla uoy sA
:swollof sa desu eb nac drowyekgnisu eht
.ecapseman epahSyM eht denifed sepyt fo esu ekaM //
;metsyS gnisu
;sepahSyM gnisu
ecapseman ppAyM
{
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 98
retseTepahS ssalc
{
)sgra ][gnirts(niaM diov citats
{
;)(nogaxeH wen = h nogaxeH
;)(elcriC wen = c elcriC
;)(erauqS wen = s erauqS
}
}
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 09
TINU – 4 #C htiw POO
ssalC #C eht fo noitifeD 1.4
ni ”stcejbo gniod“ neeb evah uoy fI al gnimmargorp rehtona tbuod on era uoy ,egaugn eht fo erawa
ssalc a ,yllamroF .snoitinifed ssalc fo elor motsuc a naht erom gnihton si resu - )TDU( epyt denifed
dleif fo desopmoc si taht rebmem demret semitemos( atad dellac netfo( snoitcnuf dna )selbairav
em )kaeps OO ni sdoht ehT .atad siht no tca taht ht stneserper ylevitcelloc atad dleif fo tes ”etats“ e
.ecnatsni ssalc a fo tcejbo fo rewop ehT - ipuorg yb taht si segaugnal detneiro dna atad gn
a ni ytilanoitcnuf erawtfos ruoy ledom ot elba era uoy ,TDU elgnis laer retfa sepyt - .seititne dlrow
roF a gniledom ni detseretni era uoy emussa ,elpmaxe lloryap a rof eeyolpme cireneg tA .metsys
ht ssalc a dliub ot hsiw yam uoy ,muminim tnerruc ,eman eht sniatniam ta DI eeyolpme =dna ,yap
,noitidda nI .rekrow hcae rof htem ni na sesaercni hcihw ,)(sunoBeviG deman ,do tnerruc s’laudivid
emos yb yap siht rof atad etats eht tuo stnirp hcihw ,)(statSyalpsiD deman = ,rehtona dna ,tnuoma
.laudividni
.noitinifed ssalc eeyolpmE laitini ehT //
seeyolpmE ecapseman
{
pmE ssalc cilbup eeyol
{
.atad dleiF //
;emaNlluf gnirts etavirp
;DIpme tni etavirp
;yaPrruc taolf etavirp
.srotcurtsnoC //
} {)(eeyolpmE cilbup
)yaPrruc taolf ,DIpme tni ,emaNlluf gnirts(eeyolpmE cilbup
{
;emaNlluf = emaNlluf.siht
;DIpme = DIpme.siht
rruc = yaPrruc.siht ;yaP
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 19
}
.eeyolpme siht rof yap eht pmuB //
taolf(sunoBeviG diov cilbup
} ;tnuoma =+ yaPrruc {
.tcejbo siht fo etats tnerruc wohS //
)(statSyalpsiD diov cilbup
{
:emaN"(eniLetirW.elosnoC
:yaP"(eniLetirW.elosnoC
:DI"(eniLetirW.elosnoC
}
}
}
mE ssalc cilbup eeyolp
{
...
} {)(eeyolpmE cilbup
...
}
tluafed eht ,noitinifed ssalc a ni srotcurtsnoc motsuc enifed ot esoohc uoy fi ,avaJ dna ++C ekiL
ecnatsni na etaerc ot resu tcejbo eht wolla ot hsiw uoy fi ,eroferehT .devomer yltnelis si rotcurtsnoc
ssalc ruoy fo :swollof sa
)sgra ][gnirts(niaM diov citats
{
.rotcurtsnoc tluafed eht sllaC //
;)(eeyolpmE wen = e eeyolpmE
}
od uoy fI .)ereh enod evah ew sa( ssalc ruoy rof rotcurtsnoc tluafed eht enifeder ylticilpxe tsum uoy
w rorre relipmoc a eviecer lliw uoy ,ton ,esac yna nI .rotcurtsnoc ruoy fo ecnatsni na gnitaerc neh
dohtem)(niaM gniwollof eht
suc ruo gnisu stcejboeeyolpmE = wef a setaerc -
eerht mot - :rotcurtsnoc tnemugra
.stcejbo eeyolpmE emos ekaM //
][gnirts(niaM diov citats
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 29
{
,08 ,"eoJ"(eeyolpmE wen = e ;)00003
;2e
;)00005 ,18 ,"hteB"(eeyolpmE wen = 2e
;)(eniLdaeR.elosnoC
}
ssalC a fo ecafretnI cilbuP eht gninifeD 2.4
atad etats lanretni s’ssalc a dehsilbatse evah uoy ecnO txen ruoy ,tes rotcurtsnoc dna hself ot si pets
i cilbup eht fo sliated eht tuo eht ot ecafretn eht ot srefer mret ehT .ssalc era taht rebmem fo tes
tcejbo na morf elbissecca yltcerid .rotarepo tod eht aiv elbairav fo tniop s’redliub ssalc eht morF
retni cilbup eht ,weiv a ni deralced meti yna si ecaf ad dleif dnoyeB .drowyekcilbup eht at dna
cilbup eht ,srotcurtsnoc pop eb yam ssalc a fo ecafretni - eht gnidulcni ,srebmem suoremun yb detalu
:gniwollof
ssalc a fo roivaheb emos ledom taht krow fo stinu demaN :sdohteM •
esiugsid ni snoitcnuf rotatum dna rossecca lanoitidarT :seitreporP •
daeR/stnatsnoC • - tnemngissa retfa degnahc eb tonnac taht atad dleiF :sdleif ylno
dna)(sunoBeviG( sdohtem cilbup owt senifed yltnerruceeyolpmE ruo taht neviG
,))(statSyalpsiD :swollof sa ecafretni cilbup eht htiw tcaretni ot elba era ew
htiw tcaretnI // ssalc eeyolpmE eht fo ecafretni cilbup eht
)sgra ][gnirts(niaM diov citats
{
***** kroW ta epyT eeyolpmE ehT *****"(eniLetirW.elosnoC \ ;)"n
;)00003 ,08 ,"eoJ"(eeyolpmE wen = e
;2e
;)00005 ,18 ,"hteB"(eeyolpmE wen =
;)0001(sunoBeviG.2e
;)(statSyalpsiD.2e
C ;)(eniLdaeR.elosno
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 39
POO fo sralliP eht gnippaceR 3.4
tcejbo llA - eroc eerht htiw dnetnoc segaugnal detneiro tcejbo fo selpicnirp - detneiro ,gnimmargorp
”.POO fo srallip“ demaf eht dellac netfo
i s’tcejbo na edih egaugnal siht seod woH :noitaluspacnE • ?noitatnemelpmi lanretn
?esuer edoc etomorp egaugnal siht seod woH :ecnatirehnI •
?yaw ralimis a ni stcejbo detaler taert uoy tel egaugnal siht seod woH :msihpromyloP •
srednu uoy tnatropmi si ti ,rallip hcae fo sliated citcatnys eht otni gniggid erofeB dnat
hgih ,ksirb a si ereh ,eroferehT .hcae fo elor cisab = eht - ffo raelc ot tsuj ,nwodnur level
.senildaed tcejorp neewteb deriuqca evah yam uoy sbewboc = yna
noitaluspacnE
eht ot nwod sliob tiart sihT .noitaluspacne dellac si POO fo rallip tsrif ehT s’egaugnal
,elpmaxe roF .resu tcejbo eht morf sliated noitatnemelpmi yrassecennu edih ot ytiliba
deman sdohtem owt sah tahtredaeResabataD deman
.noitalupinam esabatad fo sliated eht setaluspacne redaeResabataD //
eResabataD wen = jbObd redaeResabataD ;)(reda
:C"@(nepO.jbObd \ ;)"fdm.seeyolpmE
...esabatad htiw gnihtemos oD //
;)(esolC.jbObd
detaluspacne sah ssalc redaeResabataD suoititcif ehT ,gnitacol fo sliated renni eht ,gnitalupinam
a ,noitaluspacne evol sresu tcejbO .elif atad eht gnisolc dna s siht speek POO fo rallip
gnimmargorp T .relpmis sksat tuoba yrrow ot deen on si ereh s eht dniheb gni eht tuo yrrac ot senec
fo krow lA .ssalcredaeResabataD eht ecnatsni na etaerc si od uoy l elif eht nepo“ ,.g.e( segassem
no detacol fdm.seeyolpmE deman ”evird C ym .) fo noiton eht si noitaluspacne fo tcepsa rehtonA
rp atad s’tcejbo na ,yllaedI .noitceto ilbup naht rehtar etavirp sa denifed eb dluohs atad etats sa( c
suoiverp ni esac eht saw ni ”yletilop ksa“ tsum dlrow edistuo eht ,yaw siht nI .)sretpahc redro
egnahcot .eulav gniylrednu eht niatbo ro ecnatirehnI
l eht ot nwod sliob ,ecnatirehni ,POO fo rallip txen ehT uoy wolla ot ytiliba s’egaugna wen dliub ot
gnitsixe no desab snoitinifed ssalc ,ecnesse nI .snoitinifed ssalc dnetxe ot uoy swolla ecnatirehni
ivaheb eht ( esab a fo ro a gnilbane yb ssalc )tnerap ro osla( ytilanoitcnuf eroc tirehni ot ssalcbus
.)ssalc dlihc ro ssalc devired a dellac
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 49
uoy ,elibomotua na gniledom era uoy fi ,elpmaxe roF taht aedi eht sserpxe ot hsiw thgim rac a
sah“ - olli eb dluow tI .oidar ”a ed ot tpmetta ot lacig ,oidaRa morf ssalcraC eht evir .asrev eciv ro
si“raC A( - gnikrow sessalc tnednepedni owt evah uoy ,rehtaR )!ton kniht I ?oidaR ”a
erehw ,rehtegot
:ytilanoitcnuf
oidaR ssalc cilbup
{
)nOnrut loob(rewoP diov cilbup
niLetirW.elosnoC { };)nOnrut ,"}0{ :no oidaR"(e
}
raC ssalc cilbup
{
sah" raC // - .oidaR "a
;)(oidaR wen = oidaRym oidaR etavirp
)ffOno loob(oidaRnOnruT diov cilbup
{
.tcejbo renni ot etageleD //
;)ffOno(rewoP.oidaRym
}
}
rof elbisnopser si )raC( epyt gniniatnoc eht ,ereH gnitaerc .)oidaR( tcejbo deniatnoc eht eht fI
issecca roivaheb s’oidaR eht ekam ot sehsiwraC nwo sti dnetxe tsum ti ,ecnatsniraCa morf elb
bup su gnikam si ssalcraC eht taht eulc on sah resu tcejbo eht taht ecitoN .epyt deniatnoc na fo e
:tcejbooidaR renni ts )sgra ][gnirts(niaM diov cita
{
.yllanretni oidaR ot drawrof si llaC //
;)(raC wen = repiv raC
;)eurt(oidaRnOnruT.repiv
}
msihpromyloP
rt ot ytiliba s’egaugnal a serutpac tiart sihT .msihpromylop si POO fo rallip lanif ehT tae detaler
aw emas eht stcejbo tcejbo na fo tnenet sihT .y -o esab a swolla egaugnal detneir tes a enifed ot ssalc
eht demret yllamrof( srebmem fo lla ot )ecafretni cihpromylop s’epyt ssalc A .stnednecsed
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 59
mun yna gnisu detcurtsnoc si ecafretni cihpromylop fo reb srebmem tcartsba ro lautriv a nI .
riv a ,llehstun ro( degnahc eb yam rebmem laut devired a yb )neddirrevo ,gnikaeps yllamrof erom
alc dohtem tcartsba na saerehw ,ss ired nehW .epyt devired a yb nedirrevo eb tsum sepyt dev
srebmem eht edirrevo laitnesse era yeht ,ssalc esab a yb denifed ninifeder yl ot dnopser yeht woh g
emas eht .tseuqer
secivreS noitaluspacnE s’#C :ralliP tsriF ehT 4.4
iton eht dnuora sevlover noitaluspacne fo tpecnoc ehT atad dleif s’tcejbo na taht no eb ton dluohs
ehtaR .ecafretni cilbup eht morf elbissecca yltcerid na fo etats eht retla ot sehsiw resu tcejbo na fi ,r
ridni os seod ti ,tcejbo dna )teg( rossecca gnisu yltce em )tes( rotatum si noitaluspacne ,#C nI .sdoht
etorp,etavirp,cilbup yeklanretni detcetorp dna ,detc emussa ,noitaluspacne rof deen eht etartsulli oT
gniwollof eht detaerc evah uoy
:noitinifed ssalc
.dleif cilbup elgnis a htiw ssalc A //
ssalc cilbup
{
;segaPfOrebmun tni cilbup
}
”dnatsrednu“ ot ytiliba on evah smeti eht taht si atad dleif cilbup htiw melborp ehT
rehtehw
hcihw ot eulav tnerruc eht ssenisub tnerruc eht ot drager htiw dilav si dengissa era yeht
egral etiuq sitni #C a fo egnar reppu eht ,wonk uoy sA .metsys
moc eht ,eroferehT .)746,384,741,2(
...mmuH //
][gnirts(niaM diov citats
{
;)(kooB wen = levoNinim kooB
segaPfOrebmun.levoNinim ;00000003 =
}
i na fo seiradnuob eht wolfrevo ton od uoy hguohtlA eb dluohs ti ,epyt atad regetn inim a taht raelc -
000,000,03 fo tnuoc egap a htiw levon ni elbanosaernu tib a si segap nac uoy sA .dlrow laer eht
ton od sdleif cilbup ,ees ne ot yaw a edivorp atad ecrof a sah metsys ruoy fI .selur noitadilav
ht elur ssenisub inim a setats ta - eb tsum levon ecrofne ot ssol a ta era uoy ,segap 002 dna 1 neewteb
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 69
esuaceB .yllacitammargorp siht orp a ni ecalp on evah yllacipyt sdleif cilbup ,siht fo noitcud - level
ssalc noitinifed daer cilbup( - E .)noitpecxe eht gnieb sdleif ylno ot yaw a sedivorp noitaluspacn
fed naht rehtaR .atad etats fo ytirgetni eht evreserp nac hcihw( sdleif cilbup gnini atad retsof ylisae
eht ni teg dluohs uoy ,)noitpurroc d etavirp gninifed fo tibah ata yltceridni era hcihw ,sdleif
ht yb detalupinam niam owt fo eno gnisu rellac e :seuqinhcet
.sdohtem rotatum dna rossecca lanoitidart fo riap a enifeD •
.ytreporp deman a enifeD •
a taht si tniop eht ,esoohc uoy euqinhcet revehcihW llew - lc detaluspacne sti edih dluohs ssa war
yrp eht morf setarepo ti woh fo sliated eht dna atad .dlrow edistuo eht fo seye gni netfo si sihT
aeb ehT .gnimmargorp xob kcalb demret a taht si hcaorppa siht fo ytu egnahc ot eerf si rohtua ssalc
dohtem nevig a woh nu detnemelpmi si ,dooh eht red gnikam edoc gnitsixe yna gnikaerb tuohtiw
( ti fo esu fo erutangis eht taht dedivorp .)tnatsnoc sniamer dohtem eht
srotatuM dna srosseccA lanoitidarT gnisU noitaluspacnE gnicrofnE
eht tnaw uoy fI .ssalceeyolpmE gnitsixe eht ot nruter s’teL htiw tcaretni ot dlrow edistuo ruoy
fed setatcid noitidart ,dleif atademaNlluf etavirp )dohtem teg( rossecca na gnini tes( rotatum dna
.)dohtem
.atad etavirp fo tniop a rof rotatum dna rossecca lanoitidarT //
ssalc cilbup
{
;emaNlluf gnirts etavirp
...
// .rosseccA
} ;emaNlluf nruter { )(emaNlluFteG gnirts cilbup
.rotatuM //
)n gnirts(emaNlluFteS diov cilbup
{
,)% ,$ ,# ,@ ,!( sretcarahc lagelli yna evomeR //
.tnemngissa gnikam erofeb )selur esac ro( htgnel mumixam kcehc //
emaNlluf
}
}
c fo ,dnatsrednU rossecca ruoy llac uoy tahw ssel erac ton dluoc relipmoc eht taht ,esruo
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 79
etavirp a etaluspacne)(emaNlluFteS dna)(emaNlluFteG taht tcaf eht neviG .sdohtem rotatum dna
gol gnillac ehT .llib eht tif ot smees seman dohtem fo eciohc siht ,emaNlluf deman gnirts sa si ci
:swollof
.egasu rotatum/rosseccA //
)sgra ][gnirts(niaM diov citats
{
;)(eeyolpmE wen = p eeyolpmE
;)"enotstnilF derF"(emaNlluFteS.p
;))(emaNlluFteG.p ,"}0{ :deman si eeyolpmE"(eniLetirW.elosnoC
;)(eniLdaeR.elosnoC
}
taluspacnE fo mroF rehtonA seitreporP ssalC :noi
tem rotatum dna rossecca lanoitidart ot tsartnoc nI ot referp segaugnal TEN. ,sdoh ecrofne
stniop elbissecca ylcilbup etalumis hcihw ,seitreporp gnisu noitaluspacne fo naht rehtaR .atad
reffid owt llac ot resu eht gniriuqer sdohtem tne eht tes dna teg ot esu eht ,atad etats llac ot elba si r
sraeppa tahw lanretni eht sparw taht DI deman ytreporp a dedivorp evah uoy emussa
:siht ekil kool dluow xatnys gnillac ehT .epyteeyolpmE eht fo elbairav rebmemDIpme
DI s'nosrep a gnitteg / gnitteS // .xatnys ytreporp hguorht
][gnirts(niaM diov citats
{
;)(eeyolpmE wen = p eeyolpmE
.eulav eht teS //
;18 = DI.p
.eulav eht teG //
;)DI.p ," }0{ :si DI nosreP"(eniLetirW.elosnoC
;)(eniLdaeR.elosnoC
}
m dna rossecca ”laer“ ot pam syawla seitreporp epyT u .dooh eht rednu sdohtem rotat sa ,eroferehT
rofrep ot elba era uoy rengised ssalc a yrassecen cigol lanretni yna m eulav eht gnikam erofeb
cs ,eulav eht esacreppu ,.g.e( tnemngissa rof eulav eht bur lav laciremun a eht si ereH .)no os dna ,eu
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 89
#C dniheb xatnys reporp rehtona ,ytreporpDI eht eht setaluspacne taht )yaP( yt a dna ,dleifyaPrruc
.tniop atademaNlluf eht etaluspacne ot )emaN( ytreporp lanif
.seitreporp htiw noitaluspacnE //
ssalc cilbup
{
...
;DIpme tni etavirp
;yaPrruc taolf etavirp
gnirts etavirp ;emaNlluf
.DIpme rof ytreporP //
tni cilbup
{
};DIpme nruter { teg
tes
{
)mrofsnart ylbissop dna( etagitsevni ot eerf llits era uoY //
.tnemngissa na gnikam erofeb eulav gnimocni eht //
;eulav = DIpme
}
}
.emaNlluf rof ytreporP //
emaN gnirts cilbup
{
};emaNlluf nruter{ teg
};eulav = emaNlluf{ tes
}
.yaPrruc rof ytreporP //
yaP taolf cilbup
{
};yaPrruc nruter{ teg
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 99
};eulav = yaPrruc{ tes
}
}
rossecca( kcolb teg a gnisu desopmoc si ytreporp #C A ehT .)rotatum( kcolb tes dna ) ”eulav“ #C
erper nekot thgir eht stnes - fo edis dnah gniylrednu ehT .tnemngissa eht tros hcihw no sdneped fo
siht nI .stneserper ti atad hcihw ,epyt atadtnia no gnitarepo si ytreporpDI eht ,elpmaxe uoy sa ,
ot spam ,llacer :23tnI.metsySa
yS a si "eulav" os ,23tnI.metsyS a si 18 // .23tnI.mets
;)(eeyolpmE wen = e eeyolpmE
;18 = DI.e
:swollof sa cigol tes s’ytreporpDI eht detadpu evah uoy emussa ,tniop eht evorp oT
.DIpme eht rof ytreporP //
tni cilbup
{
};DIpme nruter { teg
tes
{
" }0{ :fo ecnatsni na si eulav"(eniLetirW.elosnoC ;))(epyTteG.eulav ,
;)eulav ," }0{ :eulav s'eulav"(eniLetirW.elosnoC
;eulav = DIpme
}
}
daeR - etirW dna ylnO - seitreporP ylnO
a erugifnoc ot hsiw yam uoy ,sepyt ssalc gnitaerc nehW daer - ,os od oT .ytreporp ylno dliub ylpmis
dnopserroc a tuohtiw ytreporp a .kcolb tes gni evah ot hsiw uoy fi ,esiwekiL evah eW .kcolb teg eht
n on ;elpmaxe siht rof os od ot dee rebmuNytiruceSlaicoS eht woh si ereh ,revewoh
:ylno
ssalc cilbup
{
...
daer a sa woN // - .ytreporp ylno
ruter { teg { rebmuNytiruceSlaicoS gnirts cilbup } } ;NSSpme n
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 001
}
na hcihw ni rennam ylno eht ,tnemtsujda siht neviG ytiruceS laicoS SU s’eeyolpme eb nac rebmun
.tnemugra rotcurtsnoc a hguorht si tes
4 troppuS ecnatirehnI s’#C :ralliP dnoceS ehT 5.
lla taht seuqinhcet suoirav nees evah uoy taht woN uoy wo llew elgnis a etaerc ot - detaluspacne
t noitnetta ruoy nrut ot emit si ti ,ssalc detaler fo ylimaf a gnidliub o irehni ,denoitnem sA .sessalc -
.esuer edoc setatilicaf taht POO fo tcepsa eht si ecnat
( ecnatirehni lacissalc :srovalf owt ni semoc ecnatirehnI ht si“ e - eht dna )pihsnoitaler ”a
sah“ eht( ledom noitageled/tnemniatnoc - )pihsnoitaler ”a lacissalc eht gninimaxe yb nigeb s’teL .
si“ - .ledom ”a si“ hsilbatse uoy nehW - ewteb spihsnoitaler ”a a gnidliub era uoy ,sessalc ne
ycnedneped i cisab ehT .sepyt neewteb rehni lacissalc dniheb aed yam sessalc wen taht si ecnati
rehto fo ytilanoitcnuf eht )dnetxe ylibissop dna( egarevel emussa ,etartsulli oT .sessalc eht
wen owt etaerc ot ssalceeyolpmE eht fo ytilanoitcnuf
lcreganaM eht taht emussa lliw ew ,elpmaxe ruo roF xe ssa eht gnidrocer ybeeyolpmE sdnet rebmun
iam ssalcnosrePselaS eht elihw ,snoitpo kcots fo nI .selas fo rebmun eht sniatn ssalc a gnidnetxe ,#C
c eht gnisu dehsilpmocca si ssalc eht no ):( rotarepo nolo eht era ereh ,dias gnieb sihT .noitinifed
owt ddA // .ecapseman seeyolpmE eht ot sessalcbus wen
seeyolpmE ecapseman
{
eeyolpmE : reganaM ssalc cilbup
{
.snoitpo kcots fo rebmun rieht wonk ot deen sreganaM //
;snoitpOfOrebmun gnolu etavirp
stpObmuN gnolu cilbup
{
};snoitpOfOrebmun nruter { teg
mun { tes } snoitpOfOreb
}
}
eeyolpmE : nosrePselaS ssalc cilbup
{
.selas fo rebmun rieht wonk ot deen elpoepselaS //
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 101
;selaSfOrebmun tni etavirp
selaSbmuN tni cilbup
{
};selaSfOrebmun nruter { teg
} ;eulav = selaSfOrebmun { tes
}
}
}
ehsilbatse evah uoy taht woN si“ na d - evahreganaM dnanosrePselaS ,pihsnoitaler ”a
.ssalc esabeeyolpmE eht fo srebmem )detcetorp dna( cilbup lla detirehni yllacitamotua
:etartsulli oT
.ytilanoitcnuf ssalc esab ssecca dna ssalcbus a etaerC //
][gnirts(niaM diov citats
{
las a ekaM // .nosrepse
;)(nosrePselaS wen = nats nosrePselaS
.ssalc esab eeyolpmE eht morf detirehni era srebmem esehT //
;001 = DI.nats
;"natS" = emaN.nats
.ssalc nosrePselaS eht yb denifed si sihT //
;24 = selaSbmuN.nats
;)(eniLdaeR.elosnoC
}
rehni taht erawa eb oD yltcerid tonnac ssalc devired a ,eroferehT .noitaluspacne sevreserp ecnati
.ssalc esab sti yb denifed srebmem etavirp eht ssecca
esab htiw noitaerC ssalC esaB gnillortnoC
.rotcurtsnoc tluafed a gnisu detaerc eb ylno nacreganaM dnanosrePselaS ,yltnerruC
xis wen a dedda evah uoy emussa ,dnim ni siht htiW - eht ot rotcurtsnoc tnemugra
dekovni si hcihw ,epytreganaM
)sgra ][gnirts(niaM diov citats
{
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 201
.rotcurtsnoc gniwollof eht evah won ew emussA //
.)snoitpo kcots fo rebmun ,NSS ,yap ,DI ,ega ,eman( //
anaM 333" ,000001 ,29 ,53 ,"ykcuhC"(reganaM wen = ykcuhc reg - 32 - ;)0009 ,"2232
}
sretemarap eseht fo tsom taht ees ylraelc nac uoy ,tsil tnemugra eht ta kool uoy fI
eb dluohs
dluoc uoy ,os od oT .ssalc esabeeyolpmE eht yb denifed selbairav rebmem eht ni derots
tnemelpmi =
eht sllac yllacitamotua rotcurtsnoc ssalcbus a ,esiwrehto yas ton od uoy fI //
.ssalc esab sti fo rotcurtsnoc tluafed //
,DIpme tni ,ega tni ,emaNlluf gnirts(reganaM cilbup
)stpOfObmun gnolu ,nss gnirts ,yaPrruc taolf
{
ad fo tniop sihT // !su htiw sgnoleb at
;stpOfObmun = snoitpOfOrebmun
eeyolpmE morf detirehni srebmem suoirav eht egareveL //
.atad etats eht ngissa ot //
;DIpme = DI
egA
;emaNlluf = emaN
;nss = rebmuNytiruceSlaicoS
;yaPrruc = yaP
}
etorp ehT :sterceS ylimaF gnipeeK 6.4 drowyeK detc
smeti etavirp elihw ,erehwyna morf elbissecca yltcerid era smeti cilbup ,wonk ydaerla uoy sA
ynam fo dael eht sekat #C .ti denifed sah taht ssalc eht dnoyeb tcejbo yna morf dessecca eb tonnac
dda na sedivorp dna segaugnal tcejbo nredom rehto a nehW .detcetorp :ytilibissecca fo level lanoiti
yna yb yltcerid dessecca eb nac taht smeti detcetorp ro atad detcetorp senifed ssalc esab
eht ssecca yltcerid ot sessalc dlihcreganaMdna nosrePselaS eht wolla ot hsiw uoy fI .tnednecsed
denifed rotces atad :swollof sa noitinifed ssalceeyolpmE lanigiro eht etadpu nac uoy ,eeyolpmE yb
.atad etats detcetorP //
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 301
ssalc cilbup
{
.tonnac sresu tcejbO .noitamrofni siht ssecca yltcerid nac sessalc dlihC //
;emaNlluf gnirts detcetorp
;DIpme tni detcetorp
f detcetorp ;yaPrruc taol
;NSSpme gnirts detcetorp
tni detcetorp
...
}
ot evah regnol on sepyt devired taht si ssalc esab a ni srebmem detcetorp gninifed fo tifeneb ehT
nehw taht si ,esruoc fo ,llafnwod elbissop ehT .seitreporp ro sdohtem cilbup gnisu atad eht ssecca a
ssapyb yllatnedicca ot elbissop yrev si ti ,atad lanretni s’tnerap sti ot ssecca tcerid sah epyt devired
inim eht sa hcus( seitreporp cilbup nihtiw dnuof selur ssenisub gnitsixe - egap eht sdeecxe taht levon
uoy ,srebmem detcetorp enifed uoy nehW .)tnuoc tnerap eht neewteb tsurt fo level a gnitaerc era
,yllaniF.selur ssenisub s’epyt ruoy fo noitaloiv yna hctac ton lliw relipmoc eht sa ,ssalc dlihc dna
eht sa( etavirp sa dedrager si atad detcetorp ,denrecnoc si resu tcejbo eht sa raf sa taht dnatsrednu
resu :lagelli si gniwollof eht ,eroferehT .)ylimaf eht fo ”edistuo“ si
)sgra ][gnirts(niaM diov citats
{
!rorrE //
;)(eeyolpmE wen = pme eeyolpmE
111" = NSSpme.pme - 11 - ;"1111
}
troppuS cihpromyloP s’#C :ralliP drihT ehT 7.4
lip lanif eht enimaxe won s’teL esabeeyolpmE eht taht llaceR .msihpromylop :POO fo ral
ssalc
:swollof sa detnemelpmi saw hcihw ,)(sunoBeviG deman dohtem a denifed
.seeyolpme ot sunob eviG //
ssalc cilbup
{
...
)tnuoma taolf(sunoBeviG diov cilbup
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 401
} ;tnuoma =+ yaPrruc {
}
siht esuaceB dna elpoepselas ot sesunob evig won nac uoy ,cilbup sa denifed neeb sah dohtem
trap sa llew sa( sreganam - ][gnirts(niaM diov citats :)elpoepselas emit
{
.sunob a eeyolpme hcae eviG //
333" ,000001 ,29 ,05 ,"ykcuhC"(reganaM wen = ykcuhc reganaM - 32 - 09 ,"2232 ;)00
;)003(sunoBeviG.ykcuhc
;)(statSyalpsiD.ykcuhc
239" ,0003 ,39 ,34 ,"narF"(nosrePselaS wen = narf nosrePselaS - 23 - ;)13 ,"2323
;)002(sunoBeviG.narf
;)(statSyalpsiD.narf
;)(eniLdaeR.elosnoC
}
eviG detirehni eht taht si ngised tnerruc eht htiw melborp ehT lla rof yllac dohtem)(sunoB
trap ro nosrepselas a fo sunob eht ,yllaedI .sessalcbus - eht tnuocca otni ekat dluohs nosrepselas emit
a htiw noitcnujnoc ni snoitpo kcots lanoitidda niag dluohs sreganam spahreP .selas fo rebmun
ht neviG .yralas ni pmub yratenom woH“ :noitseuq gnitseretni na htiw decaf ylneddus era uoy ,si
”?tseuqer emas eht ot yltnereffid dnopser stcejbo detaler nac
neewteB gnitsaC 8.4 .
dna yhcrareihseeyolpmE eht llaceR .snoitarepo gnitsac #C fo swal eht nrael ot deen uoy ,pu txeN
aht tcaf eht si“ gnihtyreve ,eroferehT .tcejbO.metsyS si metsys eht ni ssalc tsompot eht t - tcejbo ”a
:elbairav tcejbo a nihtiw epyt yna fo ecnatsni na erots ot lagel dna
si" reganaM A // - .tcejbO.metsyS "a
111" ,00004 ,9 ,"appaZ knarF"(reganaM wen = knarf tcejbo - 11 - 111 ;)5 ,"1
dnetxe lla sepytnosrePselaSTP dna ,nosrePselaS,sreganaM ,metsysseeyolpmE eht nI
,eroferehT .ecnerefer ssalc esab dilav a ni stcejbo eseht fo yna erots nac ew os
:lagel osla era stnemetats gniwollof eht
si" reganaM A // - .oot eeyolpmE "a
eeyolpmE 101" ,00002 ,2 ,"appaZ tinUnooM"(reganaM wen = tinUnoom - 11 - ;)1 ,"1231
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 501
si" nosrePselaSTP A // - .nosrePselaS "a
111" ,000001 ,438 ,"lliJ"(nosrePselaSTP wen = llij nosrePselaS - 21 - ;)09 ,"9111
ssalc owt nehw taht si sepyt ssalc neewteb gnitsac fo wal tsrif ehT na yb detaler era se
si“ - ,yllamroF .ecnerefer ssalc esab a nihtiw epyt devired a erots ot efas syawla si ti ,pihsnoitaler ”a
gnimmargorp .ecnatirehni fo swal eht nevig ”skrow tsuj ti“ sa ,tsac ticilpmi na dellac si siht
vah uoy fi ,elpmaxe roF .stcurtsnoc lof eht stroppus tahtenihcaMehT deman ssalc a e
enihcaMehT ssalc cilbup
{
)e eeyolpmE(nosrePsihTeriF diov citats cilbup
{
...esabatad morf evomeR //
...eeyolpme derif morf reneprahs licnep dna yek teG //
}
}
t morf tnednecsed yna ssap ylevitceffe nac uoy nevig ,yltcerid dohtem siht otni ssalceeyolpmE eh
eht
.ffats eht enilmaertS //
na sa deralced saw "tinUnoom" // ;)tinUnoom(nosrePsihTeriF.enihcaMehT
.eeyolpmE
.nosrePselaS a sa deralced saw "llij" // ;)llij(nosrePsihTeriF.enihcaMehT
c edoc gniwollof ehT )eeyolpmE( epyt ssalc esab eht morf tsac ticilpmi eht nevig selipmo
eht ot
otni yltcerid tcejboknarf eht ssap uoy fI ?)ecnerefertcejbO.metsyS cireneg a ni derots
sa)(nosrePsihTeriF.enihcaMehT
si" reganaM A // - ...tub ,tcejbo "a
ganaM wen = knarf tcejbo 111" ,00004 ,9 ,"appaZ knarF"(re - 11 - ;)5 ,"1111
...
!rorrE // ;)knarf(nosrePsihTeriF.enihcaMehT
a satcejbO.metsyS a taert yllacitamotua tonnac uoy si nosaer ehT .rorre relipmoc a deussi era uoy
si“tcejbO taht nevig ,yltcerideeyolpmE devired - ton - .eeyolpmE ”a eht ,revewoh ,ees nac uoy sA
eeyolpmE na ot gnitniop si ecnerefer tcejbo - yb relipmoc eht yfsitas nac uoY .tcejbo elbitapmoc
gnimrofrep
,ot tsac ot hsiw uoy epyt eht dnuora sesehtnerap gnicalp yb detoned era stsac ticilpxe ,#C nI
oy tcejbo eht yb dewollof :elpmaxe roF .morf tsac ot gnitpmetta era u
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 601
ylgnorts a otni tcejbO.metsyS cireneg eht morf tsaC //
.reganaM depyt //
;knarf)reganaM( = rgm reganaM
;)stpObmuN.rgm ,"}0{ :snoitpo s'knarF"(eniLetirW.elosnoC
airav cificeps a eralced ton rehtar dluow uoy fI eht esnednoc ot elba era uoy ”,ot tsac ot epyt“ fo elb
:swollof sa edoc suoiverp
.tsac ticilpxe "enilni" nA //
eht gnissap sa raf sA;)stpObmuN.)knarf)reganaM(( ,"}0{ :snoitpo s'knarF"(eniLetirW.elosnoC
htem)(nosrePsihTeriF eht otni ecnerefertcejbO.metsyS melborp eht ,do
.eeyolpmE na otni tcejbO.metsyS tsac ylticilpxE //
;)knarf)eeyolpmE((nosrePsihTeriF.enihcaMehT
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 701
TINU - 5
emitefiL tcejbO dna snoitpecxE snoitpecxE dna ,sguB ,srorrE ot edO 1.5
ylamona desu ylnommoc eerhT - t cirtnec :smre
o trap eht no rorre na ,tup ylpmis ,si sihT :sguB • ,elpmaxe roF .remmargorp eht f gnimmargorp era
fI .++C deganamnu htiw retniopLLUNa no sllac ekam uoy yromem detacolla eteled ot liaf ro
.gub a evah uoy ,)kael yromem a ni gnitluser(
:srorre resU • ac yllacipyt era srorre resu ,sgub ekilnU gninnur laudividni eht yb desu ruoy
ti detaerc ohw esoht yb naht rehtar ,noitacilppa ohw resu dne na ,elpmaxe roF . demroflam a sretne
eg llew yrev dluoc xob txet a otni gnirts ot liaf uoy fi rorre na etaren ht eldnah ruoy ni tupni ytluaf si
.esab edoc
emitnur sa dedrager yllacipyt era snoitpecxE :snoitpecxE • ,tluciffid era taht seilamona ton fi
mmargorp elihw rof tnuocca ot ,elbissopmi elbissoP .noitacilppa ruoy gni edulcni snoitpecxe
abatad a ot tcennoc ot gnitpmetta es gninepo ,stsixe regnol on taht a gnitcatnoc ro ,elif detpurroc a
erruc si taht enihcam eseht fo hcae nI .enilffo yltn elttil sah )resu dne dna( remmargorp eht ,sesac
oc ”lanoitpecxe“ eseht revo lortn luohs ti ,snoitinifed suoiverp eht neviG .secnatsmucric d raelc eb
derutcurts TEN. taht .snoitpecxe emitnur htiw laed ot detius llew euqinhcet a si gnildnah noitpecxe
e evah taht srorre resu dna sgub eht rof sa ,revewoH lliw RLC eht ,weiv ruoy depacs etareneg netfo
itnedi taht noitpecxe gnidnopserroc a - if ht se ehT .dnah ta melborp e seirarbil ssalc esab TEN.
ifed sa hcus snoitpecxe suoremun en noitpecxEdnuoFtoNeliF ,noitpecxEegnaRfOtuOxednI ,
,noitpecxEegnaRfOtuOtnemugrA .htrof os dna
gnildnaH noitpecxE TEN. fo eloR ehT 2.5
t rednu gnildnah rorre ,TEN. ot roirP o swodniW eh desufnoc a saw metsys gnitarep fo hsamhsim
dellor sremmargorp ynaM .seuqinhcet cigol gnildnah rorre nwo rieht nevig a fo txetnoc eht nihtiw
e roF .noitacilppa yam maet tnempoleved a ,elpmax a enifed stnatsnoc laciremun fo tes
taht nk tneserper nwo ekam dna ,snoitidnoc rorre na fo yaw yB .seulav nruter dohtem sa meht fo esu
gniwollof eht rednop ,elpmaxe :edoc C laitrap
C yrev A */ - /* .msinahcem gnippart rorre elyts
0001 DNUOFTONELIF_E enifed#
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 801
)(noitcnuFemoS tni
{
t ni sneppah gnihtemos emussA // )x(f sih
.eulav nruter gniwollof eht sesuac taht //
;DNUOFTONELIF_E nruter
}
)(niam diov
{
;)(noitcnuFemoS = laVter tni
)DNUOFTONELIF_E == laVter(fi
;)"...elif dnif tonnaC"(ftnirp
}
taht tcaf eht nevig ,laedi naht ssel si hcaorppa sihT F_E tnatsnoc eht erom elttil siDNUOFTONELI
l dluow uoy ,yllaedI .melborp eht htiw laed ot woh ,egassem ,eman eht parw ot eki lufpleh rehto dna
rorre siht gnidrager noitamrofni llew ,elgnis a otni noitidnoc - yltcaxe si hcihw( egakcap denifed
ppah tahw ecxe derutcurts rednu sne noitp nhcet coh da s’repoleved a ot noitidda nI .)gnildnah ,seuqi
senifed IPA swodniW eht ifed# fo yaw yb emoc taht sedoc rorre fo sderdnuh dna ,sTLUSERH,sen
ynam oot raf ,oslA .)no os dna ,LOOB_TNAIRAV,LOOB ,loob( naelooB elpmis eht no snoitairav
ynam
++C OC 6BV ynam ,yltceridni dna( srepoleved MOC fo esu edam evah )srepoleved M tes llams a
fretni MOC dradnats fo ,ofnIrorrEtroppuSI ,.g.e( seca nruter ot )ofnIrorrEetaerCI,ofnIrorrEI
MOC a ot noitamrofni rorre lufgninaem .tneilc erom si hcaorppa hcaE .yrtemmys deroliat ssel ro ot
nevig a ,ygolonhcet nevig a p ot redro nI .tcejorp nevig a neve spahrep dna ,egaugnal ot dne na tu
eht ,ssendam siht srorre emitnur part dna dnes ot euqinhcet dradnats a sedivorp mroftalp TEN. :
curts .)HES( gnildnah noitpecxe derut tA ehT o gnildnaH noitpecxE TEN. fo sm htiw gnimmargorP
evlovni gnildnah noitpecxe derutcurts detalerretni ruof fo esu eht s :seititne
derrucco taht noitpecxe eht fo sliated eht stneserper taht epyt ssalc A •
alc noitpecxe eht fo ecnatsni na sworht taht rebmem A • rellac eht ot ss
noitpecxe eht sekovni taht edis s’rellac eht no edoc fo kcolb A • - rebmem enorp
ro( ssecorp lliw taht edis s’rellac eht no edoc fo kcolb A • ti dluohs noitpecxe eht )hctac rucco
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 901
ek ruof sreffo egaugnal gnimmargorp #C ehT ctac ,yrt( sdrowy taht )yllanif dna ,worht ,h ta melborp
pecxE.metsyS morf devired ssalc a si dnah .)foereht tnednecsed a ro(noit kcehc s’tel ,tcaf siht neviG
fo elor eht tuo
ssalC esaB noitpecxE.metsyS ehT 3.5
resu llA - metsys dna - itpecxe denifed rf evired yletamitlu sno eht mo ssalc esab noitpecxE.metsyS
sevired nrut ni hcihw( taht etoN .)tcejbO.metsyS morf yam dna lautriv era srebmem eseht fo emos
noitpecxE_ ,elbazilaireSI : noitpecxE ssalc cilbup
{
} ;teg { ataD yranoitciDI lautriv cilbup
zilaireS(noitpecxE detcetorp ;)txetnoc txetnoCgnimaertS ,ofni ofnInoita
;)noitpecxErenni noitpecxE ,egassem gnirts(noitpecxE cilbup
;)egassem gnirts(noitpecxE cilbup
;)(noitpecxE cilbup
;)(noitpecxEesaBteG noitpecxE lautriv cilbup
i ofnInoitazilaireS(ataDtcejbOteG diov lautriv cilbup ,ofn
;)txetnoc txetnoCgnimaertS
epyT.metsyS cilbup
tni detcetorp
} ;tes ;teg { kniLpleH gnirts lautriv cilbup
} ;teg { noitpecxErennI noitpecxE.metsyS cilbup
} ;teg { egasseM gnirts lautriv cilbup
} ;tes ;teg { ecruoS gnirts lautriv cilbup
autriv cilbup } ;teg { ecarTkcatS gnirts l
} ;teg { etiStegraT esaBdohteM cilbup
;)(gnirtSoT gnirts edirrevo cilbup
}
elpmaxE elbissoP tselpmiS ehT
epyt a etaerc ot deen ew ,gnildnah noitpecxe derutcurts fo ssenlufesu eht etartsulli oT
dnu noitpecxe na worht yam taht evah ew emussA .secnatsmucric tcerroc eht re
owt senifed taht )noitpecxEelpmiS deman( tcejorp
sah“ eht gnisu detaicossa )oidaR dnaraC( sepyt ssalc - epytoidaR ehT .pihsnoitaler ”a
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 011
:ffo ro no rewop s’oidar eht snrut taht dohtem elgnis a senifed
salc cilbup oidaR s
{
)no loob(nOnruT diov cilbup
{
)no(fi
;)"...gnimmaJ"(eniLetirW.elosnoC
esle
;)"...emit teiuQ"(eniLetirW.elosnoC
}
}
noitpecxE cireneG a gniworhT 4.5
tartsulli ll’I ,epytraC lanoitcnuf a evah ew taht woN na worht ot yaw tselpmis eht e .noitpecxe ehT
etareleccA fo noitatnemelpmi tnerruc fi egassem rorre na syalpsid)( pu deeps ot stpmetta rellac eht
.timil reppu sti dnoyebraC eht t pu deeps ot stpmetta resu eht fi noitpecxe na worht ot elibomotua eh
tem sah ti retfa dna etaerc ot tnaw uoy ,rekam sti ni wen a erugifnoc noitpecxE.metsyS eht fo ecnats
daer eht fo eulav eht gnittes ,ssalc - .rotcurtsnoc ssalc eht aiv ytreporpegasseM ylno hsiw uoy nehW
#C eht fo esu ekam ,rellac eht ot kcab tcejbo rorre eht dnes ot
dpu edoc tnaveler eht si ereH .drowyekworht :dohtem)(etareleccA eht ot eta
.deepSxam dnoyeb pu sdeeps resu eht fi noitpecxe na worht ,emit sihT //
tni(etareleccA diov cilbup
{
)daeDsIrac( fi
;)emaNtep ,"...redro fo tuo si }0{"(eniLetirW.elosnoC
esle
{
;atled =+ deepSrruc
fi
{
;eurt = daeDsIrac
c ;0 = deepSrru
"worht" esU //
;))emaNtep ,"!detaehrevo sah }0{"(tamroF.gnirts(noitpecxE wen worht
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 111
}
esle
;)deepSrruc ,"}0{ = deepSrruC >="(eniLetirW.elosnoC
}
}
fo tsriF .tseretni fo stniop wef a ,noitpecxe siht hctac dluow rellac a woh gninimaxe erofeB ,lla
eht setutitsnoc tahw yltcaxe ediced ot uoy ot pu syawla si ti ,noitpecxe na gniworht era uoy nehw
eht esaercni ot stpmetta gnikam era uoy ,ereH .nworht eb dluohs ti nehw dna ,noitseuq ni rorre
ohs epytnoitpecxE.metsySa ,deripxe sah taht rac a fo deeps eht etacidni ot nworht eb dlu
,ylevitanretlA .)noitpmussa dilav a eb ton yam ro yam hcihw( eunitnoc tonnac dohtem)(etareleccA
noitpecxe na worht ot gnideen tuohtiw yllacitamotua revocer ot)(etareleccA tnemelpmi dluoc uoy
e ,egral dna yB .ecalp tsrif eht ni noitidnoc lanimret erom a nehw ylno nworht eb dluohs snoitpecx
dna ,esabatad a ot tcennoc ot gniliaf ,elif yrassecen a gnidnif ton ,elpmaxe rof( tem neeb sah
tsum uoy eussi ngised a si noitpecxe na gniworht setutitsnoc tahw yltcaxe gnidiceD .)tontahw
yawla ot elibomotua demood a gniksa taht emussa ,sesoprup tnerruc ruo roF .htiw dnetnoc s
.noitpecxe na worht ot esuac a seifitsuj deeps sti esaercni
snoitpecxE gnihctaC 5.5
cxe na sworht won dohtem)(etareleccA eht esuaceB ydaer eb ot sdeen rellac eht ,noitpe eldnah ot
eht fo sliated eht tcartxe siht htiw od uoy tahW .melborp a ot noitamrofni siht gol ot hsiw yam
etirw ,elif troper tneve swodniW eht ot atad eht e ,gol - eht yalpsid ro ,rotartsinimda metsys a liam
orp uoy ,ereH .resu dne eht ot melb mud ylpmis lliw :wodniw elosnoc eht ot stnetnoc eht p
.noitpecxe nworht eht eldnaH //
][gnirts(niaM diov citats
{
;)"***** ti no gnippets dna rac a gnitaerC *****"(eniLetirW.elosnoC
;)02 ,"yppiZ"(raC wen = raCym raC
;)eurt(senuTknarC.raCym
am s'rac eht tsap pu deepS // ot deeps x
.noitpecxe eht reggirt //
yrt
{
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 211
)++i ;01 < i ;0 = i tni(rof
;)01(etareleccA .raCym
}
)e noitpecxE(hctac
{
"(eniLetirW.elosnoC \ ;)"*** !rorrE ***n
;)etiStegraT.e ,"}0{ :dohteM"(eniLetirW.elosnoC
;)egasseM.e ,"}0{ :egasseM"(eniLetirW.elosnoC
C ;)ecruoS.e ,"}0{ :ecruoS"(eniLetirW.elosno
}
,deldnah neeb sah rorre ehT //
"(eniLetirW.elosnoC \ *****n
;)(eniLdaeR.elosnoC
}
metsyS RLC 6.5 - )noitpecxEmetsyS.metsyS( snoitpecxE leveL
itpecxEegnaRfOtuOxednI,noitpecxEegnaRfOtuOtnemugrA cxEwolfrevOkcatS,no dna ,noitpe os
aht snoitpecxe enifed secapseman rehtO .htrof taht fo roivaheb eht tcelfer t ,.g.e( ecapseman
senifedgnitnirP.gniwarD.metsyS OI.metsyS ,snoitpecxe gnitnirp OI senifed - ,snoitpecxe desab
batad senifedataD.metsyS esa - os dna ,snoitpecxe cirtnec xE era RLC eht yb nworht era taht snoitpec
metsys dellac )yletairporppa( cernon sa dedrager era snoitpecxe esehT .snoitpecxe lataf ,elbarevo
metsyS .srorre yS deman ssalc esab a ni hcihw ,noitpecxEmetsyS.mets morf sevired nrut
orf sevired hcihw(noitpecxE.metsyS :)tcejbO.metsyS m
noitpecxE : noitpecxEmetsyS ssalc cilbup
{
//
}
ytilanoitcnuf lanoitidda yna dda ton seod epytnoitpecxEmetsyS.metsyS eht taht neviG
tsrif eht ni stsixenoitpecxEmetsyS yhw rednow thgim uoy ,srotcurtsnoc fo tes a dnoyeb
ylpmiS .ecalp era uoy ,noitpecxEmetsyS.metsyS morf sevired epyt noitpecxe na nehw ,tup
.noitacilppa gnitucexe eht fo esab edoc eht naht rehtar si emitnur TEN. eht taht enimreted ot elba
noitacilppA motsuC 7.5 - )noitpecxEnoitacilppA.metsyS( snoitpecxE leveL
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 311
taht neviG .snoitpecxe nwo ruoy etaerc ot eerf era uoy ,sepyt ssalc era snoitpecxe TEN. lla
woH eht taht tcaf eht ot eud ,reve pecxe stneserper ssalc esabnoitpecxEmetsyS.metsyS nworht snoit
uoy ,RLC eht morf ired dluohs uoy taht emussa yllarutan yam ecxe motsuc ruoy ev morf snoitp
carp tseb ,os od dluoc uoy elihW .epytnoitpecxE.metsyS daetsni uoy taht setatcid ecit morf evired
:epytnoitpecxEnoitacilppA.metsyS eht
noitpecxE : noitpecxEnoitacilppA
.srotcurtsnoc suoiraV
}
enO ekaT ,snoitpecxE motsuC gnidliuB
nac uoy elihW re emitnur a langis otnoitpecxE.metsyS fo secnatsni worht syawla ni nwohs sa( ror
ruo ruoy fo sliated euqinu eht stneserper taht noitpecxe ,elpmaxe roF .melborp tnerruc uoy emussa
noitpecxe motsuc a dliub ot hsiw ot )noitpecxEdaeDsIraC deman( ht tneserper gnideeps fo rorre e
i pets tsrif ehT .elibomotua demood a pu a evired ot s morf ssalc wen
sessalc noitpecxe lla ,noitnevnoc yb(noitpecxEnoitacilppA.metsyS
.)xiffus ”noitpecxE“ eht htiw
rac eht fo sliated eht sebircsed noitpecxe motsuc sihT // - si - idnoc daed .noit
noitpecxEnoitacilppA : noitpecxEdaeDsIraC ssalc cilbup
}{
rebmun yna edulcni ot eerf era uoy ,ssalc yna ekiL eb nac taht srebmem motsuc fo kcolbhctac eht
sla era uoY .cigol gnillac eht fo lautriv yna edirrevo ot eerf o tnerap ruoy yb denifed srebmem
tnemelpmi dluoc ew ,elpmaxe roF .sessalc
:ytreporpegasseMlautriv eht gnidirrevo yb noitpecxEdaeDsIraC
noitpecxEnoitacilppA : noitpecxEdaeDsIraC ssalc cilbup
{
;sliateDegassem gnirts etavirp
} {)(noitpecxEdaeDsIraC cilbup
nirts(noitpecxEdaeDsIraC cilbup )egassem g
{
;egassem = sliateDegassem
}
.ytreporp egasseM.noitpecxE eht edirrevO //
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 411
egasseM gnirts edirrevo cilbup
{
teg
{
;)sliateDegassem ,"}0{ :egasseM rorrE raC"(tamroF.gnirts nruter
}
}
}
m atad etavirp a sniatniam epyt noitpecxEdaeDsIraC eht ,ereH rebme
taht )sliateDegassem( siht gniworhT .rotcurtsnoc motsuc a gnisu tes si)(etareleccA eht morf rorre
dna ,erugifnoc ,etacolla ylpmiS .drawrofthgiarts epytnoitpecxEdaeDsIraCa worht a naht rehtar
:noitpecxE.metsyS cireneg
xEdaeDsIraC motsuc eht worhT // .noitpec
tni(etareleccA diov cilbup
{
...
sah }0{"(tamroF.gnirts(noitpecxEdaeDsIraC wen = xe noitpecxEdaeDsIraC
;))emaNtep ,"!detaehrevo
;"moc.sURsraC.www//:ptth" = kniLpleH.xe
,"pmatSemiT"(ddA.ataD.xe
;))woN.emiTetaD
,"esuaC"(ddA.ataD.xe
;xe worht
.. .
}
ac ruoy ,ylticilpxe noitpecxe gnimocni siht hctac oT hctac ot detadpu eb won nac epocshct a
nevig ,revewoh( epytnoitpecxEdaeDsIraC cificeps si“noitpecxEdaeDsIraC taht - ”a
lew sanoitpecxE.metsyS cireneg a hctac ot elbissimrep llits si ti ,noitpecxE.metsyS :)l
)sgra ][gnirts(niaM diov citats
{
...
)e noitpecxEdaeDsIraC(hctac
{
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 511
.noitpecxe gnimocni ssecorP //
}
...
}
idliub fo ssecorp cisab eht dnatsrednu uoy taht won ,oS yam uoy ,noitpecxe motsuc a gn rednow
,yllacipyT .os od ot deriuqer era uoy nehw lno uoy ot dnuob ylthgit si motsuc etaerc ot deen y
eht ssi ssalc a ,elpmaxe rof( rorre eht gniu elif fo rebmun a sworht taht ssalceliF motsuc - detaler
e a sworht taht ssalcraCa ,srorr rac fo rebmun - y ,os gniod nI .)htrof os dna ,srorre detaler edivorp uo
iw rellac eht eht ht rorre na no snoitpecxe suoremun eldnah ot ytiliba - yb - .sisab rorre
gnildnaH 8 . 5 snoitpecxE elpitluM
tfo uoy ,ytilaer nI .kcolb hctac elgnis a sah kcolb yrt a ,mrof tselpmis sti nI nur ne noitautis a otni
rta nihtiw stnemetats eht erehw uoc kcolb y suoremun reggirt dl ,elpmaxe roF .snoitpecxe elbissop
eht emussa osla dohtem )(etareleccA s’rac esab a sworht - ssalc - denifederp yrarbil
OtuOtnemugrA na ssap uoy fi noitpecxEegnaRf yna si emussa lliw ew hcihw( retemarap dilavni
b tnemugra dilavni rof tseT // .gnideecorp erofe
tni(etareleccA diov cilbup
{
)0 < atled(fi
;)"!orez naht retaerg eb tsum deepS"(noitpecxEegnaRfOtuOtnemugrA wen worht
...
}
:noitpecxe fo epyt hcae ot dnopser yllacificeps won dluoc cigolhctac ehT
][gnirts(niaM diov citats
{
...
ereH // .snoitpecxe elpitlum rof tuokool eht no era ew ,
yrt
{
)++i ;01 < i ;0 = i tni(rof
;)01(etareleccA.raCym
}
)e noitpecxEdaeDsIraC(hctac
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 611
{
.noitpecxEdaeDsIraC ssecorP //
}
)e noitpecxEegnaRfOtuOtnemugrA(hctac
{
.noitpecxEegnaRfOtuOtnemugrA ssecorP //
}
. ..
}
,skcolbhctac elpitlum gnirohtua era uoy nehW si noitpecxe na nehw taht erawa eb tsum uoy
xe etartsulli oT .hctac ”elbaliava tsrif“ eht yb dessecorp eb lliw ti ,nworht eht tahw yltca hctac
p eht dettiforter uoy emussa ,snaem oitidda na htiw cigol suoiver n ot stpmetta taht epocshctac
noitpecxe lla eldnah dnanoitpecxEdaeDsIraC dnoyeb s gnihctac ybnoitpecxEegnaRfOtuOtnemugrA
:swollof sanoitpecxE.metsyS cireneg a
!elipmoc ton lliw edoc sihT //
][gnirts(niaM diov citats
{
...
yrt
{
)++i ;01 < i ;0 = i tni(rof
;)01(etareleccA.raCym
}
)e noitpecxE(hctac
{
?snoitpecxe rehto lla ssecorP //
}
)e noitpecxEdaeDsIraC(hctac
{
.noitpecxEdaeDsIraC ssecorP //
}
)e noitpecxEegnaRfOtuOtnemugrA(hctac
{
.noitpecxEegnaRfOtuOtnemugrA ssecorP //
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 711
}
...
}
ot hsiw uoy fi ,suhT dnoyeb srorre yna eldnah lliw taht tnemetatshctaca enifed
:gniwollof eht etirw dluow uoy ,noitpecxEegnaRfOtuOtnemugrA dna noitpecxEdaeDsIraC
.enif tsuj selipmoc edoc sihT //
][gnirts(niaM diov citats
{
...
yrt
{
)++i ;01 < i ;0 = i tni(rof
eleccA.raCym ;)01(etar
}
)e noitpecxEdaeDsIraC(hctac
{
.noitpecxEdaeDsIraC ssecorP //
}
)e noitpecxEegnaRfOtuOtnemugrA(hctac
{
.noitpecxEegnaRfOtuOtnemugrA ssecorP //
}
)e noitpecxE(hctac
{
snoitpecxe elbissop rehto lla eldnah won lliw sihT //
emetats morf nworht // .epocs yrt eht nihtiw stn
}
...
}
stnemetatS hctac cireneG
noitpecxe eht eviecer ylticilpxe ton seod taht epocshctac ”cireneg“ a stroppus osla #C
nworht tcejbo
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 811
}
hctac
{
;)"...deneppah dab gnihtemoS"(eniLetirW.elosnoC
}
...
}
t ton si siht ,ylsuoivbO nah ot yaw evitamrofni tsom eh uoy taht nevig ,snoitpecxe eld yaw on evah
re eht tuoba atad lufgninaem niatbo ot eht sa hcus( derrucco taht ror ro ,kcats llac ,eman dohtem
ehtreveN .)egassem motsuc a hcus rof wolla seod #C ,ssel .tcurtsnoc
tpecxE gniworhteR snoi
eht pu noitpecxe na worhter ot kcolbyrta ni cigol rof elbissimrep si ti taht erawa eB
nihtiw drowyekworht eht fo esu ekam ylpmis ,os od oT .rellac suoiverp eht ot kcats llac
ihw ,cigol gnillac fo niahc eht pu noitpecxe eht sessap sihT .kcolbhctaca eb nac hc
yllaitrap ot elba ylno si kcolbhctac ruoy fi lufpleh
.kcub eht gnissaP //
)sgra ][gnirts(niaM diov citats
{
...
yrt
{
...cigol rac pu deepS //
}
)e noitpecxEdaeDsIraC(hctac
{
.kcub eht ssap dna rorre siht fo gnissecorp laitrap yna oD //
// .tcejbo noitpecxEdaeDsIraC gnimocni eht gniworhter era ew ,ereH
.eb deen fi noitpecxe tnereffid a worht ot eerf osla era uoy ,revewoH //
;e worht
}
...
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 911
kcolB yllaniF ehT 9.5
lanif lanoitpo na enifed osla yam epocshctac/yrtA heb noitavitom ehT .kcolbyl dni kcolbyllanifa
hsiw uoy emussa ,etart s’rac eht nwod rewop syawla ot fo sseldrager ,)(niaM gnitixe erofeb oidar
yna
)sgra ][gnirts(niaM diov citats
{
...
;)02 ,"yppiZ"(raC wen = raCym raC
;)eurt(senuTknarC.raCym
yrt
{
.cigol rac pu deepS //
}
ctac )e noitpecxEdaeDsIraC(h
{
.noitpecxEdaeDsIraC ssecorP //
}
)e noitpecxEegnaRfOtuOtnemugrA(hctac
{
.noitpecxEegnaRfOtuOtnemugrA ssecorP //
}
)e noitpecxE(hctac
{
.noitpecxE rehto yna ssecorP //
}
yllanif
{
.ton ro noitpecxE .rucco syawla lliw sihT //
Cym ;)eslaf(senuTknarC.ra
}
...
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 021
5002 oidutS lausiV gnisU snoitpecxE 01.5
p 5002 oidutS lausiV taht erawa eb od ,pu sgniht parw oT taht sloot fo rebmun a sedivor gubed
,niagA .snoitpecxe motsuc deldnahnu eht desaercni evah uoy emussa yeb tcejboraCa fo deeps dno
rew uoy fI .mumixam eht noisses gniggubed a trats ot e ,)noitceles unem tratS gubeD eht gnisu(
dutS lausiV eht ta skaerb yllacitamotua oi retteB .nworht si noitpecxe thguacnu eht emit
emitefiL tcejbO gnidnatsrednU 11.5
a #C ruoy gnidliub era uoy nehW uoy ,snoitacilpp eht taht emussa ot tcerroc era lliw paeh deganam
yromem TEN. fo elur nedlog eht ,tcaf nI .noitnevretni tcerid ruoy tuohtiw flesti fo erac ekat
:elpmis si tnemeganam
dna drowyekwen eht gnisu paeh deganam eht otno tcejbo na etacollA :eluR • ecnO .ti tuoba tegrof
wen“ - txen ehT .dedeen regnol on si ti nehw tcejbo eht yortsed lliw rotcelloc egabrag eht ”,de
eht taht si rewsna )etelpmocni ,.e.i( trohs ehT ?”dedeen regnol on si tcejbo na nehw enimreted
eht morf tcejbo na sevomer rotcelloc egabrag edoc ruoy fo trap yna yb elbahcaernu si ti nehw paeh
setacolla taht dohtem a evah uoy emussA .esab
)(raCAekaM diov citats cilbup
{
,tcejbo raC eht ot ecnerefer ylno eht si raCym fI //
.snruter dohtem eht nehw deyortsed eb yam ti //
(raC wen = raCym raC ;)
...
}
wen fo LIC ehT21.5
eht otni noitcurtsnijbowen LIC a time lliw ti ,drowyekwen eht sretnuocne relipmoc #C eht nehW
eht nihtiw stnemetats LIC gniwollof eht dnif dluow uoy ,exe.msadli gnisu ylb dohtem
:dohtem)(raCAekaM
tats gisybedih cilbup dohtem. deganam lic )(raCAekaM diov ci
{
)7x0( 7 ezis edoC //
1 kcatsxam.
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 121
)c raC.ezilaniFelpmiS ssalc ]0[( tini slacol.
)(rotc.::raC.ezilaniFelpmiS diov ecnatsni jbowen :0000_LI
0.colts :5000_LI
ter :6000_LI
raCAekaM::margorP dohtem fo dne // }
axe ew erofeB s’tel ,paeh eht morf devomer si tcejbo na nehw enimreted taht selur tcaxe eht enim
.liated erom tib a ni noitcurtsnijbowen LIC eht fo elor eht tuo kcehc
yb dessecca yromem fo knuhc modnar a tsuj naht erom si paeh deganam eht taht dnatsrednu ,tsriF
RLC eht lliw ti taht nevig ,paeh eht fo repeekesuoh ydit a etiuq si rotcelloc egabrag TEN. ehT .
siht ni dia oT .noitazimitpo fo sesoprup rof )yrassecen nehw( yromem fo skcolb ytpme tcapmoc
ht sa ot derrefer ylnommoc( retniop a sniatniam paeh deganam eht ,rovaedne retniop tcejbo txen e
.detacol eb lliw tcejbo txen eht erehw yltcaxe seifitnedi taht )retniop tcejbo wen ro
:sksat eroc gniwollof eht mrofrep ot RLC eht smrofni noitcurtsnijbowen
etacolla eb ot tcejbo eht rof deriuqer yromem fo tnuoma latot eht etaluclaC • eht gnidulcni( d
.)sessalc esab s’epyt eht dna selbairav rebmem s’epyt eht yb deriuqer yromem yrassecen
eb ot tcejbo eht tsoh ot moor hguone deedni si ereht taht erusne ot paeh deganam eht enimaxE •
i rotcurtsnoc s’epyt eht ,esac eht si siht fI .detacolla a denruter yletamitlu si rellac eht dna ,dellac s
tsal eht ot lacitnedi eb ot sneppah tsuj sserdda esohw ,yromem ni tcejbo wen eht ot ecnerefer
.retniop tcejbo txen eht fo noitisop
txen eht ecnavda ,rellac eht ot ecnerefer eht gninruter erofeb ,yllaniF • eht ot tniop ot retniop tcejbo
.paeh deganam eht no tols elbaliava txen
paeh deganam eht no ecaps eht ,noitacilppa ruoy ni stcejbo gnitacolla ysub era uoy sA ca yllaut
ganam eht taht senimreted RLC eht fi ,noitcurtsnijbowen eht gnissecorp nehW .lluf emoceb paeh de
noitcelloc egabrag a mrofrep lliw ti ,epyt detseuqer eht etacolla ot yromem tneiciffus evah ton seod
.yromem pu eerf ot tpmetta na ni
.elpmis etiuq osla si noitcelloc egabrag fo elur txen eht ,suhT
ciffus evah ton seod paeh deganam eht fI :eluR • a ,tcejbo detseuqer a etacolla ot yromem tnei
yliraropmet rotcelloc egabrag eht ,ecalp ekat seod noitcelloc a nehW .rucco lliw noitcelloc egabrag
ssecca ton seod noitacilppa eht taht erusne ot ssecorp tnerruc eht nihtiw sdaerht evitca lla sdnepsus
paeh eht a sa daerht a drager ylpmis ,gnieb emit eht rof ,revewoH .ssecorp noitcelloc eht gnirud
,detelpmoc sah elcyc noitcelloc egabrag eht ecnO .elbatucexe gninnur a nihtiw noitucexe fo htap
,yllufknahT .krow rieht no yrrac ot dettimrep era sdaerht dednepsus eht rotcelloc egabrag TEN. eht
.noitacilppa ruoy ni noitpurretni feirb siht eciton )reve fi( modles lliw uoy ;dezimitpo ylhgih si
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 221
noitcelloc egabraG fo scisab ehT 31.5
enimaxe yllaretil ton seod si ,stcejbo elbahcaernu etacol ot gnitpmetta si RLC eht nehW dna hcae
,emit elbaredisnoc evlovni dluow os gniod ,ylsuoivbO .paeh deganam eht no decalp tcejbo yreve
laer ,.e.i( regral ni yllaicepse - .snoitacilppa )dlrow
ehT”.noitareneg“ cificeps a ot dengissa si paeh eht no tcejbo hcae ,ssecorp eht ezimitpo pleh oT
,elpmaxe roF .ereht yats ot no detsixe sah tcejbo na regnol ehT :elpmis si snoitareneg dniheb aedi
,ylesrevnoC .setanimret margorp eht litnu yromem ni eb lliw)(niaM gnitnemelpmi tcejbo eht
eb ot ylekil era paeh eht no decalp yltnecer neeb evah taht stcejbo hcus( ylkciuq rehtar elbahcaernu
paeh eht no tcejbo hcae ,snoitpmussa eseht neviG .)epocs dohtem a nihtiw detaerc tcejbo na sa
:snoitareneg gniwollof eht fo eno ot sgnoleb
rof dekram neeb reven sah taht tcejbo detacolla ylwen a seifitnedI :0 noitareneG • noitcelloc
rof dekram saw ti ,.e.i( noitcelloc egabrag a devivrus sah taht tcejbo na seifitnedI :1 noitareneG •
)deriuqca saw ecaps paeh tneiciffus eht taht tcaf eht ot eud devomer ton saw tub ,noitcelloc
us sah taht tcejbo na seifitnedI :2 noitareneG • rotcelloc egabrag eht fo peews eno naht erom devivr
eseht gnipeews dna gnikram fI .tsrif stcejbo 0 noitareneg lla etagitsevni lliw rotcelloc egabrag ehT
yna ,yromem eerf fo tnuoma deriuqer eht ni stluser stcejbo
oitareneg ot detomorp era stcejbo gnivivrus eht stceffa noitareneg s’tcejbo na woh etartsulli oT .1 n
.ssecorp noitcelloc
ssecorP noitazilaniF ehT ,epyT a noitazilaniF ehT 41.5
erusne ot si dohtem)(ezilaniF eht fo elor eht taht rebmemer syawla tub ,esroh daed a taeb ot toN
pyt ruoy ngised dluohs nehW .emit sekat noitazilanif taht nosaer )(ezilaniFa gnitroppus diova ot se
ruoy rehtehw senimreted yllacitamotua emitnur eht ,paeh deganam eht otno tcejbo na etacolla uoy
bo eht ,os fI .dohtem)(ezilaniF motsuc a stroppus tcejbo bazilanif sa dekram si tcej ,el na no derots si
a si eueuq noitazilanif ehT .eueuq noitazilanif eht deman eueuq lanretni eht yb deniatniam elbat
tniop taht rotcelloc egabrag taht tcejbo yreve dna hcae ot s devomer si ti erofeb dezilanif eb tsum
eh eht morf rotcelloc egabrag eht nehW .pa ,yromem morf tcejbo na eerf ot emit si ti senimreted ti
eht no yrtne hcae senimaxe ffo tcejbo eht seipoc dna ,eueuq noitazilanif rehtona tey ot paeh eht
deganam netfo( elbat elbahcaer noitazilanif eht demret erutcurts dna ,elbahcaerf sa detaiverbba ffe“ -
er t etarapes a ,tniop siht tA .)”elbahca eht ekovni ot denwaps si daerh hcaerf eht no tcejbo hcae elba
egabrag txen eht ta elbat egabrag owt tsael yrev ta ekat lliw ti ,siht neviG .noitcelloc ot snoitcelloc
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 321
ezilanif ylurt ihw taht si enil mottob ehT .tcejbo na itazilanif el na erusne seod tcejbo na fo no tcejbo
n llits si ti ,secruoser deganamnu pu naelc nac dna ,erutan ni citsinimretedno artxe eht ot eud
dniheb - eht -
dohteMnoitcurtseD coH dA gnidliuB 51.5
,tcejbO.metsyS ,TEN. fo ssalc esab emerpus ehT senifed deman dohtem lautriv a ehT .)(ezilaniF
:reveostahw gnihton seod dohtem siht fo noitatnemelpmi tluafed
tcejbO.metsyS //
tcejbO ssalc cilbup
{
...
}{ )(ezilaniF diov lautriv detcetorp
}
alc motsuc ruoy rof)(ezilaniF edirrevo uoy nehW a hsilbatse uoy ,sess rep ot noitacol cificeps si
llac yltcerid ot elbissop ton si ti ,detcetorp sa denifed .dohtem)(ezilaniF s’tcejbo na eht ,rehtaR
F s’tcejbo na llac lliw rotcelloc egabrag )detroppus fi( dohtem)(ezilani tcejbo eht gnivomer erofeb
oc fO .yromem morf llac a ,esru lliw)(ezilaniF ot egabrag ”larutan“ a gnirud rucco )yllautneve(
oitcelloc yllacitammargorp uoy nehw ro n tidda nI .)(tcelloC.CG aiv noitcelloc a ecrof s’epyt a ,noi
dohtem rezilanif amod noitacilppa eht nehw dellac eb yllacitamotua oitacilppa ruoy gnitsoh ni si n
orgkcab tnerruc ruoy no desaB .yromem morf dedaolnu taht wonk yam uoy ,TEN. ni dnu
desu era )sniamoDppA ylpmis ro( sniamod noitacilppa ylbmessa elbatucexe na tsoh ot yna dna
.seirarbil edoc lanretxe yrassecen
ssecorP noitazilaniF eht gniliateD 61.5
ht taht rebmemer syawla tub ,esroh daed a taeb ot toN erusne ot si dohtem)(ezilaniF eht fo elor e
t sepyt ruoy ngised dluohs )(ezilaniFa gnitroppus diova o nehW .emit sekat noitazilanif taht nosaer
colla uoy deganam eht otno tcejbo na eta a emitnur eht ,paeh rehtehw senimreted yllacitamotu ruoy
motsuc a stroppus tcejbo bo eht ,os fI .dohtem)(ezilaniF ,elbazilanif sa dekram si tcej na no derots si
ueuq noitazilanif eht deman eueuq lanretni a si eueuq noitezilanif ehT .e eht yb deniatniam elbat
t rotcelloc egabrag tniop tah taht tcejbo yreve dna hcae ot s devomer si ti erofeb dezilanif eb tsum
eh eht morf rotcelloc egabrag eht nehW .pa ,yromem morf tcejbo na eerf ot emit si ti senimreted ti
eht no yrtne hcae senimaxe ffo tcejbo eht seipoc dna ,eueuq noitazilanif eh eht rehtona tey ot pa
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 421
deganam netfo( elbat elbahcaer noitazilanif eht demret erutcurts dna ,elbahcaerf sa detaiverbba ffe“ -
t etarapes a ,tniop siht tA .)”elbahcaer eht ekovni ot denwaps si daerh elbahcaerf eht no tcejbo hcae
ta elbat egabrag txen eht .noitcelloc
epyT CG.metsyS ehT 71.5
man epyt ssalc a edivorp seirarbil ssalc esab ehT ot uoy swolla tahtCG.metsyS de eht htiw tcaretni
rotcelloc egabrag .srebmem citats fo tes a gnisu fi( modles lliw uoy taht erawa yrev eb od ,woN
)reve yt siht fo esu ekam ot deen ep ylno eht ,gnikaeps yllacipyT .edoc ruoy ni yltcerid uoy emit
eht fo esu ekam lliw c era uoy nehw siCG.metsyS fo srebmem fo esu ekam taht sepyt gnitaer
.secruoser
:CG.metsyS fo srebmem tceles setartsulli hcihw ,dohtem)(niaM gniwollof eht rednoP
v citats )sgra ][gnirts(niaM dio
{
.paeh no setyb fo rebmun detamitse tuo tnirP //
,"}0{ :paeh no setyb detamitsE"(eniLetirW.elosnoC
;))eslaf(yromeMlatoTteG.CG
.sesoprup yalpsid rof 1 dda os ,desab orez si noitareneGxaM //
}0{ sah SO sihT"(eniLetirW.elosnoC .snoitareneg tcejbo \ ,"n
;))1 + noitareneGxaM.CG(
;)001 ,"yppiZ"(raC wen = raCyMoTfer raC
;))(gnirtSoT.raCyMoTfer(eniLetirW.elosnoC
.tcejbo raCyMoTfer fo noitareneg tuo tnirP //
,"}0{ :si raCyMoTfer fo noitareneG"(eniLetirW.elosnoC
(noitareneGteG.CG ;))raCyMoTfer
;)(eniLdaeR.elosnoC
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 521
TINU - 6
snoitcelloC dna secafretnI nifed lamrof a edivorp ot em wolla ,retpahc siht nigeb oT .epyt ”ecafretni“ eht fo noiti ecafretni nA
fo noitcelloc deman a naht erom gnihton si tcartsba detaler yllacitnames mem cificeps ehT .sreb
cafretni na yb denifed srebmem roivaheb tcaxe eht no dneped e nA .eurt s’ti ,seY .gniledom si ti
a sesserpxe ecafretni ro ssalc nevig a taht roivaheb na ,level citcatnys a tA denifed si ecafretni
eht gnisu ehto ekilnU .drowyekecafretni #C afretni ,sepyt TEN. r ssalc esab a yficeps reven sec ton(
n od taht srebmem niatnoc dna )tcejbO.metsyS neve sa( reifidom ssecca na ekat to ecafretni lla
eht teg oT .)cilbup ylticilpmi era srebmem motsuc a si ereh ,gnillor llab :#C ni denifed ecafretni
hT // ".stniop gnivah" fo roivaheb eht senifed ecafretni si
ytnioPI ecafretni cilbup
{
.tcartsba dna cilbup ylticilpmI //
;)(stnioPfOrebmuNteG etyb
}
TEN. ,revewoH .dohtem elgnis a senifed ecafretniytnioPI eht ,ees nac uoy sA
ot elba osla era sepyt ecafretni dluoc uoy ,elpmaxe roF .seitreporp fo rebmun yna enifed
ecafretniytnioPI eht etaerc
:dohtem rossecca
daer a sa roivaheb ytniop ehT // - .ytreporp ylno
ytnioPI ecafretni cilbup
{
};teg{stnioP etyb
}
no sselesu etiuq era sepyt ecafretni taht dnatsrednu oD era yeht sa ,nwo rieht
tonnac uoy ,siht neviG .srebmem tcartsba fo noitcelloc deman a naht erom gnihton
:erutcurts ro ssalc a dluow uoy sa sepyt ecafretni etacolla
.sepyt ecafretni "wen" ot lagellI !kcA //
][gnirts(niaM diov citats
{
PI wen = p ytnioPI !rorre relipmoC // ;)(ytnio
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 621
na siytnioPI ro ssalc a yb detnemelpmi era yeht litnu elbat eht ot hcum gnirb ton od secafretnI
ht sesserpxe taht ecafretni ”.stniop gnivah“ fo roivaheb e let nac uoy sA thgim roivaheb siht ,l
eb eht ni lufesu ed yhcrareih sepahs ni depolev i ehT .4 retpahC ni sessalc emoS :elpmis si aed eht sa
n od )elcriC eht sa hcus( srehto elihw ,)nogaxeH dnanogaxeHerugifnoc uoy fI .to otelgnairT
nac uoy ,ecafretniytnioPI eht tnemelpmi ssalc hcae taht emussa ylefas nommoc a stroppus won
,roivaheb .srebmem fo tes nommoc a erofereht dna
#C ni level tcejbo ta srebmeM ecafretnI gnikovnI 2.6
oitcnuf sti dnetxe ot sesoohc )erutcurts ro( ssalc a nehW ecafretni gnitroppus yb ytilan seod ti ,sepyt
ammoc a gnisu os - epyt eht ni tsil detimiled B .noitinifed eht taht erawa e retfa detsil meti tsrif eht
c eht ssalc ruoy nehW .rotarepo nolo t eerf era uoy ,tcejbO.metsyS morf yltcerid sevired epyt o
)s(ecafretni eht tsil ylpmis ht sa ,ssalc eht yb detroppus ruoy dnetxe lliw relipmoc #C e ton od uoy
nO .esiwrehto yas taht nevig ,eton detaler a morf evired syawla serutcurts ees(epyTeulaV.metsyS
cae tsil ylpmis ,)3 retpahC eht retfa yltcerid ecafretni h .noitinifed erutcurts gniwollof eht rednoP
:selpmaxe dna tcejbO.metsyS morf sevired ssalc sihT //
gnis a stnemelpmi // .ecafretni el
ecafretnIemoSI : ssalCemoS ssalc cilbup
}...{
tcejbO.metsyS morf sevired osla ssalc sihT //
.ecafretni elgnis a stnemelpmi dna //
ecafretnIemoSI ,tcejbo : ssalCyM ssalc cilbup
}...{
ssalc esab motsuc a morf sevired ssalc sihT //
na // stnemelpmi d
ecafretnIemoSI ,ssalCesaByM : ssalCrehtonA ssalc cilbup
}...{
dna epyTeulaV.metsyS morf sevired tcurts sihT //
.secafretni owt stnemelpmi //
ytnioPI ,ecafretnIemoSI : tcurtSemoS tcurts cilbup
}...{
afretni na gnitnemelpmi taht dnatsrednU lla na si ec - ro - ehT .noitisoporp gnihton
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 721
ytnioPI eht taht neviG .tnemelpmi lliw ti srebmem hcihw esoohc ylevitceles ot elba ton si epyt
era uoy fi ,revewoH .nedrub a fo hcum oot ton si siht ,ytreporp elgnis a senifed ecafretni
ht ecafretni na gnitnemelpmi tuo gnihself rof elbisnopser won si epyt eht ,srebmem net senifed ta
sepahs detadpu eht fo noitatnemelpmi eht si ereh ,esac .seititne tcartsba net eht fo sliated eht
wen eht eton( yhcrareih
:)epyt ssalc elgnairT
.ytnioPI stnemelpmi won nogaxeH //
cilbup ytnioPI ,epahS : nogaxeH ssalc
{
} {)(nogaxeH cilbup
} {)eman(esab : )eman gnirts(nogaxeH cilbup
)(warD diov edirrevo cilbup
} ;)emaNteP ,"nogaxeH eht }0{ gniwarD"(eniLetirW.elosnoC {
.noitatnemelpmI ytnioPI //
stnioP etyb cilbup
{
} ;6 nruter { teg
}
}
yhcrareiH epahS gnisicrecxE 3.6
.elgnairT deman ssalc devired epahS weN //
ytnioPI ,epahS : elgnairT ssalc cilbup
{
} { )(elgnairT cilbup
} { )eman(esab : )eman gnirts(elgnairT cilbup
)(warD diov edirrevo cilbup
eht }0{ gniwarD"(eniLetirW.elosnoC { } ;)emaNteP ,"elgnairT
.noitatnemelpmI ytnioPI //
stnioP etyb cilbup
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 821
{
} ;3 nruter { teg
}
}
noitatnemelpmI ecafretnI ticilpxE gnidnatsrednU4.6
erew ew ,D3warDI fo noitinifed tnerruc ruo nI dohtem elos sti eman ot decrof ot redro ni)(D3warD
alc diova artsba eht htiw gnihs eht ni denifed dohtem)(warD tc si ereht elihW .ssalc esabepahS
tiw gnorw ylbirroh gnihton a ,noitinifed ecafretni siht h eb ylpmis dluow eman dohtem larutan erom
:)(warD
."warD" ot "D3warD" morf eman dohtem rotcafeR //
ecafretni cilbup
{
;)(warD diov
}
ruo etadpu osla ot su eriuqer dluow siht ,egnahc a hcus ekam ot erew ew fI
fo noitatnemelpmi
)d3fti D3warDI(D3nIwarD diov citats cilbup
{
"(eniLetirW.elosnoC - ;)"epyt elbitapmoc D3warDI gniwarD >
;)(warD.d3fti
}
fed evah uoy emussa ,woN tcartsba eht morf sevired tahteniL deman ssalc wen a deni
epahS tcartsba deman yllacitnedi na enifed won hcihw fo htob(D3warDI stnemelpmi dna ssalc
:)dohtem
...sdneped tI ?smelborP //
D3warDI ,epahS : eniL ssalc cilbup
{
)(warD diov edirrevo cilbup
{
oC ;)"...enil a gniwarD"(eniLetirW.elosn
}
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 921
tnegA cihpromyloP sa ecafretnI 5.6
eb osla nac noitatnemelpmi ecafretni ticilpxE era uoy revenehw lufpleh yrev a gnitnemelpmi
ot neppah taht secafretni fo rebmun roF .srebmem lacitnedi niatnoc oy emussa ,elpmaxe ot hsiw u
mi taht ssalc a etaerc wen gniwollof eht lla stnemelp :sepyt ecafretni
.sdohtem deman yllacitnedi enifed hcae secafretni eerhT //
ecafretni cilbup
{
;)(warD diov
}
retnirPoTwarDI ecafretni cilbup
{
;)(warD diov
}
ssalc a dliub ot hsiw uoy fI roppus tahtegamIrepuS deman D3 ,)warDI( gniredner cisab st gniredner
DI( secivres gnitnirp sa llew sa ,)D3warDI( edivorp ot yaw ylno eht ,)retnirPoTwar
euqinu :noitatnemelpmi
.hsalc eman a gnitcejni llits tub ,epahS morf gnivired toN //
amIrepuS ssalc cilbup D3warDI ,retnirPoTwarDI ,warDI : eg
{
)(warD.warDI diov
} /* .cigol gniward cisaB */ {
)(warD.retnirPoTwarDI diov
} /* .cigol retnirP */ {
)(warD.D3warDI diov
} /* .cigol gniredner D3 */ {
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 031
seihcrareiH ecafretnI gnidliuB 6.6
tsevni ruo eunitnoc oT pot eht enimaxe s’tel ,secafretni motsuc gnitaerc fo noitagi ci ecafretni fo
sa noitcnuf nrut ni nac hcihw( sessalc rehto ot ssalc esab a sa evres nac ssalc a sa tsuJ .seihcrareih
c rehtona tey ot sessalc esab dliub ot elbissop si ti ,)ssal taler ecnatirehni .secafretni gnoma spihsnoi
ompot eht ,tcepxe thgim uoy sA ts tsom eht elihw ,roivaheb lareneg a senifed ecafretni devired
erom senifed ecafretni :yhcrareih ecafretni gniwollof eht rednop ,etartsulli oT .sroivaheb cificeps
.ecafretni esab ehT //
tni cilbup ecafre
} ;)(redneR diov {
i desserpxe roivaheb hcae troppus ot dehsiw ssalc a fi ,woN ti ,yhcrareih ecafretni siht n morf evired
htn eht - eReliFateMI( ecafretni tsom sdohtem ynA .)esac siht niredn )s(ecafretni esab eht yb denifed
ni deirrac yllacitamotua era roF .noitinifed eht ot
:elpmaxe
.redneReliFateMI dna ,elbatnirPI ,elbawarDI stroppus ssalc sihT //
redneReliFateMI : egamIrepuS ssalc cilbup
{
)(warD diov cilbup
} ;)".cigol gniward cisaB"(eniLetirW.elosnoC {
)(tnirP diov cilbup
"(eniLetirW.elosnoC { } ;)".retnirp ot warD
)(redneR diov cilbup
} ;)".elifatem ot redneR"(eniLetirW.elosnoC {
}
:ecnatsniegamIrepuSa morf ecafretni hcae gnisicrexe fo egasu elpmas emos si ereH
.secafretni eht esicrexE //
][gnirts(niaM diov citats
{
repuS wen = is egamIrepuS ;)(egamI
.elbawarDI teG //
;is)elbawarDI( = warDfti elbawarDI
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 131
;)(warD.warDfti
pu sdohtem lla sesopxe hcihw ,redneReliFatemI teg woN //
.ecnatirehni fo niahc eht //
)redneReliFateMI si warDfti( fi
{
;warDfti)redneReliFateMI( = FMfti redneReliFateMI
Mfti ;)(redneR.F
;)(tnirP.FMfti
}
;)(eniLdaeR.elosnoC
}
ecafretnI elbatrevnoCI eht gnidnatsrednU,TEN.SV gnisU secafretnI 7.6
ecafretni hguohtlA - p yrev a si gnimmargorp desab ,euqinhcet gnimmargorp lufrewo gnitnemelpmi
fo tnuoma yhtlaeh a liatne yam secafretni viG .gnipyt secafretni taht ne tcartsba fo tes deman a era
qer eb lliw uoy ,srebmem edoc buts eht ni epyt ot deriu ecafretni hcae rof )noitatnemelpmi dna(
o dohtem .roivaheb eht stroppus taht ssalc hcae n seod 5002 oidutS lausiV ,epoh dluow uoy sA
av troppus ot suoir fo ksat eht ekam taht slo sA .emosnedrub ssel secafretni gnitnem hsiw uoy emus
eht tnemelpmi ot uoY .naViniM deman ssalc wen a no ecafretniraCI uoy nehw eciton lliw
etelpmoc i eht no rosruc esuom eht noitisop uoy nehw ro( eman s’ecafretni eht gnipyt fretn eca eman
enilrednu si rettel tsrif eht ,)wodniw edoc eht ni uoy ,snoitpo tceles uoy ecnO d lausiV taht ees lliw
detareneg tliub sah 5002 oidutS edoc deman a nihtiw( edoc buts taht eton( etadpu ot uoy rof )noiger
sworht noitatnemelpmi tluafed eht
etsyS .)noitpecxE.m
yhcrareiHecaFI ecapseman
{
raCI : naViniM ssalc cilbup
{
)(naViniM cilbup
{
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 231
srebmeM raCI noiger#
)(evirD diov cilbup
{
;)".detnemelpmi ton si noitarepo ro dohtem ehT"(noitpecxE wen
}
noigerdne#
}
}
ps eht otni dellird evah uoy taht woN ub fo scifice motsuc gnitnemelpmi dna gnidli eht ,secafretni
n a senimaxe retpahc eht fo redniamer secafretni denifederp fo rebmu TEN. eht nihtiw deniatnoc
.seirarbil ssalc esab
lbaremunEI( sepyT elbaremunE gnidliuB8.6 e )rotaremunEI dna
eht etartsulli oT enimaxe tsrif s’tel ,secafretni TEN. gnitsixe gnitnemelpmi fo ssecorp
deman ssalc a depoleved evah uoy emussA .rotaremunEI dnaelbaremunEI
nihtiw derots )6 retpahC ees( sepytraC laudividni fo tes a sniatnoc tahtegaraG
:yarrA.metsySa
sniatnoc egaraG //
p egaraG ssalc cilbu
{
;yarrArac ][raC etavirp
.putrats nopu stcejbo raC emos htiw lliF //
)(egaraG cilbup
,"ytsuR"(raC wen =
,"reknulC"(raC wen =
,"yppiZ"(raC wen =
;)03 ,"derF"(raC wen =
}
}
tcejboegaraG eht revo etareti ot tneinevnoc eb dluow ti ,yllaedI #C eht gnisu smetibus s’
hcaerof
...elbanosaer smees sihT //
ssalc cilbup
{
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 331
)sgra ][gnirts(niaM diov citats
{
;)(egaraG wen = toLrac egaraG
?noitcelloc eht ni rac hcae revo dnaH //
)toLrac ni c raC(
eht ot smetibus deniatnoc esopxe ot elba era
rellac :
rellac eht smrofni ecafretni sihT //
.detaremune eb nac smetibus s'tcejbo eht taht //
ecafretni cilbup
{
;)(rotaremunEteG rotaremunEI
}
deman ecafretni rehtona tey ot ecnerefer a snruter dohtem)(rotaremunEteG eht ,ees nac uoy sA
unEI.snoitcelloC.metsyS ot rellac eht wolla ot erutcurtsarfni eht sedivorp ecafretni sihT .rotarem
elbaremunEI eht yb deniatnoc stcejbo lanretni eht esrevart - :reniatnoc elbitapmoc
ot rellac eht swolla ecafretni sihT //
.smetibus s'reniatnoc a niatbo //
ecafretni cilbup
{
loob .rosruc eht fo noitisop lanretni eht ecnavdA // ;)( txeNevoM
daer( meti tnerruc eht teG // };teg { tnerruC tcejbo - .)ytreporp ylno
.rebmem tsrif eht erofeb rosruc eht teseR // teseR diov
}
,secafretni eseht troppus ot epytegaraG eht etadpu ot hsiw uoy fI eht ekat dluoc uoy
daor gnol
a si ereht ,)(teseR dna ,tnerruC,)(txeNevoM,)(rotaremunEteG fo snoisrev dezimotsuc edivorp
stnemelpmi ydaerla )sepyt rehto ynam sa llew sa( epyt yarrA.metsyS eht sA .yaw relpmis
eled ylpmis nac uoy ,rotaremunEI dnaelbaremunEI :swollof sayarrA.metsyS eht ot tseuqer eht etag
;snoitcelloC.metsyS gnisu
...
elbaremunEI : egaraG ssalc cilbup
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 431
{
!rotaremunEI stnemelpmi ydaerla yarrA.metsyS //
;yarrArac ][raC etavirp
,"eeFeeF"(raC wen =
,"reknulC"(raC wen = ]1[yarrArac
= ]2[yarrArac ,"yppiZ"(raC wen
,03 ,"derF"(raC wen = ]3[yarrArac
}
)(rotaremunEteG rotaremunEI cilbup
{
.rotaremunEI s'tcejbo yarra eht nruteR //
;)(rotaremunEteG.yarrArac nruter
}
}
#C eht nihtiw epyt eht esu ylefas won nac uoy ,epytegaraG ruoy detadpu evah uoy ecnO
,ylcilbup denifed neeb sah dohtem)(rotaremunEteG eht taht nevig ,eromrehtruF .tcurtsnoc hcaerof
:epytrotaremunEI eht htiw tcaretni osla dluoc resu tcejbo eht
.rotaremunEI htiw krow yllaunaM //
;)(rotaremunEteG.toLrac = i rotaremunEI
;)(txeNevoM.i
Cym raC ;tnerruC.i)raC( = ra
;)deepSrruC.raCym ,emaNteP.raCym ,"HPM }1{ gniog si }0{"(eniLetirW.elosnoC
,level tcejbo eht morfelbaremunEI fo ytilanoitcnuf eht edih ot referp dluow uoy fI
ekam ylpmis
)(rotaremunEteG.elbaremunEI rotaremunEI cilbup
{
t nruteR // .rotaremunEI s'tcejbo yarra eh
;)(rotaremunEteG.yarrArac nruter
}
)elbaenolCI( stcejbO elbaenolC gnidliuB9.6
sihT .)(enolCesiwrebmeM deman rebmem a senifedtcejbO.metsyS ,3 retpahC morf llacer uoy sA
( yltcerid dohtem siht llac ton od sresu tcejbO dohtem tcejbo nevig a ,revewoh ;)detcetorp si ti sa
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 531
a evah uoy emussa ,etartsulli oT .ssecorp gninolc eht gnirud flesti dohtem siht llac yam
:tnioP deman ssalc
.tnioP deman ssalc A //
tnioP ssalc cilbup
{
.ssecca ysae rof cilbuP //
;y ,x tni cilbup
P cilbup };y = y.siht ;x = x.siht { )y tni ,x tni(tnio
}{)(tnioP cilbup
.)(gnirtSoT.tcejbO edirrevO //
)(gnirtSoT gnirts edirrevo cilbup
} ;) y ,x ,"}1{ = Y ;}0{ = X"(tamroF.gnirts nruter {
}
tpahC( sepyt eulav dna sepyt ecnerefer tuoba wonk ydaerla uoy tahw neviG erawa era uoy ,)3 re
emas eht ot gnitniop secnerefer owt evah uoy ,rehtona ot elbairav ecnerefer eno ngissa uoy fi taht
snoitacifidom ;paeh eht no tcejbotnioP noitarepo tnemngissa gniwollof eht ,suhT .yromem ni tcejbo
emas eht tceffa ecnerefer rehtie gnisu :paeh eht no tcejbo
)sgra ][gnirts(niaM diov citats
{
secnerefer owT //
;)05 ,05(tnioP wen = 1p tnioP
;1p = 2p tnioP
;0 = x.2p
;)1p(eniLetirW.elosnoC
;)2p(eniLetirW.elosnoC
}
na nruter ot ytiliba eht troppus ot sepyt motsuc ruoy piuqe ot hsiw uoy nehW fo ypoc lacitnedi
elgnis a senifed epyt sihT .ecafretnielbaenolCI dradnats eht tnemelpmi yam uoy ,rellac eht ot flesti
:)(enolC deman dohtem
elbaenolCI ecafretni cilbup
{
;)(enolC tcejbo
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 631
neewteb seirav dohtem)(enolC eht fo noitatnemelpmi eht ,ylsuoivbO eht ,revewoH .stcejbo
eht ot etadpu gniwollof eht rednop ,etartsulli oT .resu eht ot ti nruter dna ,ecnatsni tcejbo wen a otni
:ssalctnioP
enolc" stroppus won tnioP ehT // - ".ytiliba
elbaenolCI : tnioP ssalc cilbup
{
;y ,x tni cilbup
} {)(tnioP cilbup
};y = y.siht ;x = x.siht { )y tni ,x tni(tnioP cilbup
.tcejbo tnerruc eht fo ypoc a nruteR //
)(enolC tcejbo cilbup
} ;)y.siht ,x.siht(tnioP wen nruter {
)(gnirtSoT gnirts edirrevo cilbup
} ;) y ,x ,"}1{ = Y ;}0{ = X"(tamroF.gnirts nruter {
}
w siht nI dnats tcaxe etaerc nac uoy ,ya - detartsulli sa ,epyttnioP eht fo seipoc enola
lof eht yb
)sgra ][gnirts(niaM diov citats
{
.epyt tcejbo cireneg a snruter )(enolC ecitoN //
.epyt devired eht niatbo ot tsac ticilpxe na mrofrep tsum uoY //
P wen = 3p tnioP ;)001 ,001(tnio
;)(enolC.3p)tnioP( = 4p tnioP
.)x.3p egnahc ton lliw hcihw( x.4p egnahC //
;0 = x.4p
.tcejbo hcae tnirP //
;)3p(eniLetirW.elosnoC
;)4p(eniLetirW.elosnoC
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 731
j sgniht enilmaerts nac uoy ,llib eht stiftnioP fo noitatnemelpmi tnerruc eht elihW a tsu
.tib
yfilpmis dluoc uoy ,selbairav epyt ecnerefer niatnoc ton seod epyttnioP eht esuaceB
:swollof sa dohtem)(enolC eht fo noitatnemelpmi eht
)(enolC tcejbo cilbup
{
.rebmem yb rebmem tnioP eht fo dleif hcae ypoC //
;)(enolCesiwrebmeM.siht nruter
}
,selbairav rebmem epyt ecnerefer yna niatnoc didtnioP eht fi taht ,revewoh ,erawa eB
rebmeM -
hsiw uoy fI .)ypoc wollahs a aka( stcejbo esoht ot secnerefer eht ypoc lliw)(enolCesiw
troppus ot
fo ecnatsni wen a etaerc ot deen lliw uoy ,ypoc peed eurt a selbairav epyt ecnerefer yna
.ssecorp gninolceht gnirud
)elbarapmoCI( stcejbO elbarapmoC gnidliuB 01.6
ivaheb a seificeps ecafretnielbarapmoCI.metsyS ehT no desab detros eb ot tcejbo na swolla taht ro
noitinifed lamrof eht si ereH .yek deificeps emos :
sti yficeps ot tcejbo na swolla ecafretni sihT //
.stcejbo ekil rehto neewteb pihsnoitaler //
{elbarapmoCI ecafretni cilbup
;)o tcejbo(oTerapmoC tni
}
ot ssalcraC eht detadpu evah uoy emussa s’teL rebmun DI lanretni na niatniam a yb detneserper(
is aht )DIrac deman regetni elpm detalupinam dna retemarap rotcurtsnoc a aiv tes eb nac t a gnisu
er eht era ereH .DI deman ytreporp wen :epytraC eht ot setadpu tnavel raC ssalc cilbup
{
...
;DIrac tni etavirp
DI tni cilbup
{
} ;DIrac nruter { teg
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 831
{ tes } ;eulav = DIrac
}
)di tni ,pSrruc tni ,eman gnirts(raC cilbup
{
;pSrruc = deepSrruc
;eman = emaNtep
;di = DIrac
}
...
}
:swollof sa sepytraC fo yarra na etaerc thgim sresu tcejbO
)sgra ][gnirts(niaM diov citats
{
sepyt raC fo yarra na ekaM // .
;]5[raC wen = sotuAym ][raC
;)1 ,08 ,"ytsuR"(raC wen = ]0[sotuAym
;)432 ,04 ,"yraM"(raC wen = ]1[sotuAym
;)43 ,04 ,"repiV"(raC wen = ]2[sotuAym
;)4 ,04 ,"leM"(raC wen = ]3[sotuAym
;)5 ,04 ,"ykcuhC"(raC wen = ]4[sotuAym
}
metsyS eht ,llacer uoy sA citats a senifed ssalcyarrA. ekovni uoy nehW .)(troS deman dohtem siht
,trohs,tni( sepyt cisnirtni fo yarra na no dohtem ot elba era uoy ,).cte ,gnirts eht ni smeti eht tros
citebahpla/laciremun ni yarra atad cisnirtni eseht sa redro rapmoCI tnemelpmi sepyt ,revewoH .elba
fo yarra na dnes ot erew uoy fi tahw
?swollof sa dohtem)(troS eht otni sepytraC
?srac ym troS //
;)sotuAym(troS.yarrA
eht yb nworht si noitpecxenoitpecxEtnemugrA na taht dnif dluow uoy ,tset siht nur uoy fI
,emitnur
gniwollof eht htiw nehW ”.elbarapmoCI tnemelpmi tsum tcejbo eno tsael tA“ :egassem
ot sepyt ruoy fo syarra wolla otelbarapmoCI tnemelpmi nac uoy ,sepyt mot
ediced ot uoy ot pu eb lliw ti ,)(oTerapmoC fo sliated eht tuo hself uoy nehW .detros eb
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 931
ro eht fo enilesab eht tahw lanretni eht ,epytraC eht roF .eb lliw noitarepo gnired
:etadidnac lacigol tsom eht eb ot smeesDIrac
deredro eb nac raC eht fo noitareti ehT //
.DIraC eht no desab //
elbarapmoCI : raC ssalc cilbup
{
...
.noitatnemelpmi elbarapmoCI //
oC.elbarapmoCI tni {)jbo tcejbo(oTerapm
;jbo)raC( = pmet raC
)DIrac.pmet > DIrac.siht(fi
;1 nruter
)DIrac.pmet < DIrac.siht(fi
nruter - ;1
esle
;0 nruter
}
}
ecapsemaN snoitcelloC.metsyS eht fo secafretnI ehT gnirolpxE 11.6
ah dluow tcurtsnoc reniatnoc evitimirp tsom ehT eb ot ev uoy sA .yarrA.metsyS dneirf doog ruo
evah evewoH .)gnitaremune dna ,gniraelc ,gnitros ,gnisrever a sah ssalcyarrA elpmis eht ,r rebmun
o ti ylbaton tsom ,snoitatimil f om a ni sepyt niatnoc ot deen uoy nehW .smeti raelc ro elbixelf er
uoy ,reniatnoc yam etsyS eht nihtiw denifed sepyt eht egarevel ot hsiw ro( ecapseman snoitcelloC.m
sa lloC.metsyS eht ,01 retpahC ni dessucsid .)ecapsemancireneG.snoitce
ehT fo rebmun a senifed ecapsemansnoitcelloC.metsyS evah uoy hcihw fo emos( secafretni
c eht fo ytirojam afretni eseht tnemelpmi sessalc noitcello rieht ot ssecca edivorp ot sec .stnetnoc
7 elbaT - noitcelloc eroc eht fo nwodkaerb a sevig 2 - .secafretni cirtnec
htiw epyT raC eht gnittiforteR reniatnoc motsuC a gnidliuB 11.6
setageleD pmiS suoiverp eht ,ylraelC etni saw elpmaxeetageleDel evitartsulli ylerup eb ot dedn taht
liub ot nosaer on eb dluow ereht owt dda ot ylpmis etageled a d siht ,revewoh ,yllufepoH .srebmun
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 041
ssecorp eht seifitsymed elpmaxe htiw gnikrow fo o esu citsilaer erom a edivorp oT .sepyt etageled f
eled ruo tiforter s’tel ,sepyt etag itonwolBoTtuobA dnadedolpxE eht dnes ot epytraC gnisu snoitacif
setageled TEN. gnitnemelpmi regnol on dnoyeB .ecafretni kcabllac motsuc a naht rehtar
,stnevEenignEI
.setageleddedolpxE dnawolBoTtuobA eht enifeD
eralceD hcae fo selbairav rebmem .ssalcraC eht ni epyt etageled eht no snoitcnuf repleh etaerC
eht wolla tahtraC .selbairav rebmem etageled eht sdohtem eht yficeps ot rellac tcerroc
raC ssalc cilbup
{
.sepyt etageled eht enifeD //
oTtuobA diov etageled cilbup ;)gsm gnirts(wolB
;)gsm gnirts( dedolpxE diov etageled cilbup
.epyt etageled hcae fo selbairav rebmem enifeD //
;tsiLdaeDtsomla wolBoTtuobA etavirp
;tsiLdedolpxe dedolpxE etavirp
.sdohtem repleh gnisu stsil noitacovni eht ot srebmem ddA //
O diov cilbup )dohteMtneilc wolBoTtuobA(wolBoTtuobAn
} ;dohteMtneilc = tsiLdaeDtsomla {
)dohteMtneilc dedolpxE(dedolpxEnO diov cilbup
} ;dohteMtneilc = tsiLdedolpxe {
...
}
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 141
TINU 7
tageleD ,secafretnI kcabllaC e ,s a stnevE dn
7.1 Unde sr tanding C lla b ca k I tn erf ca es
sA uoy vah e es en in the rp ev uoi s hc apte ,r ni terfaces de if ne a beha oiv r that may b e
support de by vari uo s ty ep s ni your ys stem. dnoyeB using ni terfa ec s to est lba ish
mylop hpro ism, ni terfa ec s may also be u es d sa a c lla back mec ah nism. This
technique enables objects to engage in a two-way c vno ersa it on us gni a com nom
To tsulli rate ht e use of ca ll b ca k fretni a ec s, ’tel s pu date the now fam li iar Car epyt ni
such a way t ah t ti is a lb e to inf ro m t eh ac ll er wh ne ti is uoba t to pxe lode (the curre tn
ps e de is 10 lim se below t eh am ix mum ps ee d) and sah dedolpxe eht( rruc e tn deeps is
at ro voba e ht e xam imum s eep d). The dna r iece v e eseht e v w stne ill caf eb ilitat tiw de h
a cust i mo nte fr ac e named
I ignE n Ee ev tn s:
// ehT kcabllac .ecafretni
cilbup ecafretni stnevEenignEI
{
diov gnirts(wolBoTtuobA ;)gsm
gnirts(dedolpxE diov ;)gsm
}
vE e tn tni erfac se are n to ty cip a ll y im lp emented dir ce lt y by ht e object dir ce tly
tni e er sted in r ece iv ni g t eh ev ne ts, ub t ar ht er by a eh lper bo j ce t ac ll ed a sink obje tc .
Car pyt e in siht ac se) iw ll make ca ll s on ht e nis k ednu r
eht etairporppa secnatsmucric . ssA u em eht is nk ssalc si c lla ed raC E nev t iS nk, whi hc
mis ply rp tni s uo t t eh cni imo ng mes as ges to the oc nso el . yeB o dn th si point, our sin k
lliw sla o iam ntain a string ht at id tne ifies its friendly name:
// raC tneve knis .
cilbup ssalc kniStnevEraC : stnevEenignEI
{
etavirp gnirts ;eman
}{)(kniStnevEraC cilbup
T eh es nder of t eh ev ne ts (the
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 241
cilbup gnirts(kniStnevEraC aNknis em )
{ eman = ;emaNknis }
cilbup diov gnirts(wolBoTtuobA )gsm
{ }0{"(eniLetirW.elosnoC :gnitroper ,"}1{ ,eman m ;)gs }
cilbup diov gnirts(dedolpxE )gsm
{ }0{"(eniLetirW.elosnoC :gnitroper ,"}1{ ,eman ;)gsm }
}
Now taht uoy evah a s kni ejbo ct aht t implem tne s ht e e nev t i tn e afr ce, y uo r ne tx at sk
a referen ec to this s ni k into t eh Car pyt e. The aC r oh sdl no to t eh reference dna m seka
ac lls b ca k on t eh is kn hw en approp tair e. nI redro ot wolla ht e Car to niatbo a ecnerefer
ot the knis , we w li l en ed ot da d a pub il c he pl er mem reb to the aC r type ht at ew will
call A esivd () . L ki we si ,e if the caller wishes to deta hc from t eh ev ne t os cru e, ti m ya ca ll
ona th re helper met doh no t eh Car epyt nam de danU v (esi .) niF a ll y, ni or ed r to allow ht e
c la ler to r ge ister mu tl ip el ev ne t si kn s (for the up r op ses ht e Car won mainta ni s an
rA r iLya st ot tneserper hcae gnidnatstuo
// sihT raC dna rellac nac won etacinummoc
// gnisu eht stnevEenignEI .ecafretni
cilbup ssalc
{
// ehT tes fo detcennoc .sknis
tsiLyarrA skniStneilc = wen ;)(tsiLyarrA
// hcattA ro tcennocsid morf eht ecruos fo .stneve
cilbup diov stnevEenignEI(esivdA )knis
{ lc ei tn kniS s ddA. s( i ;)kn }
cilbup diov stnevEenignEI(esivdanU )knis
{ c eil tn kniS s meR. vo e is( kn ;) }
...
}
oT yllautca dnes eht ,stneve s’tel etadpu eht leccA.raC e etar () me ht od ot tareti e revo ht e
tsil fo snoitcennoc deniatniam yb eht siLyarrA t and fire the co rr ect on tifi ac it no w eh n
raC
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 341
pa propriate (note the Car cl sa s now mainta ni s a elooB an rebmem elbairav deman
aeDsIrac d ot tneserper eht s’enigne :)etats
// ecafretnI - desab tneve !locotorp
ssalc
{
...
// sI eht rac evila ro ?daed
loob ;daeDsIrac
cilbup diov tni(etareleccA )atled
{
// fI eht rac si ,'daed' dnes dedolpxE tneve ot hcae .knis
if( rac I eDs da )
{
stnevEenignEI(hcaerof e ni )skniStneilc
,yrroS"(dedolpxE.e siht rac si
}
esle
{
deepSrruc =+ ;atled
// dneS wolBoTtuobA .tneve
01(fi == deepSxam - )deepSrruc
{
vEenignEI(hcaerof stne e ni )skniStneilc
C"(wolBoTtuobA.e ar lufe !yddub noG na b wol ;)"!
}
deepSrruc(fi => )deepSxam
daeDsIrac = ;eurt
esle
"(eniLetirW.elosnoC \ deepSrruCt }0{ = ," ;)deepSrruc
}
}
raC
d ae d .. .");
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 441
ereH si mos e tneilc - edis ,edoc won gnikam u es fo a ac l abl ck in et fr ca e ot l netsi ot ht e
aC r events:
// ekaM a rac dna netsil ot eht stneve .
cilbup ssalc ppAraC
{
][gnirts(niaM diov citats )sgra
{
tneve sa secafretnI *****"(eniLetirW.elosnoC srelbane ;)"*****
raC 1c = wen ,"guBgulS"(raC ,001 ;)01
// ekaM knis tcejbo .
raC kniStnevE knis = wen ;)(kniStnevEraC
// ssaP eht raC a ecnerefer ot eht knis .
;)knis(esivdA.1c
// deepS pu siht( lliw reggirt eht )stneve .
tni(rof i = ;0 i < ;01 )++i
;)02(etareleccA.1c
// hcateD morf tneve ecruos .
;)knis(esivdanU.1c
aeR.elosnoC ;)(eniLd
}
}
7.2 Unde sr tanding eht N. ET Delega et Type
erofeB yllamrof d fe ni i gn . EN T del ge a et s, ’tel s ga ni a b ti of ep rs ep ct evi . iH storical yl
sp ae king, t eh Windows API m eka s f qer ue tn esu of C-style nuf ction op i tn ers to
rc ae te ne titi se et rmed c lla back uf cn it ons or simply bllac acks. Usi gn ac ll cab ks,
programm sre we er ba le to config ru e eno func it no ot report back to ( lac l b ca k)
an hto er nuf c it on in ht e cilppa a noit . ehT orp blem iw th s at n rad d C- ts yle ca abll ck
f cnu tions si taht yeht tneserper elttil erom naht a raw ad rd ess in me om ry. ,yllaedI
ca ll b ca ks luoc d eb derugifnoc ot edulcni a noitidd al epyt - efas amrofni t oi n us ch as t eh
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 541
num reb fo ( na d ty ep s fo ) p ra ame sret and ht e re ut rn va ul e (if a yn ) of the method
point de ot . ,yldaS iht s si t ton he sac e in t ar d ti ional ca ll back functio sn , and, as you
am y us spec ,t can th re fe ro e be a rf qe u ne t s ruo ec of gub ,s hard cras seh , a dn ot eh r
ur n emit disasters. Ne ev rthel se s, ac ll ab cks ra e useful enti seit . nI eht N. ET rF a ,krowem
skcabllac era ts ill sop s elbi , and their uf nc it onality is ca comp il shed in a much safer
and more obj ce t ro ei tn e d manner us ni g ed legates. nI e ess nc ,e a led egate is a pyt e-
as fe o jb ect t ah t niop ts ot a hton er htem od (or po ss ylbi multip el em t oh ds) ni t eh
appli ac t noi , hw ich can be kovni ed at a la et r t mi e . icepS fi ac yll s ep aking, a de gel ate
t epy am i tn ia ns th eer tropmi a tn seceip fo ni fo amr tion:
• ehT man e fo the tem oh d on hw ci h it kam es calls
• ehT argu em nts fi( any) of iht s me oht d
• ehT nruter ulav e fi( )yna of iht s me oht d
hW en ht e #C compiler processes del ge ate types, it ua t mo atical yl ge en rates a es aled
ing f or m syS t M.me ul acit s Dt le e ag te . This salc s (in con uj nction iw th its base
lc a ss , Sys .met D gele ate) orp iv des the n ce ess yra in rf astructure for t eh ed legate to h lo d
no to the il st fo met oh ds to eb i ekovn d
Bin Oyra p del age te usi gn li ad s xe.m e
7.3 ehT System M. ulticastDe agel et and System.D le e ag et Base C sal ses
,oS ehw n uoy ub ild a t epy using the C# led e ag te yek w dro , uoy i dn ir ce lt y ed clare a
cl ssa type that derives from yS mets . luM t aci s Dt ele g ta e . sihT class p vor id se
des ec nd ne st iw th access ot a list that
maintai den by the del ge ate t epy , as we ll as es veral dda iti onal methods (and a few
overl ao d de ope ar tors) to interact tiw h t eh invoca it on il st. Here are some es l ce t
mem eb rs of Sy ets m. luM t saci tD gele ate :
[Se air l azi lb ]e
lbup ci tcartsba ssalc etageleDtsacitluM etageleD :
{
// sdohteM
cilbup delaes edirrevo ][etageleD ;)(tsiLnoitacovnIteG
// srotarepo dedaolrevO
lc a ss ed r vi
at a later time. roF lpmaxe e, fi uoy nimaxe e the
noc ta sni t eh da rd es es s of t eh met doh s
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 641
citats cilbup loob rotarepo etageleDtsacitluM(==
citats cilbup loob rotarepo etageleDtsacitluM(=!
// sdleiF
etavirp rtPtnI ;tnuoCnoitacovni_
tcejbo etavirp ;tsiLnoitacovni_
}
yS stem.MulticastDel ge ate obtains idda tio lan uf nct anoi l yti from its par tne class,
yS stem.
Del age te . H re e is a p ra it al sn pa s oh t of t eh class defin oiti n:
S[ e lair azi elb , IssalC n fret a lC(ec as nIs ret fa yTec p tuA.e o lauD )]
ssalc tcartsba cilbup etageleD : ,elbaenolCI elbazilaireSI
{
// sdohteM
citats cilbup smarap(enibmoC etageleD ][etageleD ;)setageled
cilbup citats etageleD etageleD(enibmoC ,a etageleD ;)b
lautriv cilbup ][etageleD covnIteG ;)(tsiLnoita
etageleD citats cilbup etageleD(evomeR ,ecruos etageleD ;)eulav
etageleD citats cilbup etageleD(llAevomeR ,ecruos etageleD ;)eulav
// srotarepo dedaolrevO
cilbup citats loob rotarepo etageleD(== ,1d etageleD ;)2d
cilbup citats loob arepo rot (=! etageleD ,1d etageleD ;)2d
// seitreporP
cilbup ofnIdohteM dohteM { ;teg }
cilbup tcejbo tegraT { ;teg }
}
No ,w er me ebm r that you iw ll n eve r id rectly ed r vi e rf om th se e base cl sa ses a dn can
t py ci ally oc ncern oy urself no ly iw th ht e mem sreb cod um ne t de in baT le 8-1.
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 741
The S mi plest Po ss ible Delegate xE ample
D le age tes ac n t ne d to cause a great aed l of oc nf su i no w eh n en nuoc et red for the fi sr t
g te t eh b lla ,gnillor s’tel ekat a l koo ta a rev y simp el ex lpma e t ah t
lever sega
our yraniB Op d gele ate t epy . ereH is eht co etelpm c do e, iw ht na a yl sis to fol ol :w
etageleDelpmiS ecapseman
{
// sihT etageled nac tniop ot yna ,dohtem
// gnikat owt sregetni dna gninruter na
// regetni .
cilbup etageled tni tni(pOyraniB ,x tni ;)y
// sihT ssalc sniatnoc ohtem sd pOyraniB lliw
// tniop ot .
cilbup ssalc htaMelpmiS
{
cilbup citats tni tni(ddA ,x tni )y
{ nruter x + ;y }
cilbup citats tni tni(tcartbuS ,x tni )y
{ nruter x – ;y }
}
ssalc margorP
{
citats diov ][gnirts(niaM )sgra
{
*****"(eniLetirW.elosnoC lpmiS e etageleD elpmaxE ***** \ ;)"n
// etaerC a pOyraniB tcejbo taht
// stniop" "ot )(ddA.htaMelpmiS .
pOyraniB b = wen ;)ddA.htaMelpmiS(pOyraniB
// ekovnI )(ddA dohtem gnisu etageled .
01"(eniLetirW.elosnoC + 01 si ,"}0{ ,01(b ;))01
mit e. Th ,su to
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 841
Con los e eR. da L (eni ;)
}
}
}
...
}
llaceR taht TEN. setageled ekilnu( C- elyts noitcnuf )sretniop era efas epyt . ehT r ofe re, if
uoy tpmetta ot ap ss a ed el gate a method t ah t od es on t “mat hc t eh ap tt e nr ,” uoy
re ec vi e
lli u ,etarts sa s mu e the Si elpm M ta h ssalc senifed na lanoitidda
dohtem deman (rebmuNerauqS ):
cilbup ssalc htaMelpmiS
{
...
cilbup citats tni tni(rebmuNerauqS )a
{ nruter a * ;a }
}
iG ven ht at the Bi an Oyr p ed legate ac n no ly tniop to ohtem sd ht ta t ka e owt in et gers a dn
er ut rn
// !rorrE dohteM seod ton hctam etageled !nrettap
pOyraniB b = wen ;)rebmuNerauqS.htaMelpmiS(pOyraniB
A roM e Elaborate Del ge ate Exam lp e
oT lli u ts r eta a rom e ad nav ced su e of d ele gates, le ’t s b ge in by u dp a it ng the Car c al ss to
include wt o
a w sa h (is triD y ;) eht to h re tneserper s ehw ther eht c ra ni
seuq noit si ni deen fo a ti er tor ation ( ohs u oRdl t ta e). oT en ba le t eh object user t o
inte ar ct w ti h this en w state ad ta, aC r also def ni es s mo e
detadpu rotcurtsnoc . Here si the story so af r:
... // erA ew ni deen fo a ?hsaw deeN ot etator ?serit
etavirp loob si ;ytriD
etavirp loob ;etatoRdluohs
// artxE smarap ot tes .sloob
a oc m ip le- mit e err ro . T o
an in ,reget ht e llof o niw g doc e is i gell al a dn w li l not c mo pi :el
new B loo e na mem reb varia selb . hT e first is used to ed te mr i en hw e ht er
oy ur ua omot b li e is eud of r
lanoitidda seitreporp dna na
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 941
cilbup gnirts(raC ,eman tni ,xam tni ,rruc
loob ,raChsaw loob )seriTetator
{
...
ytriDsi = ;raChsaw
etatoRdluohs = ;seriTetator
}
cilbup loob ytriD
{
{teg nruter } ;ytriDsi
{tes ytriDsi = v ;eula }
}
cilbup loob etatoR
{
nruter uohs oRdl t eta ;
etatoRdluohs = ;eulav }
}
}
,woN sla o sa us me the aC r type en sts a new d le egate, raC De agel te:
// raC senifed tey rehtona etageled .
cilbup ssalc
{
...
// naC llac yna dohtem gnikat a raC sa
// a arap retem dna gninruter gnihton .
cilbup etageled diov raC(etageleDraC ;)c
...
}
He er , oy u have cr ae t de a del age te nam de CarD gele ate. ehT aC rD ele g ta e pyt e
erper s stne “some f cnu it ”no t ka i gn a aC r as a parameter a dn re rut n ni g iov d.
7.5 Understanding C# E ev nts
Dele ag tes a er fair yl interes it ng constructs in t ah t th ye en ba le two objects in mem yro
get{ set{
}
raC
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 051
to ne g ega ni a owt -way conver as it on. sA uoy yam ,eerga woh e ,rev wor gnik w ti h
de tagel es ni eht war od es ent lia a good amount of ob li erplate c do e (d fe ining t eh
ed l age t ,e declar ni g neces as ry mem reb vari ba les, a dn c gnitaer motsuc
noitartsigernu/noitartsiger )sdohtem . B ace u es the ab tili y for one bo ject ot ca ll kcab
ot ona ther o ejb ct is us ch a eh lpful oc nstruc ,t C# drub en fo us gni de setagel ni t eh
war . hW ne the com lip er p or cesses t eh event ke ,drowy uoy a er au mot atica ll y
rp ov di ed wi ht er gistrat noi na d nu er gist ar oit nmet sdoh sa we ll as yna n ce e ss ary
mem reb vari ba le of r yo ru del age te t py es. In this il gh ,t the ev tne uoy os me ty nip g time.
eD f ni ing an e ev nt is a t ow - ets p proce ss . riF s ,t uoy deen to enifed a de gel a et t tah
tnoc a ni s ht e oy u ed cl ra e ht e eve tn s ( su ing ht e C# neve t ek ya nutshe ll , def nini g a pyt e
t ah t ac n send events ne ta li s ht e fo oll wi gn ap tt e nr ( hs own in
pseudo- doc e):
ssalc cilbup stnevEfOredneS
{
cilbup etageled lavter A ss o taic ed eleD g ta e(a gr s);
cilbup tneve etageleDdetaicossA Nam fOe E ev nt;
...
}
ehT tneve s of ht e aC r pyt e liw l take t eh same an me as ht e p er vi uo s del ge ate s
(Ab tuo To olB w and Ex olp ded). hT e wen d ele gate to wh ci h t eh events are a oss cia et d lliw
eb cal el d aC rE nev t naH d el r. ereH a er eht ni i it al etadpu s ot ht e aC r typ :e
cilbup ssalc raC
{
// sihT etageled skrow ni noitcnujnoc htiw eht
// s'raC stneve .
etageled cilbup diov gnirts(reldnaHtnevEraC ;)gsm
// sihT rac nac dnes eseht .stneve
cilbup tneve reldnaHtnevEraC xE ;dedolp
cilbup tneve reldnaHtnevEraC ;wolBoTtuobA
...
}
eS n nid g an event ot the cal el r is as s mi ple as eps ci iyf ng ht e e ev nt yb na em sa we ll as
yna deriuqer para tem e sr as de denif yb eht ass taico ed de gel a et . oT erusne taht eht
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 151
llac er ah s deedni iger s deret htiw ,tneve uoy lliw naw t ot ehc ck eht ve e tn tsniaga a
nu ll
em oht d set. hT ese things bei gn said, eh re is th e
new eti ration of the raC ’ s ccA e arel t (e ) em t doh : cilbup diov tni(etareleccA )atled
{
// fI eht rac si ,daed erif dedolpxE .tneve
fi
{
fi edolpxE( d =! )llun
siht ,yrroS"(dedolpxE rac si daed .. . ;)"
}
esle
{
deepSrruc =+ ;atled
// tsomlA ?daed
fi
&&
{
uferaC"(wolBoTtuobA l !yddub noG an olb "!w ;)
deepSrruc( => )deepSxam
daeDsIrac = ;eurt
esle
"(eniLetirW.elosnoC - deepSrruC> = ,"}0{ ;)deepSrruc
}
}
W ti h this, oy u have oc nfi ug r de ht e car to dnes wo custom neve ts tiw hout t eh n ee d to
def ni e cus mot regis art t noi func oit ns. uoY lliw see the su age of this new autom bo ile
in uj st a mom ne t, but f ri s ,t let’s c eh kc ht e event archi et cture in a bit mo er deta li .
eulav erofeb gnikovni eht s’etageled
ac( Ir s daeD )
01( == deepSxam - deepSrruc wolBoTtuobA =! )llun
// llitS !KO fi
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 251
7. 6 ehT Advanced eK ywo dr s of C# A, Ca at lo o g C f # yek row sd
oT c esol th si ,retpahc y ll’uo enimaxe so em of eht om er se ot re ci C# ke owy rds:
• ehc cked/ dekcehcnu
• nu s fa e/sta lakc loc/fi ex d/ foezis
T el ,trats o t’ h tuo kcehc s o rp #C w o ceted citamotua sediv citemhtira fo noit o frev ol w
dna
snoitidnoc isu ng ht e ch kce ed dna unc ceh ked .sdrowyek
The dekcehc eK yword
As y uo are on doubt we ll awar ,e each numeri ac l data ty ep h sa a fix de u pp er and
lo ew r yam eb deniatbo rgorp a itamm c ylla u is gn eht M Vxa a ul e dna Min ulaV e p seitrepor ).
,woN nehw uoy era gnimrofrep tira h citem po e snoitar on a cificeps ,epyt ti si yrev
elbissop taht uoy yam yllatnedicca revo - wolf ht e mixam um s rot age of ht e epyt ,.e.i(
ngissa a eulav taht is retaerg naht eht mumixam )eulav ro wolfrednu ht e minim um
s garot e fo the pyt e e.i( ., sa s gi n a va ul e aht t is less ht na ht e im in m mu v la u )e . To k ee p
ni step w ti h the LC R, I iw ll refer to both of eht se p so si ib l eiti s coll ce ti ylev as lliw ,ees
dekcehc wolfrevo dna wolfrednu snoitidnoc tluser ni .metsyS O lfrev o ecxEw pt oi n pyt e. erehT
is no S U.metsy n lfred o ecxEw p oit n epyt ni eht b sa e ssalc ).seirarbil oT etartsulli eht ,eussi
emussa uoy evah detaerc owt tyB.metsyS e ty ep s a( #C ,)etyb hcae fo hcihw has been
ass gi en d a av lue t ah t is safely below t eh maximum 2( 55) . fI uoy erew to a dd ht e
eulav s of t eh se epyt s (c tsa i gn eht er us tl i gn i tn e reg as a
tyb e ,) uoy dluow emussa ht at ht e er s lu t wou dl eb ht e e ax ct sum fo ae ch me bm :re
an m apse ec hC e dekc hcnU e ekc d
{
ssalc margorP
{
citats diov ][gnirts(niaM )sgra
{
// wolfrevO eht xam eulav fo a .etyB.metsyS
xaM"(eniLetirW.elosnoC eulav fo etyb si ,".}0{ ;)eulaVxaM.etyb
niM"(eniLetirW.elosnoC eulav fo etyb si ,".}0{ ;)eulaVniM.etyb
1b = ;001
u dn erflow
etyb etyb etyb
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 351
2b = ;052
mus = 1b()etyb( + ;)2b
// mus dluohs dloh eht eulav ,053 revewoh ...
us"(eniLetirW.elosnoC m = ,"}0{ ;)mus
Con los e eR. da L (eni ;)
}
}
}
If you w re e to iv ew the uo tp tu of this ppa il ac it no , you gim ht eb s ru pris de ot f ni d t ah t
ta ni s t eh av l eu 49 ( ar th re ht na t eh xe pect de 053 ). T eh re nosa is s mi ple.
iG ve n
that a Sy ts me . tyB e ac n hold a v la ue no ly be wt een 0 and 255 (inclusiv ,e for a grand total
of 256 ls o st ), us m on w co tn a sni ht e
es e ,n if y uo take on corre itc ve course of a tc ion, ove fr wol ucco rs with tuo e pecx t noi . tA
,semit this eddih n revo f ol w am y cau es no ha mr hw a veost re in uoy r ejorp ct. tO he r
mit es, this loss of ad ta is oc mpletely u eccan tp a lb e. oT eldnah wolfrevo ro wolfrednu
noc d noiti s in yo ru appl ci ation, you have two o tp io sn . ruoY f ri st eciohc si ot vel re ega
ruoy stiw dna gnimmargorp slliks ot nah d el a ll wolfrevo noc d snoiti yllaunam .
ussA m gni
y uo erew deedni elba ot dnif e hca evo fr wol c idno t noi ni uoy r pr go ar m, uoy luoc d
evloser t eh p er vio su ove wolfr orre r as fo ll o sw :
// erotS mus ni na regetni ot tneverp wolfrevo .
etyb 1b = ;001
etyb 2b = ;052
tni mus = 1b + ;2b
Of c sruo e, the probl me with this et chnique is the s mi ple fact that you era muh a ,n and
best a tt empts m ya resu tl in errors ht at h va e es pac ed your ey se . viG ne t ,sih
C# pro iv des t eh kcehc ed k ye ow rd. hW en you wr pa a statem ne t (or a block o f
ts ate em n st ) iw thin the ocs pe of the ekcehc d key- word, eht C# com ip ler emits eps cific
CIL instructi sno that test of r overflow condi it o sn ht at may resu tl w eh n addi gn ,
mu lpitl y ni g, subtra itc ng, or dividing wt o numeric la ad ta ty ep s. fI na wolfrevo sah
co c ru red, the run it me w lli throw a etsyS m.O wolfrev E tpecx ion type. esbO rve ht e
niwollof g dpu a :et
s mu con
evo r wolf eulav (350 – 52 6 = 94). As you have ju ts
neve your
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 451
ssalc margorP
{
citats diov ][gnirts(niaM
{
// wolfrevO eht xam eulav fo a .etyB.metsyS
xaM"(eniLetirW.elosnoC eulav fo etyb si ,".}0{ ;)eulaVxaM.etyb
etyb 1b = ;001
etyb 2b = ;052
yrt
{
etyb mus = c kceh ed( 1b()etyb( + ;))2b
mus"(eniLetirW.elosnoC = ,"}0{ ;)mus
}
noitpecxEwolfrevO(hctac )e
{ noC s .elo irW et (eniL e M. se s )ega ; }
}
eH re, you wrap ht e add ti ion of b1 a dn b2 iw thin t eh epocs of t eh ehc c ek d ek y ow rd. If
you wish to fo cr e evo fr ol w ehc c nik g to co cur vo re a b kcol of c do ,e y uo c na int re tca
htiw eht ehc cked ek yword
yrt
{
dekcehc
{
etyb mus = 1b()etyb( + ;)2b
mus"(eniLetirW.elosnoC = ,"}0{ ;)mus
}
}
ac t O(hc rev olf cxEw ep it on e)
{
Con los e rW. ti e eniL ( M.e e ss ga e);
}
I ie n t edoc eht ,esac reh i tseuq n i no wil e eb l va ul at p rof de ossibl e ove fr lo c w no diti no s
ra sg )
as f llo o sw :
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 551
,yllacitamotua hcihw lliw reggirt na wolfrevo noitpecxe fi deretnuocne .
tteS gni rP jo e tc wide Overflow Che ikc ng
No ,w if uoy ra e cr ae it gn an ppa il ac oit n t ah t sho dlu ven er a ll ow sil ne t overflow to
oc uc r, you m ya nif d oy urs fle in the ann iyo ng pos iti on of wrapp ni g un me or us il en s
of ekcehc d k ye w ro d. As na a tl erna it ve, the C# comp li er su opp rts t eh / cehc ked flag.
hW en enabl de , allof y uo r ar ti hme it c will be e av l au ted of r overflow w ti uoh t t eh een d
to m eka use of th e #C ekcehc d k ye wo dr . fI wolfrevo ah s eb en d si co ev red, you wi ll s llit
cer e vi e a run it me oT elbane siht f gal nisu g lausiV S ut d oi 5002 , o nep ruoy s’tcejorp
ytreporp egap a dn ilc ck eht Adv ecna d ub tt on no t eh Bu dli t ba . F or m the er su itl ng
golaid ob x, sel ce t the “Check for tira hmet ci evo fr ednu/wol fr ”wol hc e kc xob
7.7 uB li ding a uC stom I dn exer
As rp o rg a emm rs, we are ev ry fa im liar with the proce ss of accessing id s rc ete ti ems
tnoc ained iw thin a standard ar ar y su i gn t eh in ed x po erator, for e ax mple:
// eralceD na yarra of sregetni .
][tni stnIym = { ,01 ,9 ,001 ,234 ;}4789
// srexednI wolla uoy ot ssecca smeti ni na ekilyarra .noihsaf
cilbup ssalc
{
citats diov ][gnirts(niaM )sgra
{
*****"(eniLetirW.elosnoC nuF htiw srexednI ***** \ ;)"n
// emussA eht egaraG epyt sah na rexedni .dohtem
egaraG toLrac = wen ;)(egaraG
// ddA emos srac ot eht egarag gnisu .rexedni
]0[toLrac = wen ,"eeFeeF"(raC
]1[toLrac = wen ,"reknulC"(raC
]2[toLrac = wen ,"yppiZ"(raC
// woN niatbo dna yalpsid hcae meti gnisu .rexedni
.
margorP
20 )0 ; 9 )0 ;
03 ;)
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 651
tni( i = ;0 i < ;3 )++i
raC"(eniLetirW.elosnoC :rebmun ,"}0{ ;)i
Con los e rW. ti e eniL ( aN" me:
oC n elos rW. eti eniL ( aM" x
Con los e rW. ti e eniL ();
}
Con los e eR. da L (eni ;)
}
}
As you can see, indexers beh va e much li ek a custom loc el c it on sup op rt ni g the
IEn emu r ota r and IE emun r lba e interfaces. T eh ylno rojam reffid e ecn si tht rehtar ht an
gnissecca t eh tnoc e tn s usi gn elloc c noit of a tu o om b eli s uj st il ek a s at ndard ra ra .y you
configure t eh raG age lc ass o( r yna c al ss /structure) nA dni e ex r is r pe resented sa a
s il ghtly mang el d C# pr epo rty. In ti s s mi pl se t for ,m na i dn exer is cr ae ted using ht e
th si [] sy atn x. ereH si eht tnaveler etadpu ot eht
Gar ga e type:
// ddA eht rexedni ot eht gnitsixe ssalc noitinifed .
cilbup ssalc egaraG : elbaremunEI // hcaerof noitareti
{
...
// esU tsiLyarrA ot niatnoc eht raC .sepyt
etavirp tsiLyarrA yarrArac = wen ;)(tsiLyarrA
// ehT rexedni snruter a raC desab no a laciremun .xedni
cilbup raC tni[siht
{
// etoN tsiLyarrA sah na rexedni sa !llew
teg { nruter ;]sop[yarrArac)raC( }
tes { ]sop[yarrArac = eulav }
}
}
// esU tnuoC.tsiLyarrA ?ytreporp !epoN
sraC"(eniLetirW.elosnoC ni :kcots }0{ ," .toLrac uoC nt ;)
rof {
}0{ ," c ra [toL i .] NteP am )e ;
:deeps ,"}0{ ca oLr t .]i[ C pSrru e )de ;
pos]
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 751
oT us pport this f cnu it ona til y, y uo wo dlu deen to dda oy ur wo n uoC nt porp e ytr ot eht
Gar ga e
cilbup ssalc :egaraG elbaremunEI
{
...
// noitageled/tnemniatnoC in noitca ecno .niaga
cilbup tni tnuoC { teg { nruter ;tnuoC.yarrArac } }
}
t py e, dna ed l age te cca ordi gn ly:
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 851
TINU -8
gnidnatsrednU eht tamroF fo a TEN. ylbmessA
8.1 Problems with Classic COM Bina ir es
. TEN ilppa c ta i sno a er urtsnoc c det yb eip cing to teg h re a yn un bm er of a ss emblies .
miS ply up ,t na a ss embly is a ve sr ione ,d es lf-d se cribing binary f eli ho ets d by t eh CLR.
seilbmessa h eva axe c ylt eht s ma e if el e netx s snoi
( xe.* e or .* d ll ) sa pre iv o su Win32 binaries ev yr l tti le in mmoc on nu der the hood. Thus,
ot set t eh stage of r the ni formati no ot moc ,e le ’t s ponder emos of the b ene fits
provided by ht e a ss e bm ly format.
essA m seilb etomorP C edo esueR
As oy u vah e neeb bu gnidli ruoy elosnoc noitacilppa s evo r ht e verp i uo s hc a etp r ,s it
am y evah demees taht lla fo eht a ilpp ca snoit ’ f nu tc noi ality was niatnoc de wi iht n ht e
elbatucexe lbmessa y uoy rew e noc rts gnitcu . In aer til y, your pa ilp ac it no s ew re
lever ga ing un m ore us t py es noc tain de ihtiw n t eh a wl sya m cs orl bi . ld l (recall that the C#
oc mpiler refer ne ces ms oc r il b.dll tua o itam ac ll y ,) sa llew sa Sy .mets W wodni s .smroF. dll. sA y uo
may nk wo , a oc de library (also term de a cl sa s il brary) is a * ld. l t tah atnoc i sn t py se
i etn n ded to be esu d by txe e nr al itacilppa ons. W eh n you are rc eating xe ecutab el
sa sembl sei , you liw l on d uo bt be lever ga ing numerous system-supplied a dn
uc s ot m code l bi raries as y uo create the noitacilppa ta dnah . oD be a raw ,e howe ev r,
that a c do e l bi r ra y en de on t t ka e a * ld. l lif e e netx s noi . tI is perf ce lt y p so s lbi e for an
ucexe t ba le assembly to m eka u es of types defi den w ti nih an xe ter an l la so be
c no s redi ed a “c do e arbil r ”.y
8.2 Unde sr tanding eht F ro mat of a .N TE A ss embly
woN taht ev’uoy rael n de tuoba lareves stifeneb pr divo ed by ht e .NET sa se lbm y, ’tel s
tfihs raeg s dna g te a be tt er di ae fo how an a ess lbm y is com op es d dnu er ht e dooh .
tS ruc rut a ll y aeps ik gn , a TEN.
tnemele s:
• A iW 3n 2 lif e heade r
,woN de ps i et the af ct t ah t . EN T
assembly ( d.* ll or * e. xe) tsisnoc s of ht e fol gniwol
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 951
• A redaeh elif RLC
• CI edoc L
• Type metadata
• nA ylbmessa inam fest
• tpO noi al e ddebm ed r se ources
elihW eht tsrif t ow le e stnem eht( 23niW dna RLC )sredaeh era skcolb fo atad taht uoy
nac yllacipyt ,erongi yeht od evresed emos br fei noitaredisnoc . sihT gnieb ,dias na
evo r weiv fo hcae tnemele swollof .
T eh Win 23 F eli Header
T eh Wi 23n f li e aeh d re esta ilb shes the f ca t ht at the assembly nac eb ol aded na d
m na i up lated yb ht e Wi odn sw fa lim y of o itarep ng sy ts e sm . Th si redaeh tad a la so
seifitnedi eht dnik fo noitacilppa elosnoc( - ,desab IUG - sab e ,d ro *.dll code l bi rary) to
eb oh s et d by the Wi odn sw operating syste .m
8.3 uB li ding a dn Consuming a Sin lg e-F li e A ss embly
T ecorp eht nigeb o pmoc fo ss r oy ,seilbmessa TEN. fo dlrow eht gnidnehe u’ll fi sr t rc ea a et
ssa e bm yl (named Car iL arb ry) that contains a small set of pu lb ic t py es. oT dliub a
doc e l bi ar yr us gni Visual tS udio 2005, is mply se el ct the Cla ss Library pro ej c t
ow kr s ap ce T eh desi ng of your ua tom bo li e library eb ig ns tiw h an a sb tract ab se c al ss
a bmun er of rp ot tce ed data me bm ers opxe sed rht o gu h cus mot propert ei s. ihT s ssalc
has a s gni le rtsba act me oht d n ema d bruT o sooB t(), w cih h m seka esu fo a c su tom
e mun are t oi n ( nE g Seni t ta e) nitneserper g eht cu rr e tn c noitidno fo rac eht ’ :enigne s
gnisu ;metsyS
ecapseman yrarbiLraC
{
// stneserpeR eht etats fo eht .enigne
cilbup mune etatSenignE
{ ,evilAenigne daeDenigne }
// ehT tcartsba esab ssalc ni eht .yhcrareih
cilbup tcartsba ssalc raC
{
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 061
rp detceto gnirts ;emaNtep
detcetorp trohs ;deepSrruc
detcetorp trohs ;deepSxam
detcetorp etatSenignE etatSnge = ;evilAenigne.etatSenignE
cilbup tcartsba diov ;)(tsooBobruT
cilbup }{)(raC
cilbup gnirts(raC ,eman trohs ,xam trohs )rruc
{
emaNtep = ;eman Sxam deep = ;xam deepSrruc = ;rruc
}
cilbup gnirts emaNteP
{
teg { nruter ;emaNtep }
tes { emaNtep = } ;eulav
}
cilbup trohs deepSrruC
{
teg { nruter ;deepSrruc }
} ;eulav = deepSrruc { tes
}
cilbup trohs deepSxaM
{ teg { nruter ;deepSxam } }
tSenignE cilbup etatSenignE eta
{ teg { nruter ;etatSnge } }
}
}
woN ssa u em ht at y uo vah e two cerid t d se ec n tned s of ht e aC r epyt n dema aViniM n na d
SportsCar. E hca overrides ht e abs rt ca t Tu oBobr o (ts ) em t doh ni an pa rp opriate
ennam r.
gnisu ;metsyS
gnisu F.swodniW.metsyS ;smro
ecapseman yrarbiLraC
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 161
{
cilbup ssalc raCstropS : raC
{
cilbup {)(raCstropS }
cilbup gnirts(raCstropS ,eman trohs ,xam trohs esab:)rruc ,eman( ,xam {)rruc }
diov edirrevo cilbup )(tsooBobruT
{
gnimmaR"(wohS.xoBegasseM ,"!deeps retsaF" si tteb re .. . ;)"
}
}
cilbup ssalc naViniM : raC
{
cilbup {)(naViniM }
cilbup gnirts(naViniM ,eman trohs ,xam trohs esab:)rruc ,eman( ,xam {)rruc }
diov edirrevo cilbup )(tsooBobruT
{
// snaviniM evah roop obrut !seitilibapac
= etatSnge enigne.etatSenignE ;daeD
emiT"(wohS.xoBegasseM ot llac ,"AAA ruoY" rac si ;)"daed
}
}
}
.8 4 A C# Cl ei nt App acil tion
tA siht tniop uoy nac liub d ruoy tneilc noitacilppa ot ekam esu fo eht lanretxe sepyt .
U adp te ruoy ni it lai C# lif e as so:
gnisu ;metsyS
// t'noD rof teg ot 'esu' eht yrarbiLraC !ecapseman
gnisu ;yrarbiLraC
ecapseman tneilCraCprahSC
{
cilbup ssalc tneilCraC
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 261
{
][gnirts(niaM diov citats )sgra
{
// ekaM a strops rac .
raCstropS repiv = wen ,"repiV"(raCstropS ,042 ;)04
vip .re T bru Bo o (tso ;)
// ekaM a .navinim
naViniM vm = wen ;)(naViniM
mv. ruT b oBo so t )( ;
Con los e eR. da L (eni ;)
}
}
}
This oc de looks just like the other app il ac it sno de ev l po ed thus far. The only point of
in et rest is th ta eht #C cl ei nt application si now making use of t epy s ed fin de iw thin a
rapes a et uc stom ssa embly. oG eha ad and nur oy ur program. As oy u w uo ld e px e ,tc
ht e
exe cu oit n of th si program results in ht e dis lp ay of av r suoi me gass e xob se .
5.8 gnidliuB a lausiV cisaB TEN. tneilC noitacilppA
To lli su trate ht e l augna ge- songa it c a itt t edu fo ht e N. ET platfor ,m le ’t s cr ae te na hto er
con os le a pp lic noita (Vb eN tCar ilC ent), ht is time u is gn Visu la Basic .N TE (see Fi ug re
11 -
t eh p or ject, es t a refe er n ec to Ca rbiLr ar .y dll su ing t eh Add
Refere cn e dialog box. stropmI yrarbiLraC
eludoM 1eludoM
buS )(niaM
dnE buS
dnE eludoM
toN ice that the M (nia ) htem do si defined iw thin a Visual Basic TEN. Modu el t py e
cihw( h has noth gni ot od w ti h a *. en t om dule elif of r a um tl if li e a ess ylbm ) . Mod lu es a er
1 )0 . nO ce y uo have cre ta de
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 361
si pm ly a Visual B sa ic
oc tn ain on yl static me ht ods. oT d evir
th si op int home, eh re wo dlu be t eh as me construct ni C# :
// A BV TEN. 'eludoM' si ylpmis a delaes ssalc
// gniniatnoc citats sdohtem .
cilbup delaes ssalc 1eludoM
{
cilbup citats diov )(niaM
{
}
}
nI a yn case, to exe cr i es eht niM i aV n dna stropS Car yt sep u nis g the syn at x o f siV u la B cisa
. ,TEN etadpu ruoy niaM () me doht as so:
buS )(niaM
*****"(eniLetirW.elosnoC nuF htiw lausiV cisaB TEN. )"*****
miD naViniMym sA weN )(naViniM
myM ini V .na uT r oBob o (ts )
miD raCstropSym sA weN )(raCstropS
myS rop t aCs .r T obru Bo so t()
Con los e eR. da L (eni )
dnE buS
hW en y uo compile and ur n your pa plication, you wi ll o cn e again find a ser ei s of
me ss age b xo es id ps l eya d.
6.8 gnirolpxE eht s’yrarbiLraC sepyT
R ace ll t tah hw ne you eg nerate a str gno name for na assembly, t eh ne tire pub il c ek y
is r ce ord de ni eht ssa e ylbm ma in f tse . On a relat de on te, w neh a c il ne t referenc se a
ma in fest records a con ed ns de h hsa v la ue fo the full up b il c key, denoted by the
. up bl ekci y ekot n tag.
. nretxe ylbmessa yrarbiLraC
{
. nekotyekcilbup = 12( E9 3F 08 9C 43 A8 )83
. rev 0:0:0:1
. EN T s roh th na d n to a oit n of r de if nin g a es aled c al ss that ca n
#C TEN.dnagnimargorP C01 67S 1
o.tpeD Cf TIBJS,ES egaP 461
}
fI you co rapm e the v la ue of ht e public key token er co dr de in the c eil nt am nifest wit h
the pub il c key token value sh nwo in the GAC, you will find a ed ad-on m ta ch. llaceR
aht t a ilbup c yek stneserper eno as tcep of ht e ts ro gn ly nam de assem lb s’y di e tn i yt .
viG ne ,siht eht CLR lliw only load ev sr noi .0.1 0 0. of na a ess ylbm na dem aC biLr rar y
ht at h sa a cilbup yek taht c na eb ha hs ed nwod to ht e av lue 21 E9 F 083 C 439 8A38. If the
CLR does not if nd an a ss embly m ee ting this descri tp ion in the AG C (and ylbmessa
deman yrarbiLraC ni ht e lc ie tn s’ d eri c ot ry), a eliF N uoFto nd itpecxe on i s
ht rown.