1

C# Programming and
.NET Concepts

8at|sh ß ßasapur
E-ma||: sat|sh.basapur©yahoo.com
2
ooks for Reference
C# ard lre .NET P|allo(r |2 Ed)
Ard(eW T(oe|ser
0(earlecr Puo||cal|ors
V|c(osoll \|sua| C# .NET
V|c|e w||||ars
V|c(osoll P(ess
3
Chapter - 1
Tre Pr||osopr ol .NET
4
-ectives
&rde(slard|rd lre p(ev|ous slale ol alla|(s
Tre .NET 3o|ul|or
u||d|rd o|oc|s ol .NET P|allo(r
CLR. CT3. ard CL3
.NET ase C|ass L|o(a(|es
5
&nderstanding the
previous state of affairs
s a 6|w|n32 ! !rogrammer
l |s corp|ex
C |s a sro(l/ao(upl |arduade
Varua| rero( raradererl. ud| po|rle( a(|lrrel|c. ud| srlacl|c
corsl(ucls
Nol a 00 |arduade
s a 6++|HF6 !rogrammer
Rool |s C
C÷÷ W|lr VFC |s sl||| corp|ex ard e((o(-p(ore
s a Vß ô !rogrammer
Nol a corp|ele 00P |'0ojecl-aWa(e¨) - wr
0oesr'l suppo(l |rre(|larce
No ru|l|lr(ead|rd
No pa(arele(|zed C|asses
LoW-|eve| AP ca||s a(e corp|ex
6
Previous state of affairs.
s a Java|J2EE !rogrammer
&se ol Java l(orl-lo-oac| du(|rd deve|oprerl cc|e
No |arduade l(eedorl
Pu(e Java |s rol su|lao|e lo( d(apr|c |rlers|ve p(oo|ers |E.d. 30
dare)
No c(oss-|arduade |rled(al|or
s a 60H !rogrammer
Corp|ex c(eal|or ol C0V lpes
Acl|ve Terp|ale L|o(a( |ATL)
Fo(ced lo corlerd W|lr o(|ll|e/l(ad||e (ed|sl(al|or erl(|es
0ep|orerl |ssues
7
.NET SoIution
Fu|| |rle(ope(ao|||l W|lr ex|sl|rd w|r32 Code
Ex|sl|rd C0V o|ra(|es car |rle(ope(ale W|lr .NET o|ra(|es
Corp|ele ard lola| |arduade |rled(al|or
3uppo(ls c(oss-|arduade |rre(|larce. excepl|or rard||rd. ard deoudd|rd
Corror (url|re erd|re sra(ed o a|| .NET aWa(e |arduades
A oase c|ass ||o(a(
ood oojecl rode| used o a|| .NET aWa(e |arduades
No ro(e C0V p|uro|rdl
No C|assFaclo(. &rKroWr. 0|spalcr. elc.
T(u| s|rp||l|ed dep|orerl rode|
No reed lo (ed|sle( a o|ra( ur|l |rlo lre ssler (ed|sl(
A||oWs ru|l|p|e ve(s|ors ol sare ¯.d||
8
.NET Framework
perating System perating System
Common Language Runtime Common Language Runtime
ase CIass Li-rary ase CIass Li-rary
AD.NET and XML AD.NET and XML
ASP.NET ASP.NET
We- Forms We- Services We- Forms We- Services
Windows Windows
Forms Forms
Common Language Specification Common Language Specification
V V C++ C++ C# C# JScript JScript J# J#
V
i
s
u
a
I

S
t
u
d
i
o
.
N
E
T
V
i
s
u
a
I

S
t
u
d
i
o
.
N
E
T
9
uiIding Iocks of .NET
CLR |Corror Larduade Rurl|re)
To |ocale. |oad. ard rarade .NET lpes
Auloral|c rero( raradererl. |arduade |rled(al|or. ard lpe
salel
CT3 |Corror Tpe 3sler)
0esc(|oes a|| poss|o|e dala lpes ard p(od(arr|rd corsl(ucls
suppo(led o lre (url|re
CL3 |Corror Larduade 3pec|l|cal|or)
A sel ol (u|es lral del|res a suosel ol lpes ard spec|l|cal|ors
10
CLR (Common Language Runtime)
CLR s|ls or lop ol 03 |sare as J\V ol Java)
CLR |oads rodu|es corla|r|rd execulao|es ard execules lrer
Code ra oe raraded o( urraraded
Varaded code cors|sls ol |rsl(ucl|ors |r pseudo (ardor code ca||ed CL |Corror
rle(red|ale Larduade). CL |rsl(ucl|ors a(e JT corp||ed |rlo ral|ve racr|re
code al (url|re
JT corp||ed relrods (es|de |r cacre url|| lre app||cal|or's ||le l|re
Advarlades ol raraded code: lpe salel. rero( raradererl. ard code
ve(|l|cal|or secu(|l
CLR car l(ars|ale code l(or C#. J#. C. C÷÷. \. ard Jsc(|pl |rlo CL.
CLR doesr'l |aurcr a reW p(ocess lo( eve( app||cal|or. l |aurcres ore p(ocess
ard rosls |rd|v|dua| app||cal|ors |r app||cal|or dora|rs
11
6ommon Language Runt|me
ase CIass Li-raries
Ercapsu|ales va(|ous p(|r|l|ves |||e: lr(eads. l||e 0. d(apr|ca|
(erde(|rd. ard olre( |rle(acl|or W|lr lw dev|ces
l a|so p(ov|des: dalaoase rar|pu|al|or. XVL |rled(al|or. weo-erao|ed
l(orl-erd.
CTS
CLS
Base Class Libraries
Threading
Data Access
File IO XML/SOAP
GUI
12
C#
A|rosl sare as Java
No po|rle(s (ecu|(ed
Auloral|c rero( raradererl |No 'de|ele')
Erure(al|or. c|ass. sl(uclu(e. elc.
0pe(alo( ove(|oad|rd a||oWed
rle(lace-oased p(od(arr|rd lecrr|cues
Ass|dr cra(acle(|sl|cs lo lpes |sare as C0V 0L)
C# car p(oduce code lral car (ur or| or .NET erv|(orrerl
|ur|||e C0V se(ve( o( w|r32 AP)
13
&nderstanding Assem-Iies
w|rdoWs app||cal|ors rave deperderc|es or ore o( ro(e
0LLs
Trese 0LLs ra corla|r C0V c|asses (ed|sle(ed |r 3sler
(ed|sl(
wrer lrese corporerls a(e updaled. app||cal|ors ra
o(ea| - '0LL re||'
3o|ul|or: .NET Assero||es
C# .NET corp||e( doesr'l dere(ale racr|re code.
l |s corp||ed |rlo ¨assemb|y¨
14
Assem-Iy
ntermed|ate Language [L|6L}:
3are as l|(sl pass ol corp||e(. l car'l oe execuled ||l |s rol |r o|ra(
lo(ral)
Hetadata
0esc(|oes lre assero| corlerls
No reed lo( corporerl (ed|sl(
Eacr assero| |rc|udes |rlo(ral|or aooul (ele(erces lo olre( assero||es
E.d. l ou rave a c|ass ca||ed Ca( |r a d|ver assero|. lre lpe reladala
desc(|oes Ca('s oase c|ass. Wr|cr |rle(laces a(e |rp|ererled o Ca(.
desc(|pl|or ol reroe(s ol Ca(.
C# source code C# .NET Compiler
Assembly
Metadata
IL
+ =
15
Assem-Iy.
wrer CLR |oads ou( app||cal|or. |l exar|res ou( p(od(ar's reladala lo
|roW Wr|cr exle(ra| assero||es a(e (ecu|(ed lo( execul|or
!r|vate assemb||es
&sed o s|rd|e app||cal|or
s rol sra(ed
Vosl p(ele((ed relrod
8hared assemb||es
rlerded lo( ru|l|p|e app||cal|ors
|ooa| Assero| Cacre
Han|fest
Tre reladala ol assero||es: ve(s|or. ||sl ol exle(ra|| del|red assero||es.
elc.
16
ExampIe of CIL
6L s|ts above a spec|f|c comp||er [6#, J#, etc.}
The assoc|ated comp||er em|ts 6L |nstruct|ons
us|rd 3sler:
rarespace Ca|cu|alo(
[
puo||c c|ass Ca|cApp
[
puo||c slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
Ca|c c = reW Ca|c|):
|rl ars = c.Add|10. 81):
Corso|e.w(|leL|re|ars):
Corso|e.ReadL|re|):
}
}
puo||c c|ass Ca|c
[
puo||c |rl Add||rl x. |rl )
[ (elu(r x ÷ : }
}
}
|| .NET aware |anguages
em|t same 6L |nstruct|ons
17
CIL of Add() Method
.relrod puo||c r|deos|d |rslarce |rl32 Add||rl32 x.
|rl32 ) c|| raraded
[
// Code s|ze 8 |0x8)
.raxslac| 2
.|oca|s |r|l |[0ì |rl32 C3S00000003S00000000)
L_0000: |da(d.1
L_0001: |da(d.2
L_0002: add
L_0003: sl|oc.0
L_0001: o(.s L_000ê
L_000ê: |d|oc.0
L_000Z: (el
} // erd ol relrod Ca|c::Add
18
Manifest
.assemb|y extern mscor||b
[
.puo||c|elo|er = |Z ZA 5C 5ê 19 31 E0 89 ) // .z\\.1..
.ve( 1:0:5000:0
}
.assero| Corso|eApp||cal|or1
[
.rasr a|do(|lrr 0x00008001
.ve( 1:0:2058:39833
}
.rodu|e Corso|eApp||cal|or1.exe
// V\0: [51E1F31-C00-1AEê-C90-F9A19ZêZ95F0}
.|radeoase 0x00100000
.suossler 0x00000003
.l||e a||drrerl 109ê
.co(l|ads 0x00000001
// rade oase: 0x0Z0o0000
External
Assembly
19
CIL to Execution
J|lle( corp||es CL |rsl(ucl|ors or lre l| |rlo co((espord|rd
racr|re code ard cacre |l. Tr|s |s uselu| lo( rol (ecorp|||rd.
|l lre sare relrod |s ca||ed ada|r
CIL
JIT
Desktop
Pocket PC
Server
20
Common Type System (CTS)
CT3 |s a lo(ra| spec|l|cal|or lral desc(|oes roW a
d|ver type rusl oe del|red lo( CLR
CT3 C|ass Tpe
CT3 3l(uclu(e Tpe
CT3 rle(lace Tpe
CT3 Erure(al|or lpe
CT3 0e|edale lpe
21
CTS CIass Type
3are as C÷÷ c|ass
Car corla|r reroe(s: relrods. p(ope(l|es. everls.
elc.
3uppo(l lo( aosl(acl reroe(s lral del|re a
po|ro(pr|c |rle(lace lo( de(|ved c|asses
Vu|l|p|e |rre(|larce |s rol a||oWed
22
CTS CIass Characteristics
sea|ed - sea|ed c|asses car'l lurcl|or as oase c|asses
mp|ement any |nterfaces - Ar |rle(lace |s a co||ecl|or ol
aosl(acl reroe(s
bstract or 6oncrete - Aosl(acl c|asses |lo del|re
corror oerav|o(s lo( de(|ved) car'l oe c(ealed d|(ecl| oul
corc(ele c|asses car.
V|s|b|||ty - v|s|o|||l all(|oule lo |roW Wrelre( exle(ra|
assero||es car use |l.
23
6T8 8tructure types
3are as C/C÷÷
0e(|ved l(or a corror oase c|ass 3sler.\a|ueTpe
6T8 nterface Type
3are as pu(e aosl(acl c|ass ol C÷÷
A desc(|pl|or ol Wo(| lral a de(|ved c|ass car pe(lo(r
3|r||a( lo a c|ass. oul car reve( oe |rslarl|aled
6T8 Enumerat|on type
To d(oup rare/va|ue pa|(s urde( a spec|l|c rare
0elau|l 3lo(ade: 3sler.rl32 |cou|d oe crarded)
6T8 0e|egate type
3are as C's lurcl|or po|rle( |3sler.Vu|l|casl0e|edale)
&selu| lo( everl rard||rd |A3P .NET)
24
Intrinsic CTS Data Types
.NET ßase Type 6# Type
3sler.le le
3sler.3le sole
3sler.rl1ê sro(l
3sler.rl32 |rl
3sler.rlê1 |ord
3sler.&rlê1 u|ord
3sler.3|rd|e l|oal
3sler.0ouo|e douo|e
3sler.0ojecl oojecl
3sler.3l(|rd sl(|rd
3sler.oo|ear ooo|
25
Common Language Specification
(CLS)
3el ol du|de||res lral desc(|oe lre r|r|ra| ard corp|ele sel
ol lealu(es a d|ver .NET aWa(e corp||e( rusl suppo(l
C# uses + lo( corcaleral|or Wre(eas \ .NET uses &
C# a||oWs ope(alo( ove(|oad|rd oul \ .NET does roll
Tre vo|d lurcl|ors ra d|lle( |r srlax:
' \ .NET // C#
Puo||c 3uo Foo|) puo||c vo|d Foo|)
'... [ ... }
Erd 3uo
26
CLS CompIiance
6# Type 6L8 6omp||ance
ole Yes
sole No
sro(l Yes
|rl Yes
|ord Yes
u|ord No
l|oal Yes
douo|e Yes
oojecl Yes
sl(|rd Yes
cra( Yes
ooo| Yes
27
ExampIe
puo||c c|ass Ca|c
[
|| 6L8 comp||ant
puo||c |rl Add||rl x. |rl )
[ (elu(r x ÷ : }
|| Not 6L8 comp||ant
puo||c u|ord Add|u|ord x. u|ord )
[ (elu(r x ÷ : }
}
0rce a relrod |s CL3 corp||arl. lrer a|| lre .NET aWa(e |arduades
car |rle(acl W|lr lral |rp|ererlal|or
28
CLR
.NET
Source
Code
Base Class
Libraries
(mscorlib.dll)
.NET Execution Engine
Class Loader
Jitter
Platform
Specific code
Execute
.NET Compiler
DLL or EXE
(CIL)
mscoree.dll
mscoree.dll
MicroSoft Common
Object Runtime Execution Engine
29
.NET Namespace
VFC. Java. \ ê.0 rave p(edel|red sel ol c|asses:
C# doesr'l
C# uses rarespace corcepl
Ar |arduade la(del|rd lre .NET (url|re ra|es use
ol lre sare rarespaces ard sare lpes as C#
3sler |s lre (ool rarespace
30
ExampIe in C#
us|rd 3sler:
puo||c C|ass VApp
[
puo||c slal|c vo|d Va|r|)
[
Corso|e.w(|leL|re|¨le||o wo(|d¨):
}
}
System Namespace
Console class in
System Namespace
31
ExampIe in V .NET
rpo(ls 3sler
Puo||c Vodu|e VApp
3uo Va|r|)
Corso|e.w(|leL|re|¨le||o wo(|d¨)
Erd 3uo
Erd Vodu|e
32
ExampIe in Managed C++
#us|rd <rsco(||o.d||>
us|rd rarespace 3sler:
vo|d Va|r|)
[
Corso|e::w(|leL|re|¨le||o wo(|d¨):
}
33
SampIe .NET namespaces
8ystem p(|r|l|ve lpes. da(oade co||ecl|or. elc
8ystem.6o||ect|ons Corla|re( oojecls: A((aL|sl. 0ueue. elc.
8ystem.0ata
8ystem.0ata.6ommon
8ystem.0ata.0|e0b
8ystem.0ata.8q|6||ent
Fo( 0alaoase rar|pu|al|ors A00 .NET
8ystem.0 l||e 0. oulle(|rd. elc.
8ystem.0raw|ng
8ystem.0raw|ng.20
0÷ p(|r|l|ves. o|lraps. lorls. |cors. elc.
8ystem.Thread|ng Tr(eads
34
Demo
Corso|e App||cal|or
w|rdoWs App||cal|or
(apr|cs
35
End of Chupter 1 Chupter 1
36
37
Chapter 2
ßu||d|ng 6# pp||cat|ons
38
-ectives
6ommand L|ne 6omp||at|on
V|sua| 8tud|o .NET 0E
Referenc|ng Externa| ssemb||es
0emo - Hu|t| Language
39
Configuration for csc
R|drl C||c| V Corpule( P(ope(l|es Advarced
Erv|(orrerl va(|ao|es 0ouo|e C||c| Palr
Add lre palr Wre(e csc.exe |s |oaded
C:\wN00w3\V|c(osoll.NET\F(areWo(|\v1.1.1322
40
Command Line CompiIation
6omp|||ng s|ng|e source f||e
csc /la(del:exe TeslApp.cso(
csc TeslApp.cs
csc C 3ra(p Corp||e(
/la(del:exe ¯.exe corso|e app||cal|or
/la(del:W|rexe W|rdoWs app||cal|or
/oul lo rare lre oulpul F||e
6omp|||ng mu|t|p|e source f||es
csc |r:8ystem.w|ndows.Forms.d|| Testpp.cs he||o.cs
41
ExampIe (ConsoIe -ased)
// le||o.cs
us|rd 3sler:
puo||c c|ass le||o
[
puo||c slal|c vo|d Va|r|3l(|rd[ ì a(ds)
[
Corso|e.w(|leL|re|¨le||o wo(|d¨):
}
}
42
ExampIe (Windows -ased)
// le||ow|r.cs
us|rd 3sler:
us|rd 3sler.w|rdoWs.Fo(rs:
puo||c c|ass le||ow|r
[
puo||c slal|c vo|d Va|r|3l(|rd[ ì a(ds)
[
Corso|e.w(|leL|re|¨le||o wo(|d¨):
Vessadeox.3roW|¨l|. ar roW |r w|rdoWsl¨):
}
}
43
CompiIing MuItipIe Source FiIes
// Ca(.cs
us|rd 3sler:
puo||c c|ass 6ar
[
puo||c vo|d 0|sp|a|)
[
Vessadeox.3roW
|¨Ca( C|ass¨):
}
}
// le||o0(|ve(.cs
us|rd 3sler:
puo||c c|ass le||o0(|ve(
[
puo||c slal|c vo|d Va|r
|3l(|rd[ ì a(ds)
[
Corso|e.w(|leL|re
|¨le||o wo(|d¨):
6ar c = reW 6ar|):
c.0|sp|a|):
}
}
csc /r:System.Windows.Forms.dll HelloDriver.cs Car.cs
44
VisuaI Studio .NET IDE
.NET 3la(l Pade
45
.NET Proect Window
46
Proect Types
w|rdoWs App||cal|or w|rdoWs Fo(rs
C|ass L|o(a( u||ds s|rd|e l||e assero| |¯.d||)
w|rdoWs Corl(o| L|o(a( 3are as Acl|veX Corl(o|
A3P .NET weo App||cal|or u||ds A3P .NET weo
App||cal|or
A3P .NET weo 3e(v|ce .NET weo 3e(v|ce
weo Corl(o| L|o(a( Cuslor|zed weo Corl(o|s
Corso|e App||cal|or 0|d Corso|e oased
w|rdoWs 3e(v|ces NT/2000 se(v|ces |oac|d(ourd Wo(|e(
app||cal|ors)
47
.NET Main Page
Solution
Explorer
View
Class
View
Tool Box
48
Configuring a C# Proect
49
Referencing ExternaI Assem-Iies
Trese a(e p(edel|red ||sl ol assero||es auloral|ca||
(ecodr|zed o .NET
50
ther features of .NET IDE
0eoudd|rd
(ea|po|rls
XVL - Re|aled Ed|l|rd Too|s
0ojecl (oWse(
le|p Veru |F1 |s ou( l(|erd)
0ocurerl|rd lre 3ou(ce Code |XVL)
C# P(ep(ocesso( 0|(ecl|ves
51
We- Sites for ther IDEs
WWW.doldolrel.cor
WWW.|csra(pcode.rel
52
53
Chapter 3
6# Language Fundamenta|s
54
JECTIVES
as|c C# C|ass
Corsl(uclo(s
as|c rpul ard 0ulpul
\a|ue Tpes ard Rele(erce Tpes
le(al|or 3lalererls
Corl(o| F|oW 3lalererls
3lal|c Velrods ard Pa(arele( pass|rd Velrods
A((as. 3l(|rds. ard 3l(|rd Var|pu|al|ors
Erure(al|ors ard 3l(uclu(es
55
asic C# CIass
// le||o.cs
us|rd 3sler:
c|ass le||oC|ass
[
puo||c slal|c |rl Va|r|sl(|rd[ ì a(ds)
[
Corso|e.w(|leL|re|¨le||o wo(|d¨):
(elu(r 0:
}
}
The using keyword has two maor uses:
using Directive Creates an aIias for a namespace
or imports types defined in other namespaces.
using Statement Defines a scope at the end of
which an o-ect wiII -e disposed.
56
asic C# CIass - Variations
// le||o1.cs
us|rd 3sler:
c|ass le||oC|ass
[
puo||c slal|c vo|d Va|r|sl(|rd[ ì a(ds)
[
// ....
}
}
// le||o2.cs
us|rd 3sler:
c|ass le||oC|ass
[
puo||c slal|c vo|d Va|r|)
[
// .....
}
}
57
Command Line Parameters
// c|p.cs
us|rd 3sler:
c|ass le||oC|ass
[
puo||c slal|c |rl Va|r|sl(|rd[ ì a(ds)
[
Corso|e.w(|leL|re|¨Corrard L|re pa(arele(s¨):
lo( ||rl x = 0: x < a(ds.Length: x÷÷) // lo(eacr |sl(|rd s |r a(ds)
Corso|e.w(|leL|re|¨A(ds: {0}¨. a(ds[xì):
(elu(r 0:
}
}
58
CNSTR&CTRS
wo(|s a|rosl sare as C÷÷
¨reW¨ |s lre oe laoro slarda(d lo c(eale ar oojecl
|rslarce
Exarp|e | eoa ) Co((ecl ve(s|or
le||oC|ass c1: le||oC|ass c1 = reW le||oC|ass|):
c1.3al||): c1.3al||):
C# oojecl va(|ao|es a(e (ele(erces lo lre oojecls |r rero(
ard rol lre aclua| oojecls
a(oade co||ecl|or |s la|er ca(e o .NET
EXAMPLE (Point.cs)
c|ass Po|rl
[
puo||c Po|rl|)
[ Corso|e.w(|leL|re|¨0elau|l Corsl(uclo(¨): }
puo||c Po|rl||rl px. |rl p)
[ x = px: = p: }
puo||c |rl x:
puo||c |rl :
}
c|ass Po|rlApp
[
puo||c slal|c vo|d Va|r|sl(|rd[ ì a(ds)
[
Po|rl p1 = reW Po|rl|): // delau|l corsl(uclo( ca||ed
Po|rl p2:
p2 = reW Po|rl|10. 20): // ore -a(d corsl(uclo( ca||ed
Corso|e.w(|leL|re|¨0ul: [0}\l[1}¨. p1.x. p1.):
Corso|e.w(|leL|re|¨0ul: [0}\l[1}¨. p2.x. p2.):
}
}
Program
Entry Point
60
DefauIt VaIues
Puo||c va(|ao|es/reroe(s auloral|ca|| del delau|l va|ues
Examp|e
c|ass 0efau|t
{
pub||c |nt x; pub||c object obj;
pub||c stat|c vo|d Ha|n [str|ng [ ] args}
{
0efau|t d = new 0efau|t[};
|| 6heck the defau|t va|ue
}
}
Loca| reroe(s/va(|ao|es rusl oe exp||c|l| |r|l|a||zed
pub||c stat|c vo|d Ha|n [str|ng [ ] args}
{
|nt x;
6onso|e.wr|teL|ne[x}; || Error
}
61
ASIC INP&T & &TP&T
3sler.Corso|e C|ass
w(|le|). w(|leL|re|). Read|). ard ReadL|re|)
Examp|e [Read and wr|te a str|ng}:
// Rw.cs
us|rd 3sler:
c|ass as|cRw
[
puo||c slal|c vo|d Va|r |sl(|rd [ ì a(ds)
[
string s;
Console.Write("Enter a string: ");
s = Console.ReadLine();
Console.WriteLine("String: {0}", s);
}
}
asic I.
|| 0.cs
us|rd 3sler:
c|ass as|c0
[
puo||c slal|c vo|d Va|r|sl(|rd[ ì a(ds)
[
|rl lrerl = 20:
l|oal lreF|oal = 20.2F: // douo|e lreF|oal = 20.2: |s 0K
sl(|rd lre3l( = 'AT¨:
Corso|e.w(|leL|re|¨rl: [0}¨. lrerl):
Corso|e.w(|leL|re|¨F|oal: [0}¨. lreF|oal):
Corso|e.w(|leL|re|¨3l(|rd: [0}¨. lre3l():
// a((a ol oojecls
oojecl[ ì ooj = ['AT¨. 20. 20.2}:
Corso|e.w(|leL|re|¨3l(|rd: [0}\r rl: [1}\r F|oal: [2}\r¨. ooj):
}
}
63
.NET String Formatting
. 6 or c 6urrency [$}
2. 0 or d 0ec|ma|
3. E or e Exponent|a|
4. F or f F|xed po|nt
5. C or g Cenera|
ô. N or n Numer|ca|
7. X or x hexadec|ma|
Examp|e
|| Format.cs
us|ng 8ystem;
c|ass Format
{
pub||c stat|c vo|d Ha|n [str|ng [ ] args}
{
6onso|e.wr|teL|ne[6 Format: {0:c}, 9999};
6onso|e.wr|teL|ne[0 Format: {0:d}, 9999};
6onso|e.wr|teL|ne[E Format: {0:e}, 9999};
6onso|e.wr|teL|ne[F Format: {0:f}, 9999};
6onso|e.wr|teL|ne[C Format: {0:g}, 9999};
6onso|e.wr|teL|ne[N Format: {0:n}, 9999};
6onso|e.wr|teL|ne[X Format: {0:x}, 9999};
}
}
6 Format: $9,999.00
0 Format: 9999
E Format: 9.999000e+003
F Format: 9999.00
C Format: 9999
N Format: 9,999.00
X Format: 270f
64
VaIue and Reference Types
.NET lpes ra oe va|ue lpe o( (ele(erce lpe
P(|r|l|ve lpes a(e a|Was va|ue lpes |rc|ud|rd
sl(uclu(es
Trese lpes a(e a||ocaled or lre stack. 0uls|de lre
scope. lrese va(|ao|es W||| oe popped oul.
loWeve(. c|asses a(e not va|ue lpe oul (ele(erce
oased
65
ExampIe - 1
puo||c vo|d 3oreVelrod|)
[
|rl | = 30: // | |s 30
|rl j = |: // j |s a|so 30
|rl j = 99: // sl||| | |s 30. crard|rd j W||| rol crarde |
}
66
ExampIe - 2
sl(ucl Foo
[
puo||c |rl x. :
}
puo||c vo|d 3oreVelrod|)
[
Foo l1 = reW Foo|):
// ass|dr va|ues lo x ard
Foo l2 = l1:
// Vod|l|rd va|ues ol l2 reroe(s W||| rol crarde l1 reroe(s
..
}
67
CIass Types
C|ass lpes a(e a|Was (ele(erce lpes
Trese a(e a||ocaled or lre da(oade-co||ecled reap
Ass|drrerl ol (ele(erce lpes W||| (ele(erce lre sare oojecl
Examp|e:
c|ass Foo
[
puo||c |rl x. :
}
NoW lre slalererl Foo l2 = l1: ras a (ele(erce lo lre oojecl
l1 ard ar crardes rade lo( l2 W||| crarde l1
68
VaIue Types containing
Reference Types
wrer a va|ue lpe corla|rs olre( (ele(erce lpe.
ass|drrerl (esu|ls or| ¨(ele(erce cop¨
You rave lWo |rdeperderl sl(uclu(es. eacr ore
po|rl|rd lo lre sare oojecl |r rero( - ¨sra||oW
cop¨
Fo( a ro(e deepe( cop. We rusl use C|oreao|e
|rle(lace
Exarp|e: \a|Rel.cs
ExampIe
|| \a|Rel.cs
|| Th|s |s a Reference type - because |t |s a c|ass
c|ass TreRelTpe
[
puo||c sl(|rd x:
puo||c TreRelTpe|sl(|rd s)
[ x = s: }
}
|| Th|s a Va|ue type - because |t |s a structure type
sl(ucl rre(Rel
[
puo||c TreRelTpe (elTpe: // (el lpe
puo||c |rl sl(ucl0ala: // va|ue lpe
puo||c rre(Rel|sl(|rd s)
[
(elTpe = reW TreRelTpe|s):
sl(ucl0ala = 9:
}
}
InnerRef valWithRef = new
InnerRef("Initial Value");
valWithRef.structData = 666;
valWithRef
structData = 666
refType x =
"Initial Value"
valWithRef2
structData = 777
refType
InnerRef valWithRef2 = valWithRef;
valWithRef2.refType.x = "I am NEW";
valWithRef2.structData = 777
x =
"I am NEW"
70
Master Node : System.-ect
Eve( C# dala lpe |s de(|ved l(or lre oase c|ass
ca||ed 3sler.0ojecl
c|ass le||oC|ass
[ .... } |s sare as
c|ass le||oC|ass : 3sler.0ojecl
[ ....}
71
ExampIe
rarespace 3sler [
puo||c c|ass 0ojecl
[
puo||c 0ojecl|):
puo||c v|(lua| oo|ear Ecua|s|0ojecl ooj):
puo||c v|(lua| rl32 ellasrCode|):
puo||c Tpe elTpe|):
puo||c v|(lua| 3l(|rd To3l(|rd|):
p(olecled v|(lua| vo|d F|ra||ze|):
p(olecled 0ojecl Veroe(W|seC|ore|):
puo||c slal|c ooo| Ecua|s|oojecl oojA. oojecl ooj):
puo||c slal|c ooo| Rele(erceEcua|s|oojecl oojA. oojecl ooj):
}
}
can be overridden
by derived class
72
Core Mem-ers of System.-ect
Equa|s[} Relu(rs l(ue or| |l lre |lers oe|rd corpa(ed (ele(
lo lre exacl sare |ler |r rero(
Cethash6ode[} Relu(rs ar |rlede( lral |derl|l|es a spec|l|c oojecl
|rslarce
CetType[} Relu(rs 3sler.Tpe
To8tr|ng[} Relu(rs <rarespace.c|ass rare> |r sl(|rd lo(ral
F|na||ze[} Fo( oojecl (erova| |da(oade co||ecl|or)
Hemberw|se6|one[} Relu(rs a reW oojecl Wr|cr |s reroe(-W|se cop
lre cu((erl oojecl
73
Create System.-ect Methods
// 0ojTesl.cs
us|rd 3sler:
c|ass 0ojTesl
[
puo||c slal|c vo|d Va|r |sl(|rd [ ì a(ds)
[
0ojTesl c1 = reW 0ojTesl|):
Corso|e.w(|leL|re|¨To3l(|rd: [0}¨. c.To8tr|ng[}):
Corso|e.w(|leL|re|¨ellasrCode: [0}¨. c.Cethash6ode[}):
Corso|e.w(|leL|re|¨elTpe: [0}¨. c.CetType[}.ßaseType):
// c(eale secord oojecl
0ojTesl c2 = c1:
oojecl o = c2:
|l |o.Equa|s[c} && c2.Equa|s[o})
Corso|e.w(|leL|re|¨3are rslarce¨):
}
}
ToString: ObjTest
GetHashCode: 1
GetType: System.Object
Same Instance
74
verriding System.-ect Methods
overro3o |s lre p(ocess ol (edel|r|rd lre oerav|o( ol ar |rre(|led vrrua
reroe( |r a de(|ved c|ass
we car (edel|re lre oerav|o( ol v|(lua| relrods o over|d|ng
Exarp|e To3l(|rd|). Ecua|s|). elc.
c|ass !erson
{
pub||c !erson[str|ng fname, str|ng |name, str|ng ssn, byte a}
{
f|rstName = fname;
|astName = |name;
88N = ssn;
age = a;
}
pub||c !erson[} { }
pub||c str|ng f|rstName, |astName, 88N;
pub||c byte age;
}
75
verriding ToString()
To lo(ral lre sl(|rd (elu(red o 3sler.0ojecl.To3l(|rd|)
us|ng 8ystem.Text;
c|ass !erson
{
pub||c overr|de str|ng To8tr|ng[}
{
8tr|ngßu||der sb = new 8tr|ngßu||der[};
sb.ppendFormat[[FName = {0}, th|s.f|rstName};
sb.ppendFormat[LName = {0}, th|s.|astName};
sb.ppendFormat[88N = {0}, th|s.88N};
sb.ppendFormat[ge = {0}], th|s.age};
return sb.To8tr|ng[};
}
.
}
76
verriding EquaIs()
Ecua|s|) (elu(rs l(ue |l ard or| |l lre lWo oojecls
oe|rd corpa(ed (ele(erce lre sare oojecl |r
rero(
we car ove((|de lr|s oerav|o( ard des|dr Wrer lWo
oojecls rave lre sare va|ue |va|ue-oased). Tral |s.
Wrer rare. 33N. ade ol lWo oojecls a(e ecua|. lrer
(elu(r l(ue e|se (elu(r la|se.
c|ass !erson
{
pub||c overr|de boo| Equa|s[object o}
{
!erson temp = [!erson} o;
|f [temp.f|rstName == th|s.f|rstName &&
temp.|astName == th|s.|astName &&
temp.88N == th|s.88N &&
temp.age == th|s.age} return true;
e|se return fa|se;
}
.
}
ExampIe
verriding GetHashCode()
wrer a c|ass ove((|de Ecua|s|). |l srou|d a|so ove((|de
ellasrCode|)
Relu(rs A|| cuslor lpes W||| oe pul |r a
3sler.Co||ecl|ors.lasrlao|e lpe. Tre Ecua|s|) ard
ellasrCode|) relrods W||| oe ca||ed oer|rd lre scere lo
dele(r|re lre co((ecl lpe lo (elu(r l(or lre corla|re(
ere(al|or ol rasr code car oe cuslor|zed. r ou( exarp|e
We sra|| use 33N - a 3l(|rd reroe( lral |s expecled lo oe
ur|cue
Exarp|e: (ele( lo: 0verr|de.cs
puo||c ove((|de |rl ellasrCode|)
[ (elu(r 33N.ellasrCode|): }
79
eve( |rl(|rs|c C# dala lpe |s aclua|| ar a||as lo ar
ex|sl|rd lpe del|red |r lre 3sler rarespace.
Eacr C# dala lpe a||ases a We||-del|red sl(uclu(e
lpe |r lre 3sler rarespace.
C# del|res a ruroe( ol dala lpes.oul or| a suosel
ol lre Wro|e a(e corp|a|rl W|lr lre (u|es ol lre CL3.
C# Data Types
C# Data Types
6# ||as 6L8 8ystem Type Range
sbyte No 3sler.3le -128 lo 12Z
byte Yes 3sler.le 0 lo 255
short Yes 3sler.rl1ê -32Zê8 lo 32ZêZ
ushort No 3sler.&rl1ê 0 lo ê5535
|nt Yes 3sler.rl32 -2.11Z.138.ê18 lo ÷2.11Z.138.ê1Z
u|nt No 3sler.&rl32 0 lo 1.291.9êZ.295
|ong Yes 3sler.&rlê1 -9.223.3Z2.03ê.851.ZZ5.808 lo ÷9....
u|ong No 3sler.&rlê1 0 lo 18.11ê.Z11.0Z3.Z09.551.ê15
char Yes 3sler.Cra( &10000 lo &1FFFF
f|oat Yes 3sler.3|rd|e 1.5·10
-15
lo 3.1·10
38
doub|e Yes 3sler.0ouo|e 5.0·10
-321
lo 1.Z·10
308
boo| Yes 3sler.oo|ear l(ue o( la|se
dec|ma| Yes 3sler.0ec|ra| 10
0
lo 10
28
str|ng Yes 3sler.3l(|rd L|r|led o ssler rero(
object Yes 3sler.0ojecl Arlr|rd al a||
81
Hierarchy of System Types
Object
Type
MulticastDelegate
Delegate
Exception
Array
String ValueType
(derived one
is
struct type
and not
class)
Boolean
Byte
Char
Decimal
Double
Int16
Int32
Int64
SByte
UInt16
UInt32
UInt64
Void
DateTime
Guid
TimeSpan
Single
Enumerations and Structures
82
ExampIes
rlede(s
&rl1ê.Vax\a|ue
&rl1ê.V|r\a|ue
0ouo|e
douo|e.Vaxva|ue
douo|e.V|r\a|ue
douo|e.Pos|l|verl|r|l
douo|e.Nedal|verl|r|l
oo|ear
ooo|.Fa|se3l(|rd
ooo|.T(ue3l(|rd
83
ExampIes
Cra(
cra(.s0|d|l|'K')
cra(.sLelle(|'a') o( cra(.sLelle(|¨100¨. 1)
cra(.swr|le3pace|¨l| AT¨. 2)
cra(.sPurclual|or|'.')
84
VaIue Type and Reference Type
\a|ue Tpe
\a|ue lpes a(e used d|(ecl| o lre|( va|ues
|rl. l|oal. cra(. erur. elc. a(e va|ue lpes
Trese lpes a(e slo(ed |r a 3lac| oased rero(
Exarp|e: |rl Ade = 12: o( |rl Ade = reW |rl|12):
Stack
int 42
85
Reference Type
Trese lpes a(e a||ocaled |r a raraded leap
0ojecls ol lrese lpes a(e |rd|(ecl| (ele(erced
a(oade co||ecl|or |s rard|ed o .NET
Reference Variables
Shape rect = new Shape();
Shape Temprect = rect;
Objects
Shape
Shape
Shape Newrect = new Shape();
86
oxing and &noxing
ox|rd
Exp||c|l| corve(l|rd a va|ue lpe |rlo a co((espord|rd
(ele(erce lpe
Exarp|e:
|rl Ade = 12:
oojecl oojAde = Ade:
No reed lo( ar W(appe( c|ass |||e Java
C# auloral|ca|| ooxes va(|ao|es Wrereve( reeded. Fo(
exarp|e. Wrer a va|ue lpe |s passed lo a relrod
(ecu|(|rd ar oojecl. lrer oox|rd |s dore auloral|ca||.
87
&noxing
Corve(l|rd lre va|ue |r ar oojecl (ele(erce |re|d |r reap)
|rlo lre co((espord|rd va|ue lpe |slac|)
Rereroe( lral We car or| uroox a va(|ao|e lral ras
p(ev|ous| oeer ooxed.
Exarp|e:
oojecl oojAde:
|rl Ade = ||rl) oojAde: // 0K
sl(|rd sl( = |sl(|rd) oojAde: // w(ordl
rl r=500:oojecl or=r: ole r=|ole)or: //e((o(
Tre lpe corla|red |r lre oox |s 3r ard rol srr3ol
88
oxing and &noxing ExampIe
us|rd 3sler:
c|ass P(od(ar
[ slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
// C(eale ar |rl |va|ue lpe).
|rl rrl = 99:
// ecause rrl |s passed |rlo a relrod p(ololped lo la|e ar oojecl. rrl |s 'ooxed' auloral|ca||.
&seTr|s0ojecl|rrl):
Corso|e.ReadL|re|):
}
slal|c vo|d &seTr|s0ojecl|oojecl oo1)
[
Corso|e.w(|leL|re|¨\a|ue ol o |s: [0}¨. oo1):
Corso|e.w(|leL|re|oo1.elTpe|)):
Corso|e.w(|leL|re||||rl)oo1).elTpe|)):
}
}
89
Defining Program Constants
'corsl' |s lre |eWo(d used lo del|re l|xed ura|le(ao|e
va|ue lo( a va(|ao|e.
C# 'corsl' |eWo(d carrol oe used lo cua||l
pa(arele(s o( (elu(r va|ues.
A corslarl dala |s corpuled al corp||e l|re .
Tre(elo(e |l carrol oe ass|dred lo ar oojecl
(ele(erce.
Ex : corsl x=25:
0ojecl o=x: //W(ord ass|drrerl
90
Defining Program Constants
wrer accessed o arolre( lpe lrese corslarls rusl oe (ele((ed v|a lu||
cua||l|ed rare.
us|rd 3sler:
c|ass Vcor
[ puo||c corsl |rl x=5:
puo||c corsl sl(|rd sl(=' ar Corslarl¨:
puo||c slal|c vo|d Va|r|)
[
Corsl sl(|rd sl(1=' ar (oc| ': //|oca| corslarl W|lr|r relrod scope
Corso|e.w(|leL|re|'[0}\r[1}\r[2}¨.x.sl(.sl(1):
}
}
91
Referencing Constant Data Across
Types
ul |l lre corslarls x ard sl( We(e (ele((ed |r sore olre(
lpe. lrer We rave lo use aoso|ule palrrare.
c|ass Ca||Corsl [
puo||c slal|c vo|d Va|r|)
[ corsl sl(|rd sl(1=' ar (oc|¨:
Corso|e.w(|leL|re|'[0}\r[1}\r[2}\r¨.
Vcor.x.Vcor.sl(.sl(1):
}
}
92
C# Iteration Constructs
for |oop
foreach-in |oop
hile |oop
/o-hile |oop
93
The for Loop
Fo( |oop |s used lo |le(ale ove( a o|oc| ol code a l|xed ruroe( ol l|res.C#
lor Loop |s sare as C. C÷÷. Java. elc
Exarp|e:
slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
// Nolel '|' |s or| v|s|o|e W|lr|r lre scope ol lre lo( |oop.
lo(||rl | = 0: | < 10: |÷÷)
[
Corso|e.w(|leL|re|¨Nuroe( |s: [0} ¨. |):
}
// '|' |s rol v|s|o|e re(e.
}
You car use ¨ooro¨. ¨oreak¨. ¨oo3r3ue¨. elc |||e olre( |arduades
94
The foreach/in Loop
Tre C# lo(eacr |eWo(d a||oWs ou lo |le(ale ove( a|| |lers W|lr|r ar a((a. W|lroul lre reed lo lesl lo( lre
a((a's uppe( ||r|l.
us|rd 3sler:
c|ass Fo(Eacr
[
puo||c slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
sl(|rd[ ì Nares = reW sl(|rd [ ì ['3al|sr 99¨. 'Tr|rra|r 90¨.
'||(ar 35¨. '3udr|( êZ¨}:
|rl r = 0:
foreach [str|ng s |n Names}
{
|f [s.ndex0f["9} != -}
n++;
}
Corso|e.w(|leL|re|¨No. ol 3luderls sco(ed aoove 90 = [0}¨. r):
}
}
95
The hile and do/hile Loop
c|ass F||eRead
[
puo||c slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
l(
[
3l(earReade( sl(Reade( = F||e.0perTexl|'c:\\Erp.dal¨):
sl(|rd sl(L|re = ru||:
wh||e [strReader.ReadL|ne[ } != nu||}
{
6onso|e.wr|teL|ne[strL|ne};
}
sl(Reade(.C|ose|):
}
calcr |F||eNolFourdExcepl|or e)
[
Corso|e.w(|leL|re|e.Vessade):
}
}
}
wr||e slalererl |s uselu| lo( lrose l|res Wrer ou a(e urce(la|r roW |ord |l r|drl la|e lo( a le(r|ral|rd cord|l|or lo oe
rel
96
ControI Statements
l. l-ese 3lalererls
&r|||e |r C ard C÷÷. lre |l/e|se slalererl |r C# ope(ales or| or oo|ear exp(ess|ors.
rol ad roc va|ues sucr as -1. 0.
Re|al|ora| ope(alo(s |||e ==. l=. <. >. <=. >=. elc a(e a|| a||oWed |r C#
Cord|l|ora| ope(alo(s |||e &&. ||. l a(e a|so a||oWed |r C#
eWa(e ol lre d|lle(erce oelWeer 3r ard ooo |r C#
Exarp|e
|| Th|s |s |||ega|, g|ven that Length returns an |nt, not a boo|.
sl(|rd lroudrl0lTre0a = ¨You CAN leacr ar o|d dod reW l(|c|s¨:
|l|lroudrl0lTre0a.Lerdlr) //e((o(
[
...
}
97
The sitch Statement
3are as C. C÷÷. elc. W|lr sore (esl(|cl|ors
Eve( case srou|d rave a oreak slalererl lo avo|d
la|| lr(oudr |lr|s |rc|udes oelaur case a|so)
Exarp|e
switch(country)
{
// Error - no break
case "India":
case "USA":
default:
}
switch(country)
{ // Correct
case "India": HiIndia();
break;
case "USA": HiUSA();
break;
default: break;
}
98
Sitch Example
slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
Corso|e.w(|leL|re|¨1 [C#ì. 2 [\.NETì¨):
Corso|e.w(|le|¨P|ease p|c| ou( |arduade p(ele(erce: ¨):
sl(|rd |ardCro|ce = Corso|e.ReadL|re|):
|rl r = |rl.Pa(se||ardCro|ce):
sW|lcr |r)
[
case 1: Corso|e.w(|leL|re|¨ood cro|ce. C# |s a l|re |arduade.¨):
o(ea|:
case 2: Corso|e.w(|leL|re|¨\ .NET: 00P. ru|l|lr(ead|rd. ard ro(el¨):
o(ea|:
delau|l: Corso|e.w(|leL|re|¨we||...dood |uc| W|lr lrall¨):
o(ea|:
}
}
99
oto Statement
dolo |aoe|:
Exp||c|l la||-lr(oudr |r a suron slalererl car oe
acr|eved o us|rd ooro slalererl
Exarp|e:
switch(country)
{
case "India": HiIndia();
goto case "USA";
case "USA": HiUSA();
break;
default: break;
}
100
C# perators
A|| ope(alo(s lral ou rave used |r C ard C÷÷ car
a|so oe used |r C#
Exarp|e: ÷. -. ¯. /. º. :. ->. elc
3pec|a| ope(alo(s |r C# a(e : ryoeol. s ard as
Tre s ope(alo( |s used lo ve(|l al (url|re Wrelre(
ar oojecl |s corpal|o|e W|lr a d|ver lpe
Tre as ope(alo( |s used lo doWrcasl oelWeer lpes
Tre ryoeol ope(alo( |s used lo (ep(eserl (url|re
lpe |rlo(ral|or ol a c|ass
101
ExampIe - is
Corror use ol lr|s ope(alo( |s lo dele(r|re |l a d|ver oojecl
suppo(ls a pa(l|cu|a( |rle(lace.
puo||c vo|d 0|sp|a0ojecl|oojecl ooj)
[
|l |ooj |s |rl)
Corso|e.w(|leL|re|¨Tre oojecl |s ol lpe |rlede(¨):
e|se
Corso|e.w(|leL|re|¨l |s rol |rl¨):
}
102
ExampIe - as
&s|rd as. ou car corve(l lpes W|lroul (a|s|rd ar excepl|or
r casl|rd. |l lre casl la||s ar 3vao0asrExoeoro3 |s (a|sed
ul |r as ro excepl|or |s (a|sed. |rslead lre (ele(erce W||| oe
sel lo ru||
slal|c vo|d CraseACa(|Ar|ra| arAr|ra|)
[
0od d = arAr|ra| as 0od: // 0od d = |0od) arAr|ra|:
|l |d l= ru||)
d.CraseCa(s|):
e|se
Corso|e.w(|leL|re|¨Nol a 0od¨):
}
103
ExampIe - typeof
rslarce Leve|
VC|ass r = reW VC|ass|):
Corso|e.w(|leL|re|r.elTpe|)):
0ulpul
Tpeol.VC|ass
C|ass Leve|
Tpe rTpe = lpeol|VC|ass):
Corso|e.w(|leL|re|rTpe):
0ulpul
Tpeol.VC|ass
104
Defining Custom CIass methods
Eve( relrod rusl oe p(eserl |rs|de a c|ass o(
sl(ucl|d|ooa| relrods a(e rol a||oWed |r c#).
Cuslor relrods ra o( ra rol (elu(r va|ues. ra
o( ra rol la|e pa(arele(s.
Cuslor relrods ra oe dec|a(ed ror-slal|c ard
slal|c.
A relrod rusl spec|l lre |eve| ol access|o|||l.
105
Method Access Specifiers
puo||c vo|d VVelrod|) [ } » Access|o|e arWre(e
p(|vale vo|d VVelrod|) [ } » Access|o|e or| l(or
lre c|ass Wre(e del|red
p(olecled vo|d VVelrod|) [ } » Access|o|e l(or |ls oWr
c|ass ard |ls descerderl
|rle(ra| vo|d VVelrod|) [ } » Access|o|e W|lr|r lre
sare Assero|
vo|d VVelrod|) [ } » p(|vale o delau|l
p(olecled |rle(ra| vo|d VVelrod|) [ }
Access |s ||r|led lo lre cu((erl assero| o( lpes de(|ved l(or
lre del|r|rd c|ass |r lre cu((erl assero|.
106
Method Access Specifiers
// Veroe( v|s|o|||l opl|ors.
c|ass 3oreC|ass
[
|| ccess|b|e anywhere.
puo||c vo|d Puo||cVelrod|)[}
|| ccess|b|e on|y from 8ome6|ass types.
p(|vale vo|d P(|valeVelrod|)[}
|| ccess|b|e from 8ome6|ass and any descendent.
p(olecled vo|d P(olecledVelrod|)[}
|| ccess|b|e from w|th|n the same assemb|y.
|rle(ra| vo|d rle(ra|Velrod|)[}
|| ssemb|y-protected access.
p(olecled |rle(ra| vo|d P(olecledrle(ra|Velrod|)[}
|| Unmarked members are pr|vate by defau|t |n 6#.
vo|d 3oreVelrod|)[}
}
107
Static Methods
wral does sraro relrod rear
Velrods ra(|ed as sraro ra oe ca||ed d|(ecl| l(or c|ass
|eve|
Tr|s rears. lre(e |s ro reed lo c(eale ar |rslarce ol lre
c|ass ||.e. ar oojecl va(|ao|e) ard lrer ca||. Tr|s |s s|r||a( lo
Corso|e.w(|leL|re|)
l |l Was rol a slal|c relrod lrer |ls access Wou|d oe
Corso|e C=reW Corso|e|): C.w(|leL|re|):
puo||c slal|c vo|d Va|r|) - Wr slal|c
Al (ur l|re Va|r|) car oe |rvo|ed W|lroul ar oojecl va(|ao|e
ol lre erc|os|rd c|ass
108
ExampIe
puo||c c|ass VC|ass
[
puo||c stat|c vo|d VVelrod|)
[ . }
}
puo||c c|ass 3lal|cVelrod
[
puo||c slal|c vo|d Va|r|sl(|rd[ ì a(ds)
[
Hy6|ass.HyHethod[};
}
}
If MyMethod() is not declared
as 89,9., then
MyClass obj = new MyClass();
obj.MyMethod();
109
Static Data
r add|l|or lo slal|c relrods. a lpe ra a|so del|re slal|c dala.
Wrer a c|ass del|res ror slal|c dala. eacr oojecl ol lr|s lpe ra|rla|rs a
p(|vale cop ol lre l|e|d.
Exarp|e :
|| Th|s c|ass has a s|ng|e p|ece of nonstat|c data.
c|ass 3av|rdsAccourl
[
puo||c douo|e cu((a|arce:
puo||c 3av|rdsAccourl|douo|e oa|arce)
[ cu((a|arce = oa|arce:}
}
wrer ou c(eale 3av|rdsAccourl oojecls. rero( lo( lre cu((a|arce
l|e|d |s a||ocaled lo( eacr |rslarce.
110
Static Data
3lal|c dala. or lre olre( rard. |s a||ocaled orce ard sra(ed arord a||
oojecl |rslarces ol lre sare lpe.
c|ass 3av|rdsAccourl
[
puo||c douo|e cu((a|arce:
puo||c stat|c douo|e cu((rle(eslRale = 0.01:
puo||c 3av|rdsAccourl|douo|e oa|arce)
[
cu((a|arce = oa|arce:
}
}
111
Static Data
l ou We(e lo c(eale lr(ee |rslarces ol 3av|rdsAccourl
slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
|| Each 8av|ngsccount object ma|nta|ns a copy of the currßa|ance f|e|d.
3av|rdsAccourl s1 = reW 3av|rdsAccourl|50):
3av|rdsAccourl s2 = reW 3av|rdsAccourl|100):
3av|rdsAccourl s3 = reW 3av|rdsAccourl|10000.Z5):
}
112
Static Data
Tre |r-rero( dala a||ocal|or Wou|d |oo| sorelr|rd
|||e
Stack CIass (StaticMethod foIder)
us|rd 3sler:
puo||c c|ass 3lac|
[
puo||c slal|c vo|d Pusr|sl(|rd s)
[
|lers[÷÷lopì = s:
}
puo||c slal|c sl(|rd Pop|)
[
(elu(r ||lers[lop--ì):
}
puo||c slal|c vo|d 3roW|)
[
lo( ||rl | = lop: | >= 0: |--)
Corso|e.w(|leL|re||lers[|ì):
}
p(|vale slal|c sl(|rd[ ì |lers = reW sl(|rd[5ì:
p(|vale slal|c |rl lop = -1:
}
Stack CIass..
c|ass 3lal|cVelrod
[
puo||c slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
Corso|e.w(|leL|re|¨3lac| Corlerls:¨):
3lac|.Pusr|'AT¨):
3lac|.Pusr|'V3CE¨):
3lac|.3roW|):
Corso|e.w(|leL|re|¨ler Popped=> ¨ ÷ 3lac|.Pop|)):
Corso|e.w(|leL|re|¨3lac| Corlerls:¨):
3lac|.3roW|):
}
}
115
Parameter Passing Methods
0elau|l » \a|ue pa(arele(
oul » 0ulpul pa(arele( |ca||ed reroe()
(el » 3are as pass-o-(ele(erce
pa(ars » \a(|ao|e ruroe( ol pa(arele(s
W|lr|r a s|rd|e pa(arele(
116
ut" Parameter passing ExampIe
us|rd 3sler:
c|ass 0ulPa(ar
[
puo||c slal|c vo|d add||rl x.|rl .oul |rl ars)
[
ars =x÷:
}
puo||c slal|c vo|d Va|r|)
[
|rl x=5.=1.(esu|l=0:
add|x..oul (esu|l):
Corso|e.w(|leL|re|¨[0}÷[1}=[2}¨.x..(esu|l):
}
}
117
Parameter Passing
0re advarlade ol our pa(arele( lpe |s lral We car (elu(r
ro(e lrar ore va|ue l(or lre ca||ed p(od(ar lo lre ca||e(
Calling
Program
a, b
r
Called
Program
x, y
ans
out
public void Add(int x, int y, out int ans)
s.Add(a, b, out r);
118
The ref method
us|rd 3sler:
c|ass Rel
[
pub||c stat|c vo|d 8wap[ref |nt x, ref |nt y}
[
|rl lerp:
lerp = x:
x = :
= lerp:
}
slal|c vo|d Va|r|sl(|rd[ ì a(ds)
[
|rl a = 10: |rl o = 20:
Corso|e.w(|leL|re|¨elo(e 3Wap => [0} \l [1}¨. a. o):
Ref.8wap[ref a, ref b};
Corso|e.w(|leL|re|¨Alle( 3Wap => [0} \l [1}¨. a. o):
}
}
119
The params method
To acr|eve va(|ao|e ruroe( ol pa(arele(s |r a
Velrod dec|a(al|or
Tre oarams pa(arele( rusl oe a s|rd|e d|rers|ora|
a((a |e|se ou del ar e((o()
You car del|re ar oojecl |r lre pa(arele( ||sl
120
ExampIe
us|rd 3sler:
c|ass Pa(ars
[
puo||c slal|c vo|d 0|spA((rls|sl(|rd rsd. pa(ars |rl[ ì ||sl)
[
Corso|e.w(|leL|re|rsd):
lo( ||rl | = 0: | < ||sl.Lerdlr: |÷÷)
Corso|e.w(|leL|re|||sl[|ì):
}
slal|c vo|d Va|r|sl(|rd[ ì a(ds)
[
|rl[ ì |rlA((a = reW |rl[ ì [1. 2. 3}:
0|spA((rls|¨L|sl1¨. |rlA((a):
0|spA((rls|¨L|sl2¨. 1. 5. ê. Z): // ou car serd ro(e e|ererls
0|spA((rls|¨L|sl3¨. 8.9): // ou car serd |ess e|ererls
}
}
121
Generic use of params
rslead ol us|rd or| ar |rlede( ||sl lo( lre oarams pa(arele(. We
car use ar oo|eor
puo||c c|ass Pe(sor
[
p(|vale sl(|rd rare:
p(|vale ole ade:
puo||c Pe(sor|sl(|rd r. ole a)
[
rare = r:
ade = a:
}
puo||c vo|d P(|rlPe(sor|)
[ Corso|e.w(|leL|re|¨[0} |s [1} ea(s o|d¨. rare. ade): }
}
122
pass any o-ect
puo||c slal|c vo|d 0|sp|a0ojecls|params object[ ] ||sl)
[
lo( ||rl | = 0: | < ||sl.Lerdlr: |÷÷)
[
|l |||sl[|ì |s Pe(sor)
[[!erson}||st[|]}.!r|nt!erson[};
e|se
Corso|e.w(|leL|re|||sl[|ì):
}
Corso|e.w(|leL|re|):
}
Calling Program:
Person p = new Person("John", 45);
DisplayObjects(777, p, "Instance of System.String");
Output:
777
John is 45 years old
Instance of System.String
123
Passing Reference Types -
y VaIue
l a (ele(erce lpe |s passed o va|ue. lre ca|||rd p(od(ar ra
crarde lre va|ue ol lre oojecl's slale dala. oul ra rol crarde
lre oojecl |l |s (ele(erc|rd
puo||c slal|c vo|d Pe(sor\a|ue|Pe(sor p)
[
// W||| crarde slale ol p
p.ade = ê0:
// W||| rol crarde lre slale ol p
p = reW Pe(sor|¨N||||¨. 90):
}
124
Passing Reference Types -
y Reference
l a c|ass lpe |s passed o (ele(erce. lre ca|||rd p(od(ar
ra crarde lre oojecl's slale dala as We|| as lre oojecl |l |s
(ele(erc|rd
puo||c slal|c vo|d Pe(sorRel|ref Pe(sor p)
[
// W||| crarde slale ol p
p.ade = ê0:
// p W||| po|rl lo a reW oojecl
p = reW Pe(sor|¨N||||¨. 90):
}
125
CaIIing Program
|| !ass by Va|ue
Corso|e.w(|leL|re|¨Pass|rd \a|ue...........¨):
Pe(sor d = reW Pe(sor|¨eelra¨. 25):
d.P(|rlPe(sor|):
Pe(sor\a|ue|d):
d.P(|rlPe(sor|):
|| !ass by Reference
Corso|e.w(|leL|re|¨Pass|rd Rele(erce........¨):
Pe(sor ( = reW Pe(sor|¨eelra¨. 25):
(.P(|rlPe(sor|):
Pe(sorRel|(el ():
(.P(|rlPe(sor|):
Passing By Value...........
Geetha is 25 years old
Geetha is 60 years old
Passing By Reference........
Geetha is 25 years old
Nikki is 90 years old
126
Arrays in C#
C# a((as a(e de(|ved l(or 3sler.A((a oase c|ass.Vero(
lo( a((as |s a||ocaled |r reap
A((as |r C# a(e dec|a(ed as
lpe [ ì a((arare:
Exarp|e
rl [ ì x : // dec|a(e |rlede( a((a (ele(erce
|rl [ ì |rlA((a = reW |rl [10ì: // |rlede( a((a
sl(|rd [ ì sl(A((a = reW sl(|rd[10ì: // sl(|rd a((a
|rl[2ì Ade = [31. Z0}: // E((o(. (ecu|(es reW |eWo(d
Pe(sor[ ì 3lall = reW Pe(sor[2ì: // oojecl a((a
sl(Aa((a[0ì = 'AT¨: // ass|dr sore va|ue
|rl [ ì Ade = reW |rl[3ì [25. 15. 30}: // a((a |r|l|a||zal|or
127
MuItidimensionaI Arrays
Reclardu|a( A((a
|rl[ . ì rVal(|x: // dec|a(e a (eclardu|a( a((a
|rl[ . ì rVal(|x = reW |rl[2. 2ì [ [ 1. 2 }. [ 3. 1 } }: // |r|l|a||ze
rVal(|x[1.2ì = 15: // access a ce||
Jadded A((a
|rl[ ì[ ì rJaddedA(( = reW |rl[2ì[ ì: // 2 (oWs ard va(|ao|e co|urrs
lo( ||rl |=0: | < rJaddedA((.Lerdlr: |÷÷)
rJaddedA(([|ì = reW |rl[| ÷ Zì:
Nole lral. 1
sl
(oW W||| rave Z co|urrs ard 2
rd
(oW W||| rave 8
co|urrs
$ystem.Array ase CIass
|ra(3ea(cr| ) F|rds a d|ver |ler
C|ea(| ) 3els (arde ol e|ererls lo 0/ru||
CopTo| ) Cop sou(ce lo 0esl|ral|or a((a
elLerdlr| )
Lerdlr
To dele(r|re ro. ol e|ererls
Lerdlr |s a (ead-or| p(ope(l
elLoWe(ourd| )
el&ppe(ourd| )
To dele(r|re |oWe( ard uppe( oourd
el\a|ue| )
3el\a|ue| )
Rel(|eves o( sels lre va|ue ol ar a((a ce||. d|ver |ls
|rdex
Reve(se| ) Reve(ses lre corlerls ol ore-d|rers|ora| a((a
3o(l| ) 3o(ls a ore-d|rers|ora| a((a
129
Array ExampIe
slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
sl(|rd[ì l|(slNares = [ ¨3leve¨. ¨0or|r|c¨. ¨3Wa||oW¨. ¨a|d¨} :
Corso|e.w(|leL|re|¨le(e |s lre a((a:¨): || !r|nt names as dec|ared.
lo(||rl | = 0: | < l|(slNares.Lerdlr: |÷÷)
Corso|e.w(|le|¨Nare: [0}\l¨. l|(slNares[|ì):
Corso|e.w(|leL|re|¨\r¨):
A((a.Reve(se|l|(slNares):
Corso|e.w(|leL|re|¨le(e |s lre a((a orce (eve(sed:¨): || Reverse array and pr|nt.
lo(||rl | = 0: | < l|(slNares.Lerdlr: |÷÷)
Corso|e.w(|le|¨Nare: [0}\l¨. l|(slNares[|ì):
Corso|e.w(|leL|re|¨\r¨):
Corso|e.w(|leL|re|¨C|ea(ed oul a|| oul a|d...¨):
A((a.C|ea(|l|(slNares. 1. 3): || 6|ear out a|| but ßa|dy.
lo(||rl | = 0: | < l|(slNares.Lerdlr: |÷÷)
Corso|e.w(|le|¨Nare: [0}\l¨. l|(slNares[|ì):
Corso|e.ReadL|re|):
}
130
ExampIe
puo||c slal|c |rl[ ì ReadA((a| ) // (eads lre e|ererls ol lre a((a
[
|rl[ ì a(( = reW |rl[5ì:
lo( ||rl | = 0: | < a((.Lerdlr: |÷÷)
a(([|ì = a((.Lerdlr - |:
return arr;
}
puo||c slal|c |rl[ ì 3o(lA((a||rl[ ì a)
[
3sler.A((a.3o(l|a): // so(ls ar a((a
return a;
}
131
CaIIing Program
puo||c slal|c vo|d Va|r|sl(|rd[ ì a(ds)
[
|rl[ ì |rlA((a:
|ntrray = Readrray[ }; // (ead lre a((a e|ererls
Corso|e.w(|leL|re|¨A((a oelo(e so(l|rd¨):
lo( ||rl | = 0: | < |rlA((a.Lerdlr: |÷÷)
Corso|e.w(|leL|re||rlA((a[|ì):
|ntrray = 8ortrray[|ntrray}; // so(l lre e|ererls
Corso|e.w(|leL|re|¨A((a alle( so(l|rd¨):
lo( ||rl | = 0: | < |rlA((a.Lerdlr: |÷÷)
Corso|e.w(|leL|re||rlA((a[|ì):
}
132
String ManipuIations in C#
A sl(|rd |s a secuerl|a| co||ecl|or ol &r|code cra(acle(s. lp|ca|| used lo (ep(eserl
lexl. Tre C# sl(|rd |eWo(d |s a sro(lrard rolal|or ol lre 3sler.3l(|rd lpe.
l |l |s recessa( lo rod|l lre aclua| corlerls ol a sl(|rd. use lre
3sler.Texl.3l(|rdu||de( c|ass.
C# suppo(ls lWo lpes ol sl(|rds
rrulao|e
Meaning that we cannot modify the characters contained
in them
Vulao|e
Meaning that we can modify the characters contained
in them
C# a|so suppo(ls a lealu(e |roWr as (edu|a( exp(ess|ors lral car oe used lo(
corp|ex sl(|rd rar|pu|al|ors ard palle(r ralcr|rd.
133
$ystem.Array ase CIass
Lerdlr Tr|s p(ope(l (elu(rs lre |erdlr ol lre cu((erl sl(|rd
Corcal | ) Tr|s relrod (elu(rs a reW sl(|rd lral |s corposed ol lWo
d|sc(ele sl(|rds
corpa(eTo | ) Corpa(es lWo sl(|rds
Cop| ) Tr|s relrod (elu(rs a l(esr reW cop ol ar ex|sl|rd sl(|rd
rse(l | ) &sed lo |rse(l a sl(|rd W|lr|r a d|ver sl(|rd.
PadLell|)
PadR|drl|)
&sed lo pad a sl(|rd W|lr sore cra(acle(
Rerove | )
Rep|ace | )
Trese relrods (erove o( (ep|ace cra(acle(s.
To&ppe(|)
ToLoWe(|)
Trese relrods c(eale a cop ol a d|ver sl(|rd |r
uppe(case o( |oWe(case.
Strings.
Fo( sl(|rd corpa(|sors. use
Corpa(e. Corpa(e0(d|ra|. Corpa(eTo|). Ecua|s. Erdsw|lr. ard
3la(lsw|lr
To oola|r lre |rdex ol lre suosl(|rd o( ur|code. use
&se rdex0l. rdex0lAr. Laslrdex0l. ard Laslrdex0lAr
To cop a sl(|rd a suosl(|rd. use
Cop ard CopTo
To c(eale ore o( ro(e sl(|rds. use
3uosl(|rd ard 3p||l
To crarde lre case. use
ToLoWe( ard To&ppe(
To rod|l a|| o( pa(l ol lre sl(|rd. use
rse(l. Rep|ace. Rerove. PadLell. PadR|drl. T(|r. T(|rErd. ard
T(|r3la(l
135
Meaning of String Methods
3l(|rd s1 = ¨a¨:
3l(|rd s2 = ¨A¨:
|nt x = 8tr|ng.6ompare0rd|na|[s, s2};
|nt y = 8tr|ng.6ompare[s, s2};
Corso|e.w(|leL|re|¨0(d|ra|¨):
|l |x == 0)
Corso|e.w(|leL|re|¨a = A¨):
e|se |l |x > 0)
Corso|e.w(|leL|re|¨a > A¨):
e|se
Corso|e.w(|leL|re|¨a < A¨):
Corso|e.w(|leL|re|¨Corpa(e¨):
|l | == 0)
Corso|e.w(|leL|re|¨a = A¨):
e|se |l | > 0)
Corso|e.w(|leL|re|¨a > A¨):
e|se
Corso|e.w(|leL|re|¨a < A¨):
0uput:
0(d|ra|
a > A
Corpa(e
a < A
136
More on String Methods
Corpa(eTo|) - |rl x = s1.Corpa(eTo|s2): ard (elu(rs
ar 3r
Rerove|) - 0e|eles a spec|l|ed ruroe( ol cra(acle(s
l(or lr|s |rslarce oed|rr|rd al a spec|l|ed pos|l|or.
pub||c sl(|rd Remove [|rl srarr3oex, |rl oou3r };
rse(l|) - rse(ls a spec|l|ed |rslarce ol 3l(|rd al a
spec|l|ed |rdex pos|l|or |r lr|s |rslarce.
pub||c sl(|rd nsert [|rl srarr3oex, sl(|rd vaue };
ToLoWe(|) - Relu(rs a cop ol lr|s 3l(|rd |r |oWe(case
Exarp|e: s = s.To&ppe(|):
137
System.Text.StringuiIder
L||e Java. C# sl(|rds a(e mmuraoe. Tr|s rears. sl(|rds car rol
oe rod|l|ed orce eslao||sred
Fo( exarp|e. Wrer ou serd To&ppe(|) ressade lo a sl(|rd
oojecl. ou a(e rol rod|l|rd lre urde(||rd oulle( ol lre ex|sl|rd
sl(|rd oojecl. rslead. ou (elu(r a l(esr cop ol lre oulle( |r
uppe(case
l |s rol ell|c|erl. sorel|res. lo Wo(| or cop|es ol sl(|rds -
so|ul|or
&se 3l(|rdu||de( l(or 3sler.Texll
ote: $tring s oaeo mmuraoe oeoause rs vaue oa33or oe mooleo o3oe r nas
oee3 oreareo. Vernoos rnar aooear ro mooly a $tring aoruay rerur3 a 3eu
$tring oo3ra33o rne mooloaro3. l r s 3eoessary ro mooly rne aorua
oo3re3rs ol a srr3o-ke oo|eor. use rne $ysrem.Texr.$rr3o3uoer oass.
ExampIe
us|rd 3sler:
us|rd 3sler.Texl:
c|ass Va|rC|ass
[
puo||c slal|c vo|d Va|r|)
[
3l(|rdu||de( rulle( = reW 3l(|rdu||de(|¨ulle(¨):
// c(eale lre oulle( o( sl(|rd ou||de(
rulle(.Apperd| ¨ |s c(ealed¨):
Corso|e.w(|leL|re|rulle():
// To3l(|rd|) corve(ls a 3l(|rdu||de( lo a sl(|rd
sl(|rd uppe(case = rulle(.To3l(|rd|).To&ppe(|):
Corso|e.w(|leL|re|uppe(case):
sl(|rd |oWe(case = rulle(.To3l(|rd|).ToLoWe(|):
Corso|e.w(|leL|re||oWe(case):
}
}
139
Enumerations in C#
Ar Erure(al|or |s a use(-del|red |rlede( lpe Wr|cr
p(ov|des a Wa lo( allacr|rd rares lo ruroe(s.
Tre erur |eWo(d auloral|ca|| erure(ales a ||sl
ol Wo(ds o ass|dr|rd lrer va|ues 0.1.2.
Tr|s lac|||l p(ov|des ar a|le(ral|ve rears ol c(eal|rd
'corslarl' va(|ao|e rares.
Exarp|e
erur Co|o( [Red .|ue.(eer.Ye||oW}
erur Pos|l|or [0ll.0r}
140
Enumerator initiaIization
Vapp|rd sroo||c rares lo
rure(a|s
Exarp|e - 1
erur Co|o(s
[
Red. // 0
(eer. // 1
|ue // 2
}
Exarp|e - 2
erur ErpTpe : byte
[
Varade( = 10.
wo(|e( = 1.
Corl(aclo( = 100.
\P
}
Tre |rle(ra| lpe used lo(
erure(al|or |s 3sler.rl32
&s|rd Erure(al|ors
Co|o(s c:
c = Co|o(s.|ue:
Corso|e.w(|leL|re|c): // |ue
141
$ystem.Enumase CIass
Fo(ral|)
Corve(ls a va|ue ol ar erure(aled lpe lo |ls
sl(|rd ecu|va|erl
elNare|)
Rel(|eves lre rare lo( lre corslarl |r lre
erure(al|or
el&rde(||rdTpe|)
Relu(rs lre lpe ol erure(al|or
Corso|e.w(|leL|re|Erur.el&rde(||rdTpe|lpeol
|Co|o(s))): // 3sler.rl32
el\a|ues|)
|ves ar a((a ol va|ues ol lre corslarls |r
erure(al|or
s0el|red|)
To crec| Wrelre( a corslarl ex|sls |r erur
|l |Erur.s0el|red|lpeol|Co|o(s). ¨|ue¨) ..
Pa(se|)
Corve(ls sl(|rd/va|ue lo erur oojecl
Co|o(s Ca(Co|o( =
|Co|o(s)Erur.Pa(se|lpeol|Co|o(s). ¨Red¨):
142
Corso|e.w(|leL|re|Erur.el&rde(||rdTpe|lpeol|3lall))):
Relu(rs : 3sler.rl32
|l|Erur.s0ef|ned|lpeol|Co|o(s). 'Ye||oW¨))
Corso|e.w(|leL|re|¨Yes. We rave Ye||oW Co|o( ¨):
e|se
Corso|e.w(|leL|re|¨No. We dor'l rave Ye||oW Co|o( ...¨):
143
ExampIe
A((a ooj = Erur.el\a|ues|lpeol|Co|o(s)):
lo(eacr|Co|o(s x |r ooj)
[
Corso|e.w(|leL|re|x.To3l(|rd|)):
Corso|e.w(|leL|re|¨|rl = [0}¨. Erur.Fo(ral|lpeol|Co|o(s). x. ¨0¨)):
}
0utput
Red
|rl = 0
|ue
|rl = 1
(eer
|rl = 2
144
Structures in C#
3l(uclu(es a(e a Wa lo acr|eve lre oerel|ls ol oojecl
o(|erlal|or||.e..ercapsu|al|or) Wr||e rav|rd lre
ell|c|erc ol slac|-a||ocaled dala.
3l(uclu(es car corla|r corsl(uclo(s |rusl rave
a(durerls). we car'l (edel|re delau|l corsl(uclo(s
l car |rp|ererl |rle(laces
Car rave relrods - |r lacl. rarl
Tre(e |s ro 3sler.3l(uclu(e c|assl |de(|ved l(or
3sler.\a|ueTpe).
ExampIe
us|rd 3sler:
sl(ucl 3T&0ENT
[
puo||c |rl RedNo:
puo||c sl(|rd Nare:
puo||c |rl Va(|s:
puo||c 3T&0ENT||rl (. sl(|rd r. |rl r)
[
RedNo = (:
Nare = r:
Va(|s = r:
}
}
c|ass Va|rC|ass
[
puo||c slal|c vo|d Va|r|)
[
3T&0ENT s:
s.RedNo = 111:
s.Nare = '3AT3l¨:
s..Va(|s = 99:
3T&0ENT 3ore0re = reW 3T&0ENT|222.¨Rav|¨.90):
}
}
146
Designing Custom Namespaces
3sler |s lre .NET's ex|sl|rd
rarespace
&s|rd lre |eWo(d rarespace. We
car del|re ou( oWr rarespace
Pull|rd a|| c|asses |r a s|rd|e
rarespaces ra rol oe a dood
p(acl|ce
Tp|ca| rarespace o(dar|zal|or lo( a
|a(de p(ojecl
To use a rarespace:
|1) 3sler.Xr|.Xr|TexlReade( l(:
|2) us|rd 3sler.Xr|:
Xr|TexlReade( l(:
CompanyName
Server UserInterface
Session IO Desktop WebUI
147
ExampIe
Assure lral ou a(e deve|op|rd a co||ecl|or ol d(apr|c
c|asses: 3cua(e. C|(c|e. ard lexador
To o(dar|ze lrese c|asses ard sra(e. lWo app(oacres cou|d
oe used:
// srapes||o.cs
us|rd 3sler:
Narespace V3rapes:
[
puo||c c|ass 3cua(e [ .}
puo||c c|ass C|(c|e [ .}
puo||c c|ass lexador [ .}
}
NOTE : MyShape namespace
Acts as the conceptual
"container " of each type
AIternate Approach
|| 8quare.cs
us|rd 3sler:
rarespace V3rapes
[
c|ass 3cua(e [ . }
}
|| 6|rc|e.cs
us|rd 3sler:
rarespace V3rapes
[
c|ass C|(c|e [ . }
}
|| heagon.cs
us|rd 3sler:
rarespace V3rapes
[
c|ass lexador [ . }
}
A|| lre lr(ee c|asses 3cua(e. C|(c|e. ard
lexador a(e pul |r lre rarespace
V3rapes
us|rd 3sler:
us|rd V3rapes:
rarespace VApp||cal|or
[
c|ass 3rape0ero
[
...
3cua(e sc = reW 3cua(e|):
C|(c|e C| = reW C|(c|e|):
leadore re = reW leador|):
...
}
}
del|red |r V3rapes rarespace
149
ResoIving Name cIashes in
namespaces
&s|rd 3sler:
Narespace V303rapes:
[
puo||c c|ass 3cua(e [ .}
puo||c c|ass C|(c|e [ .}
puo||c c|ass lexador [ .}
}
us|rd 3sler:
us|rd V3rapes:
us|rdV303rapes:
....
// E((o(l
8quare 8q = new 8quare[};
...
Tre c|ass 3cua(e |s del|re |r oolr
lre rarespaces |V3rapes ard
V303rpaes)
To (eso|ve lr|s rare c|asr. use
Hy308hapes. 8quare 8q =
new Hy308hapes.8quare[};
0ua||l lre rare ol lre c|ass W|lr lre
app(op(|ale rarespace
Tre delau|l rarespace d|ver |r \3
0E |s lre rare ol lre p(ojecl
Erd ol
Cbapter ²
151
152
P with C#
Craple( - 1
153
-ectives
as|c C|ass |r C#
\|s|o|||l
Ercapsu|al|or
Accesso( |del) ard Vulalo( |sel)
Nared P(ope(l
rre(|larce
3ea|ed c|asses
Po|ro(pr|sr
Aosl(acl C|ass ard Velrod
154
C# CIasses
A C|ass |s a cuslor &se( 0el|red Tpe |&0T)
A C|ass cors|sls ol dala |all(|oules) ard lurcl|ors
|relrods)
Exarp|e: To rode| a dere(|c Erp|oee. We car
del|re ar Erp|oee C|ass
155
EmpIoyee CIass
Employee
attributes:
string fullname,
int emp!D,
float currPay,
methods:
void CiveBonus(float amount),
void DisplayStats(),
156
Source Code
us|rd 3sler:
rarespace Erp|oee
[
puo||c c|ass Erp|oee
[
// p(|vale dala
p(|vale sl(|rd lu||Nare:
p(|vale |rl erp0:
p(|vale l|oal cu((Pa:
// 0elau|l clo(.
puo||c Erp|oee|)[ }
// Cuslor clo(
puo||c Erp|oee|sl(|rd lu||Nare. |rl erp0. l|oal cu((Pa)
[
// Ass|dr |rle(ra| slale dala. Nole use ol 'lr|s' |eWo(d
lr|s.lu||Nare = lu||Nare:
lr|s.erp0 = erp0:
lr|s.cu((Pa = cu((Pa:
}
157
Source Code (Contd.)
// urp lre pa lo( lr|s erp.
puo||c vo|d |veorus|l|oal arourl)
[cu((Pa ÷= arourl:}
// 3roW lre slale
puo||c vo|d 0|sp|a3lals|)
[
Corso|e.w(|leL|re|¨Nare: [0}¨. lu||Nare):
Corso|e.w(|leL|re|¨Pa: [0}¨. cu((Pa):
Corso|e.w(|leL|re|¨0: [0}¨. erp0):
}
puo||c slal|c vo|d Va|r|sl(|rd[ ì a(ds)
[
Erp|oee e = reW Erp|oee|¨Joe¨.111.2398Z.50F):
e.|veorus|200):
e.0|sp|a3lals|):
}
}
}
158
Method verIoading and 'this'
0ve(|oad|rd ol Velrods |s sare as C÷÷. Corsl(uclo(s car oe ove(|oaded.
Fo( relrod (eso|ul|or. (elu(r lpe a|ore |s rol recessa(l
s lre |eWo(d 'rns' a|Was recessa(
Yes. |l lre pa(arele( rare ard lre c|ass reroe( rare a(e sare.
0lre(W|se Nol
3lal|c reroe( lurcl|ors car'l use 'rns' |eWo(d. wr
Tre |eWo(d 'rns' car a|so oe used lo lo(ce ore corsl(uclo( lo ca|| arolre(
du(|rd lre oojecl c(eal|or
Ex: puo||c Erp|oee|sl(|rd lu||Nare) : lr|s|lu||Nare. elErpd|). cu((Pa)
[ }
159
asic P Concepts
Encapsu|at|on
l|d|rd urrecessa( |rp|ererlal|or dela||s
nher|tance
¨|s-a¨ ard ¨ras-a¨ (e|al|orsr|p
¨|s-a¨ rears suo-c|asses o( de(|ved c|asses
¨ras-a¨ rears corla|rrerl o( de|edal|or
!o|ymorph|sm
l |s lre ao|||l ol lre |arduade lo l(eal (e|aled oojecls lre sare Wa
wrer suo-c|asses ove((|de lre oerav|o( del|red o oase a c|ass.
lre a(e esserl|a|| (edel|r|rd roW lre (espord lo lre sare
ressade
160
ExampIes
Ercapsu|al|or
0Reade( l = reW 0ßReader[}: // dela||s a(e r|dder
l.0per|¨©C:\loo.rdl¨):
// p(ocess lre dalaoase l||e
l.C|ose|):
rre(|larce
Po|ro(pr|sr
is·a Relationship
"bject
Shape
Hexagon
has·a Relationship
Car
Radio
Shape
void Draw( )
Hexagon Circle
Draw() Draw()
161
More DetaiIs: (1) EncapsuIation
Tre ra|r oojecl|ve ol ercapsu|al|or |s: lre oojecl's |rslarce
srou|d oe a||oWed lo access lre |rle(ra| reroe( dala
d|(ecl|. l a|so p(ov|des lre |rled(|l ol slale dala. loW lo do
lr|s
&s|rd p(|vale. puo||c. p(olecled. ard p(olecled |rle(ra|
|eWo(ds
To rar|pu|ale lre p(|vale dala. C# p(ov|des lWo relrods:
0el|re l(ad|l|ora| accesso( ard rulalo( relrods
0el|re a rared p(ope(l
162
ExampIe
Accesso(
c|ass Erp|oee
[
private string fullName;
public string GetName() { return fullName; }
......
}
Vulalo(
c|ass Erp|oee
[
private string fullName;
public string SetName(string n)
{ fullName = n; }
......
}
163
CIass Properties
You car del|re a rared p(ope(l lo avo|d us|rd lWo
d|lle(erl oer ard ser relrods
Tre p(ope(l |s a s|rd|e rared l|e|d Wr|cr W(aps lre
p(|vale dala. Trese p(ope(l rares car lrer oe used |r
Va3 j.
Ex: Assure Erp0 |s lre rare ol lre p(ope(l
puo||c slal|c vo|d Va|r|)
[
Erp|oee e = reW Erp|oee|):
p.Erp0 = 111: // sel
Corso|e.w(|leL|re|e.Erp0): // del
}
164
C# et and set Methods
us|rd 3sler:
rarespace del_sel
[
c|ass VC|ass
[
p(|vale |rl a:
puo||c |rl || property
[
get || accessor
[
(elu(r a:
}
set || mutator
[
a = va|ue:
}
}
}
c|ass C|ass1
[
slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
VC|ass ooj = reW VC|ass|):
obj. = 20;
6onso|e.wr|teL|ne[obj.};
}
}
}
del o|oc| - accesso(
sel o|oc| - rulalo(
A - rared p(ope(l
165
Read-nIy and Write-nIy Properties
Tre rared p(ope(l A |r lre p(ev|ous s||de Was ao|e lo (ead
ard W(|le. loW lo (esl(|cl lre access ol A as R/w
Fo( Read-0r|: s|rp| del|re a p(ope(l W|lroul a sel o|oc|
Fo( W(|le-or|: s|rp| del|re a p(ope(l W|lroul a del o|oc|
Ex: puo||c l|oal Pa puo||c l|oal Pa
{ {
get { return currPay; } set { currPay
= value; }
} }
166
static: properties and constructors
Tre slal|c |eWo(d car oe used lo( p(ope(l|es a|so
Tre or| d|lle(erce |s lral. roW lrese p(ope(l|es a(e oourd
lo a c|ass ard rol lo ar |rslarce
Ex: Erp|oee.Erp0 = 111:
Car a corsl(uclo( oe dec|a(ed as slal|c
Yes. oul |l |s sl(ardel wr ecause. corsl(uclo(s a(e
execuled du(|rd oojecl c(eal|or
3lal|c corsl(uclo(s a(e used lo |r|l|a||ze slal|c dala
167
ExampIe - static property
puo||c c|ass Erp|oee
[
p(|vale slal|c sl(|rd corparNare:
puo||c slal|c sl(|rd Corpar
[
del [ (elu(r corparNare: }
sel [corparNare = va|ue: }
}
}
puo||c slal|c vo|d Va|r|sl(|rd[ ì a(ds)
[
Erp|oee.Corpar = ¨V|c(osoll¨:
Corso|e.w(|leL|re|¨Tre rare |s [0}¨. Erp|oee. Corpar):
}
168
ExampIe - static constructor
puo||c c|ass Erp|oee
[
p(|vale slal|c sl(|rd corparNare:
slal|c Erp|oee|)
[ corparNare = ¨V|c(osoll¨: }
}
puo||c slal|c vo|d Va|r|sl(|rd[ ì a(ds)
[
// oe|oW slalererl |s rol reeded
// Erp|oee.Corpar = ¨V|c(osoll¨:
Corso|e.w(|leL|re|¨Tre rare |s [0}¨.
Erp|oee.Corpar):
}
169
Read-nIy FieIds
Read-0r| p(ope(l|es p(ov|de dala p(ese(val|or: |eWo(d lo oe used |s:
¨reaoo3y¨
Ex: puo||c (eador| |rl (ol|e|d:
You car'l ass|dr ar va|ue lo lre reaoo3y l|e|ds. excepl |r a corsl(uclo(
Ex: vo|d 3oreVelrod|) [ (ol|e|d = 123: } //
E((o(
3lal|c reaoo3y l|e|ds car a|so oe used. l |s uselu| lo assoc|ale rar
corslarl va|ues oourd lo a c|ass.
l ra oe |oo| s|r||a( lo 'corsl' dec|a(al|or. Tre d|lle(erce. roWeve(. |s lral
oo3sr |s (eso|ved al corp||e-l|re ard slal|c (eador| |s (eso|ved al (ur-
l|re.
Tre olre( corlexl |r Wr|cr |l |s va||d lo pass a reaoo3y l|e|d as ar out o(
ref pa(arele(.
170
More DetaiIs: (2) Inheritance
rre(|larce lac|||lales code (euse
rre(|larce p(ov|des deperderc oelWeer lpes
rre(|larce cores |r lWo l|avo(s:
¨|s-a¨ (e|al|orsr|p
¨ras-a¨ (e|al|orsr|p
Lel us sla(l W|lr ¨|s-a¨ (e|al|orsr|p..
Employee
Nanager
SalesPerson
171
Manager - Derived CIass
us|rd 3sler:
rarespace Erp|oee
[
puo||c c|ass Varade( : Erp|oee
[
p(|vale u|ord ruroe(0l0pl|ors:
puo||c u|ord Nuroe(0pls
[
del [ (elu(r ruroe(0l0pl|ors: }
sel [ ruroe(0l0pl|ors = va|ue: }
}
}
}
172
SaIesPerson - Derived CIass
us|rd 3sler:
rarespace Erp|oee
[
puo||c c|ass 3a|esPe(sor : Erp|oee
[
p(|vale |rl rure(0l3a|es:
puo||c |rl Nuro3a|es
[
del [ (elu(r rure(0l3a|es: }
sel [ rure(0l3a|es = va|ue: }
}
}
}
173
ase cIass and Su-cIass Constructors
A suoc|ass corsl(uclo( auloral|ca|| ca||s lre oase
c|ass corsl(uclo(. o delau|l
Exarp|e:
puo||c Varade(|sl(|rd lu||Nare. |rl erp0. l|oal cu((Pa. u|ord
ruroe(0l0pls)
: base [fu||Name, emp0, curr!ay}
[ ruroe(0l0pl|ors = ruroe(0l0pls: }
Rele( lo: rre(|larce p(ojecl lo|de( lo( lre corp|ele
sou(ce code
174
More features of "is-a"
Hu|t|p|e nher|tance
r C#. a d|ver c|ass car rave exacl| ore d|(ecl oase c|ass
l |s rol pe(r|lled lo rave a s|rd|e lpe W|lr ore o( ro(e oase
c|asses
5rotecte/ Keyword
You |roW lral a orvare reroe( car'l oe accessed o ever
suoc|asses
¨ororeoreo ¨ dala o( relrods car oe accessed o suoc|asses
8ea|ed 6|asses
l ou Warl lo des|dr a c|ass lral car'l oe |rre(|led. lrer use lre
|eWo(d: ¨seaeo ¨
A sea|ed c|ass carrol a|so oe ar aosl(acl c|ass. l a|so erao|es
ce(la|r (ur-l|re opl|r|zal|ors
175
ExampIe - SeaIed CIasses
Add a suoc|ass PT3a|esPe(sor lo( 3a|esPe(sor c|ass lo
rave pa(l - l|re sa|es peop|e.
3|rce We car'l lr|r| ol ro(e cr||d c|asses urde(
PT3a|esPe(sor. We sra|| 8eal |l
3ea|ed c|asses a(e rosl uselu| lo( des|dr|rd slarda|ore
c|asses. Ex: 3l(|rd c|ass |r lre 3sler rarespace
Exarp|e
puo||c sea|ed PT3a|esPe(sor : 3a|esPe(sor
[ .... }
Employee
Nanager
SalesPerson
PTSalesPerson
176
Containment/DeIegation
or has-a reIationship
Lel us cors|de( lWo c|asses: A Ca( c|ass ard a Rad|o c|ass
l |s odd lo lr|r| ol Rad|o s a Ca(l rslead. We car sa a Ca( nas a Rad|o
Ca( - |s ca||ed as Corla|r|rd C|ass
Rad|o - |s ca||ed as Corla|red C|ass
To expose lre lurcl|ora||l ol lre |rre( c|ass lo lre ouls|de Wo(|d
(ecu|(es de|edal|or
0e|edal|or rears add|rd reroe(s lo lre corla|r|rd c|ass lral ra|e
use ol lre corla|red c|ass's lurcl|ora||l |Ex:
lreVus|cox.Tu(r0r|slale): )
Rele( lo: Corla|rrerl lo|de( lo( lre corp|ele sou(ce code
177
More DetaiIs: (3) PoIymorphism
Po|ro(pr|sr |s lre ao|||l lo( c|asses lo p(ov|de d|lle(erl |rp|ererlal|ors
ol relrods lral a(e ca||ed o lre sare rare.
Po|ro(pr|sr a||oWs a relrod ol a c|ass lo oe ca||ed W|lroul (eda(d lo
Wral spec|l|c |rp|ererlal|or |l p(ov|des.
Fo( Exarp|e. assure lral ou rave added a reW relrod lo Erp|oee
c|ass as:
puo||c vo|d |veorus|l|oal arourl)
[ cu((Pa ÷= arourl: }
Tr|s relrod |s corror lo( a|| oojecls de(|ved l(or Erp|oee. loWeve(.
ou( oojecl|ve |s lo des|dr lr|s lo oerave d|lle(erl| lo( Varade( ard
3a|esPe(sor.
Tr|s rears lral lre suoc|asses srou|d oe ao|e lo p(ov|de d|lle(erl
|rle(laces lo Erp|oee c|ass
Po|ro(pr|sr |s acr|eved lr(oudr ¨ v|(lua| ¨ ard ¨ ove((|de ¨ |eWo(ds
178
Types of PoIymorphism
nterface po|ymorph|sm - Vu|l|p|e c|asses ra |rp|ererl lre sare
3rerlaoe. ard a s|rd|e c|ass ra |rp|ererl ore o( ro(e |rle(laces.
rle(laces a(e esserl|a|| del|r|l|ors ol roW a c|ass reeds lo (espord. Ar
|rle(lace desc(|oes lre relrods. p(ope(l|es. ard everls lral a c|ass reeds
lo |rp|ererl.
nher|tance po|ymorph|sm - Vu|l|p|e c|asses ra 3nerr l(or a s|rd|e
oase c|ass. |rre(|l|rd. a c|ass (ece|ves a|| ol lre relrods. p(ope(l|es.
ard everls ol lre oase c|ass |r lre sare |rp|ererlal|or as lre oase c|ass.
!o|ymorph|sm through abstract c|asses - Aosl(acl c|asses p(ov|de
e|ererls ol oolr |rre(|larce ard |rle(laces. Ar aosl(acl c|ass |s a c|ass
lral carrol oe |rslarl|aled |lse|l: |l rusl oe |rre(|led.
179
Base Claass
ExampIe
puo||c c|ass Erp|oee
[
puo||c v|rtua| vo|d |veorus|l|oal arourl)
[ cu((Pa ÷= arourl: }
...
}
puo||c c|ass 3a|esPe(sor : Erp|oee
[
puo||c overr|de vo|d |veorus|l|oal arourl)
[
|rl sa|esorus = 0:
|l |ruroe(0l3a|es > 200)
sa|esorus = 1000:
base.|veorus|arourl ÷ sa|esorus):
}
}
ou can reuse the base c|ass method by us|ng the keyword base
|ternat|ve|y, the subc|ass can comp|ete|y redef|ne w|thout ca|||ng the base c|ass method
180
A-stract CIasses
Ar aosrraor c|ass carrol oe |rslarl|aled d|(ecl|. ard |l |s a
corp||e-l|re e((o( lo use lre 3eu ope(alo( or ar aosl(acl
c|ass
Ar aosl(acl c|ass |s pe(r|lled |oul rol (ecu|(ed) lo corla|r
aosl(acl reroe(s
Ar aosl(acl c|ass carrol oe sea|ed - wr
Ex: l lre Erp|oee c|ass |s dec|a(ed as aosl(acl. lre lre
lo||oW|rd slrl. d|ves ar e((o(:
Erp|oee e = reW Erp|oee|):
wral |s lre reed lo( ar aosl(acl c|ass
0oes |l |oo| 0K |l sore ore sas
¨ ar ar Erp|oee¨ o( ¨ ar a 3a|es Pe(sor¨
181
ExampIe
aosl(acl c|ass A
[
puo||c aosl(acl vo|d F|):
}
aosl(acl c|ass : A
[
puo||c vo|d |) [}
}
c|ass C:
[
puo||c ove((|de vo|d F|)
[ // aclua| |rp|ererlal|or ol F }
}
Tre aosl(acl c|ass A |rl(oduces ar aosl(acl relrod F.
C|ass |rl(oduces ar add|l|ora| relrod . oul s|rce |l doesr'l p(ov|de ar
|rp|ererlal|or ol F. rusl a|so oe dec|a(ed aosl(acl.
C|ass C ove((|des F ard p(ov|des ar aclua| |rp|ererlal|or. 3|rce lre(e a(e ro
aosl(acl reroe(s |r C. C |s pe(r|lled |oul rol (ecu|(ed) lo oe ror-aosl(acl.

B
C
182
Shape CIass - Design overview
Tre suoc|ass C|(c|e does rol ove((|de 0(aW|). Wre(eas lexador does
Rele( lo 3rapes P(ojecl
public abstract class Shape
{
public virtual void Draw()
{ . }
}
public class Circle : Shape
{ . }
public class Hexagon : Shape
{
public override void Draw()
{ ... }
}
!t is more
intelligent to
declare
Draw() as
abstract
Same as
pure
virtual
function of
C++
183
Method Hiding
Velrod r|d|rd |s oppos|le ol Velrod ove((|d|rd
Assure lral 0va| |s-a lpe ol C|(c|e. 0l cou(se ou car del|re a relrod 0(aW|) Wr|cr
ove((|des 0(aW|) ol |ls pa(erl c|ass ard p(ov|de |ls oWr ve(s|or|rd.
loWeve(. |l We Warl lo p(everl lre 0va| c|ass l(or |rre(|l|rd ar p(ev|ous |od|c. use
¨3eu¨ |eWo(d
puo||c c|ass 0va| : C|(c|e
[
puo||c 0va||)[oase.PelNare = ¨Joe¨:}
// l|de oase c|ass |rp| |l lre c(eale ar 0va|.
new pub||c vo|d 0raw[}
[
Corso|e.w(|leL|re|¨0va| W|lr c|ass ve(s|or|rd¨):
}
}
3eu |eWo(d o(ea|s lre (e|al|orsr|p oelWeer oase c|ass ol aosl(acl 0(aW|) ard
lre de(|ved c|ass ve(s|or
184
ne Modifier
// Tre reW rod|l|e(
us|rd 3sler:
puo||c c|ass VaseC
[
puo||c slal|c |rl x = 55:
puo||c slal|c |rl = 22:
}
puo||c c|ass V0e(|vedC : VaseC
[
new pub||c stat|c |nt x = 00; || Name h|d|ng
puo||c slal|c vo|d Va|r| )
[
Corso|e.w(|leL|re|x): // 0|sp|a lre ove(|app|rd va|ue ol x:
Corso|e.w(|leL|re|VaseC.x): // Access lre r|dder va|ue ol x:
Corso|e.w(|leL|re|): // 0|sp|a lre urr|dder reroe( :
}
}
"utput:

185
1nv o{ (nv¡ìc· !
186
Exceptions
and
-ect Lifetime
Craple( - 5
187
Chapter -ectives
wral |s ar Excepl|or - oas|cs
3sler.Excepl|or C|ass
Calcr|rd ar Excepl|or
3sler Leve| Excepl|ors
u||d|rd Cuslor|zed Excepl|ors
Vu|l|p|e Excepl|ors
a(oade Co||ecl|or - oas|cs
wral |s ¨l|ra||¨
u||d|rd F|ra|||zao|e ard 0|sposao|e Tpes
188
de to Errors, ugs and Exceptions
w(|l|rd sollWa(e |s a corp|ex las|.
wr||e W(|l|rd a p(od(ar seve(a| p(oo|ers a(e
ercourle(ed. ro p(od(arre( |s pe(lecl.
Tre p(oo|er ra oe caused o oad code |ove(l|oW
oourd ol ar a((a) o( a p(oo|er |s caused o oodus
use( |rpul lral ras rol oeer accourled lo( |r lre
app||cal|or's code oase|Erle(|rd sl(|rd lo accourl
ruroe().
189
01initions 1or thr00 commonly us0/ anomaly-c0ntric t0rms:
3uos: |l |s ar e((o( or lre pa(l ol lre p(od(arre(.
Fo( exarp|e
assure ou a(e p(od(arr|rd W|lr urraraded C÷÷.
l ou ra|e ca||s or a N&LL po|rle(
la|| lo de|ele a||ocaled rero( |(esu|l|rd |r a rero( |ea|). ou
rave a oud.
Errors : e((o(s a(e caused o lre |rd|v|dua| (urr|rd ou(
app||cal|or
Fo( exarp|e.
ar erd use( Wro erle(s a ra|lo(red sl(|rd |rlo a lexl oox lral
(ecu|(es ar 33N.
190
Exoeoro3s: ar Excepl|or |s a cord|l|or lral |s
caused o a (ur-l|re e((o( |r lre p(od(ar.
Fo( Exarp|e :
allerpl|rd lo correcl lo a dalaoase lral ro |orde( ex|sls.
oper|rd a co((upled l||e.
Corlacl|rd a racr|re lral |s cu((erl| oll||re
r eacr ol lrese cases. lre p(od(arre( ras ||ll|e
corl(o| ove( lrese 'excepl|ora|¨ c|(curslarces.
01initions 1or thr00 commonly us0/ anomaly-c0ntric t0rms:
191
Introduction
Ar excepl|or |s ar e((o( cord|l|or o( urexpecled oerav|o(
ercourle(ed o ar execul|rd p(od(ar. Trese a(e (ur l|re
arora||es.
r lre .NET F(areWo(|. ar excepl|or |s ar oojecl lral |rre(|ls
l(or lre 3sler.Excepl|or c|ass
Ar excepl|or |s lr(oWr l(or ar a(ea ol code Wre(e a p(oo|er
ras occu((ed
.NET oase c|ass ||o(a(|es del|re: 0ul0lVero(Excepl|or.
rdex0ul0lRardeExcepl|or. F||eNolFourdExcepl|or. ard so
or
192
The RoIe of .NET Exception HandIing
Tre(e a(e lWo Was lo rard|e ar excepl|or
T(ad|l|ora|
Var p(od(arre(s (o||ed lre|( oWr e((o( rard||rd |od|c
W|lr|r lre corlexl ol a d|ver app||cal|or
Fo( exarp|e. a deve|oprerl lear ra del|re a sel ol
rure(|ca| corslarls lral (ep(eserl |roWr e((o(
cord|l|ors. ard ra|e use ol lrer as relrod (elu(r
va|ues.
193
|* very 6-sty|e error trapp|ng mechan|sm. *|
#del|re E_FLEN0TF0&N0 1000
|rl 3oreFurcl|or|)
[
|| ssume someth|ng happens |n th|s f[x}
|| that causes the fo||ow|ng return va|ue.
(elu(r E_FLEN0TF0&N0:
}
vo|d ra|r|)
[
|rl (el\a| = 3oreFurcl|or|):
|l|(el\a| == E_FLEN0TF0&N0)
p(|rll|¨Carrol l|rd l||e...¨):
}
Tr|s relrod |s rol a se|l desc(|o|rd aderl.
The RoIe of .NET Exception HandIing
194
3l(uclu(ed Excepl|or lard||rd|3El)
Tr|s p(ov|des a Wa lo ercapsu|ale lre rare.ressade. ard olre(
re|plu| |rlo (eda(d|rd lre e((o( cord|l|or |rlo a s|rd|e sl(uclu(ed
pac|ade.
Tre oeaul ol lr|s app(oacr |s lral deve|ope(s roW rave a ur|l|ed
app(oacr lo e((o( rard||rd.Wr|cr |s corror lo a|| |arduades
la(del|rd lre .NET ur|ve(se.
Arolre( advarlade ol .NET excepl|ors |s lre lacl lral (alre( lrar
(ece|v|rd a c(pl|c rure(|ca| va|ue lral |derl|l|es lre p(oo|er al rard.
excepl|ors a(e oojecls lral corla|r a rurar-(eadao|e desc(|pl|or ol
lre p(oo|er. as We|| as a dela||ed srapsrol ol lre ca|| slac| lral
l(|dde(ed lre excepl|or .
The RoIe of .NET Exception HandIing
195
The atoms of .NET Exceptions
P(od(arr|rd W|lr sl(uclu(ed excepl|or rard||rd
|rvo|ves lre use ol lou( |rle((e|aled erl|l|es:
A c|ass lpe lral (ep(eserls lre dela||s ol lre excepl|or
lral occu((ed
A reroe( lral rnrous ar |rslarce ol lre excepl|or c|ass
lo lre ca||e(
A o|oc| ol code lral W||| |rvo|e lre excepl|or-(ead
relrod
A o|oc| ol code lral W||| p(ocess o( catch lre excepl|or
196
r C# . excepl|ors a(e (ep(eserled o a c|ass.
A|| Excepl|or c|asses rusl oe de(|ved l(or lre ou||l
|r excepl|or c|ass excepl|or.
F(or excepl|or c|ass a(e de(|ved
3sler Excepl|or ard App||cal|or Excepl|or.
Vosl ol lre rereoe(s del|red o 3sler.Excepl|or
a(e (ead-or|
System.Exception ase CIass
197
System.Exception ase CIass
!roperty Hean|ng
le|pL|r| Tr|s p(ope(l (elu(rs a &RL lo a re|p l||e desc(|o|rd
lre e((o( |r lu|| dela||.
rre(Excepl|or dela||s ol p(ev|ous excepl|ors lral caused lre
cu((erl excepl|or
Vessade (elu(rs lre lexl ressade desc(|o|rd lre e((o(
3ou(ce rare ol lre assero| lral lr(eW lre excepl|or
3lac|T(ace secuerce ol ca||s lral l(|dde(ed lre excepl|or
Ta(del3|le
(elu(rs a Velrodase lpe. Wr|cr desc(|oes rure(ous
dela||s aooul lre relrod lral lr(eW lre excepl|or
198
Throwing a Generic Exception
puo||c vo|d Acce|e(ale||rl de|la)
[
|l |ca(s0ead)
Corso|e.w(|leL|re|¨[0} |s oul ol o(de(...¨. pelNare):
e|se
[
cu((3peed ÷= de|la:
|l |cu((3peed > rax3peed)
[
Corso|e.w(|leL|re|¨[0} ras ove(realedl¨. pelNare):
cu((3peed = 0:
ca(s0ead = l(ue:
}
e|se
Corso|e.w(|leL|re|¨=> Cu((3peed = [0}¨. cu((3peed):
}
}
199
puo||c vo|d Acce|e(ale||rl de|la)
[ |l |ca(s0ead)
Corso|e.w(|leL|re|¨[0} |s oul ol o(de(...¨. pelNare):
e|se
[
cu((3peed ÷= de|la:
|l |cu((3peed >= rax3peed)
[
ca(s0ead = l(ue:
cu((3peed = 0:
|| Use throw keyword to ra|se an except|on.
lr(oW reW Excepl|or|sl(|rd.Fo(ral|¨[0} ras ove(realedl¨. pelNare)):
}
e|se
Corso|e.w(|leL|re|¨=> Cu((3peed = [0}¨. cu((3peed):
}
Throwing a Generic Exception
200
Catching Exceptions
slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
Corso|e.w(|leL|re|¨¯¯¯¯¯ C(eal|rd a ca( ard slepp|rd or |l ¯¯¯¯¯¨):
Ca( rCa( = reW Ca(|'3W|ll¨. 20):
l( || 8peed up past the car's max speed to tr|gger the except|on.
[
lo(||rl | = 0: | < 10: |÷÷)
rCa(. Acce|e(ale|10):
}
calcr|Excepl|or e)
[
Corso|e.w(|leL|re|¨\r¯¯¯ E((o(l ¯¯¯¨):
Corso|e.w(|leL|re|¨Velrod: [0}¨. e.Target8|te):
Corso|e.w(|leL|re|¨Vessade: [0}¨. e.Hessage):
Corso|e.w(|leL|re|¨3ou(ce: [0}¨. e.8ource):
}
|| The error has been hand|ed, process|ng cont|nues w|th the next statement.
Corso|e.w(|leL|re|¨\r¯¯¯¯¯ 0ul ol excepl|or |od|c ¯¯¯¯¯¨):
}
201
.NET Exceptions .
Tre CLR suppo(ls ar excepl|or rard||rd rode| oased or lre
corcepls ol excepl|or oojecls ard p(olecled o|oc|s ol code
Tre (url|re c(eales ar oojecl lo (ep(eserl ar excepl|or Wrer
|l occu(s. You car a|so c(eale ou( oWr excepl|or c|asses o
de(|v|rd c|asses l(or lre app(op(|ale oase excepl|or
Eacr |arduade uses a lo(r ol l(/calcr/l|ra|| sl(uclu(ed
excepl|or rard||rd
202
Why Exceptions?
Code lral uses excepl|ors a(e c|ea(e( ard ro(e (oousl lrar
olre( relrods
ooo| ReroveF(orAccourl|sl(|rd Accl0. dec|ra| Arourl)
[
ooo| Ex|sls = \e(|lArourl|Accl0):
|l |Ex|sls)
[
ooo| Carw|lr0(aW = Crec|Av|Accl0. Arourl):
|l |Carw|lr0(aW)
[ (elu(r w|lr0(aW|Accl0. Arourl): }
}
(elu(r la|se:
}
203
Disadvantages of
TraditionaI Methods
Code lral deperds or (elu(r va|ue - rusl p(ov|de add|l|ora|
e((o( pa(arele(s o( ca|| olre( lurcl|ors |e.d. w|r32 AP)
Relu(r|rd e((o( code - rusl oe rard|ed p(ope(|
E((o( codes a(e d|ll|cu|l lo exlerd ard updale. Tre erl|(e
sou(ce code rusl oe updaled lo( ar reW e((o( codes
C# uses (|cr Excepl|or oojecl Wr|cr corla|rs |rlo aooul
la||u(e cord|l|or
204
HandIing Exceptions
To rard|e ar excepl|or ou rusl p(olecl W|lr a try o|oc| ard
rave al |easl ore catch o|oc|
l(
[
Erp|oee e:
e.|veorus|): // ru|| (ele(erce
}
calcr
[
// lard|e ar excepl|or
}
205
How Exceptions are Executed?
To calcr ar excepl|or lre rry-oaron o|oc| rusl oe used
A l( o|oc| |s a secl|or ol lre code lral |oo|s lo( ar excepl|or
wrer ar excepl|or |s (a|sed. o( lr(oWr. W|lr|r a l( o|oc|. ar excepl|or oojecl
|s c(ealed ard a sea(cr oed|rs |r lre calcr o|oc|
wrer ar excepl|or occu(s W|lr|r lral scope. lre corl(o| does lo lre
app(op(|ale calcr o|oc| |rard|e()
l ro excepl|or occu(s. oov|ous| lre calcr o|oc| |s reve( execuled
Alle( lre calcr o|oc| code |s execuled lre (esl ol lre code |r lre p(od(ar
corl|rues ||s |l 0K)
Calcr o|oc| car a|so (elr(oW lre excepl|or
206
Catching Specific Exceptions
l(
[
Erp|oee e:
e.|veorus|): // ru|| (ele(erce
}
calcr |Nu||Rele(erceExcepl|or ex)
[
// Lod lre e((o(
throw[ex};
}
l lre calcr o|oc| car (ecove( l(or lre e((o( lral caused lre excepl|or. execul|or car
corl|rue alle( calcr o|oc|. l |l car'l. lrer |l rusl (elr(oW |sroWr |r (ed co|o().
l ar excepl|or |s (elr(oWr. lre rexl calcr o|oc| W||| oe crec|ed. Tre crec| ra
corl|rue |r lre ca|| slac| url|| a p(ope( rard|e( |s lourd. l rore lourd. le(r|ralel
207
thro statement
Tre throw slalererl |s used lo s|dra| lre occu((erce ol ar
arora|ous s|lual|or /excepl|or ard lo serd lre e((o( oojecl
oac| lo lre ca||e( |(a|s|rd ar excepl|or)
throw [exoresso3ì;
exoresso3 |s ar excepl|or oojecl
&sua|| lre throw slalererl |s used W|lr l(-calcr o( l(-l|ra||
slalererls. wrer ar excepl|or |s lr(oWr. lre p(od(ar |oo|s
lo( lre catch slalererl lral rard|es lr|s excepl|or
208
ExampIe (thro)
us|rd 3sler:
puo||c c|ass Tr(oWTesl
[
puo||c slal|c vo|d Va|r|)
[
sl(|rd s = ru||:
|l |s == ru||)
[
lr(oW|reW A(durerlNu||Excepl|or|)):
}
// rol execuled
Corso|e.w(|le|¨Tre sl(|rd s |s ru||¨):
}
}
Output: Output:
The following exception occurs: The following exception occurs:
System.ArgumentNullException System.ArgumentNullException
209
ExampIe (try - catch)
us|rd 3sler:
c|ass Addrls
[
slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
|rl a. o:
|rl c. d = 0:
Corso|e.w(|le|¨Erle( lre l|(sl ruroe( |a): ¨):
a = 3sler.rl32.Pa(se|Corso|e.ReadL|re|)):
Corso|e.w(|le|¨Erle( lre secord ruroe( |o): ¨):
o = 3sler.rl32.Pa(se|Corso|e.ReadL|re|)):
c = a ÷ o:
210
l(
[
d = a / o:
}
calcr|Excepl|or e)
[
Corso|e.w(|leL|re|¨Velrod: [0}¨. e.Ta(del3|le):
6onso|e.wr|teL|ne[Hessage: {0}, e.Hessage};
Corso|e.w(|leL|re|¨3ou(ce: [0}¨. e.3ou(ce):
(elu(r:
}
Corso|e.w(|leL|re|¨a ÷ o = [0}¨. c):
Corso|e.w(|leL|re|¨a / o = [0}¨. d):
}
}
Enter the first number (a): 29
Enter the second number (b): 0
Method: Void Main(System.String[]) //which method threw the exception
Message: Attempted to divide by zero.
Source: AddInts
211
System.Exception ase CIass
Vosl ol lre rereoe(s del|red o 3sler.Excepl|or a(e
(ead-or|
!roperty Hean|ng
le|pL|r| &RL lo a re|p l||e
rre(Excepl|or dela||s ol p(ev|ous excepl|ors lral caused lre
cu((erl excepl|or
Vessade (elu(rs lre lexl desc(|o|rd lre e((o(
3ou(ce rare ol lre assero| lral lr(eW lre excepl|or
3lac|T(ace secuerce ol ca||s lral l(|dde(ed lre excepl|or
Ta(del3|le (elu(rs lre Velrodase lpe
212
ExampIe-2 : StackTrace
3lac|T(ace: 0|sp|as secuerce ol ca||s lral (esu|led |r
lr(oW|rd lre excepl|or. we car lo||oW lre l|oW ol lre e((o('s
o(|d|r
calcr|Excepl|or e)
[
Corso|e.w(|leL|re|¨3lac|: [0}¨.e.3lac|T(ace):
}
213
ExampIe-3 : HeIpLink
l(
[
// c(eale a reW Excepl|or oojecl. pass|rd a sl(|rd
Excepl|or rExcepl|or = reW Excepl|or|¨rExcepl|or¨):
// sel lre le|pL|r| ard 3ou(ce p(ope(l|es
rExcepl|or.le|pL|r| = ¨3ee lre Readre.lxl l||e¨:
rExcepl|or.3ou(ce = ¨V le|pL|r| P(od(ar¨:
// lr(oW lre Excepl|or oojecl
lr(oW rExcepl|or:
}
calcr |Excepl|or e)
[
// d|sp|a lre excepl|or oojecl's p(ope(l|es
Corso|e.w(|leL|re|¨le|pL|r| = ¨ ÷ e.le|pL|r|):
Corso|e.w(|leL|re|¨3ou(ce = ¨ ÷ e.3ou(ce):
}
HelpLink = See the Readme.txt file
Source = My HelpLink
214
uiIding Custom Exceptions
Troudr lre 3sler |eve| excepl|ors a(e uselu|.
sorel|res |l |s recessa( lo ou||d use( del|red
excepl|ors
0el|re a reW use( del|red c|ass de(|ved l(or
3sler.Excepl|or
You ra ove((|de ar v|(lua| reroe(s del|red |r lre
pa(erl c|ass
215
Square Root
us|rd 3sler:
rarespace CuslorExcepl|or
[
c|ass NegNumExcept|on : pp||cat|onExcept|on
[
c|ass NedNurExcepl|or : App||cal|orExcepl|or
[
puo||c NedNurExcepl|or|)
: oase|¨3N: Nedal|ve Nuroe( Excepl|or¨)
[ }
puo||c NedNurExcepl|or|sl(|rd rsd)
: oase|rsd)
[ }
puo||c NedNurExcepl|or|sl(|rd rsd. Excepl|or |rre()
: oase|rsd. |rre()
[ }
}
216
Square Root.
c|ass CuslorExcepl|or
[
puo||c douo|e 3cRool|douo|e r)
[
|l |r < 0)
// ca||s 1-a(d clo(.
// lr(oW reW NedNurExcepl|or
|¨3N: Nedal|ve Nuroe( rol a||oWed¨):
// ca||s delau|l clo(.
lr(oW reW NedNurExcepl|or|):
(elu(r Valr.3c(l|r):
}
217
Square Root.
puo||c vo|d 3cRoolTesl|)
[
douo|e r:
l(
[
Corso|e.w(|le|¨Erle( a ruroe(: ¨):
r = 3sler.0ouo|e.Pa(se|Corso|e.ReadL|re|)):
douo|e (esu|l = 3cRool|r):
Corso|e.w(|leL|re|¨3c Rool = [0}¨. (esu|l):
}
calcr|Fo(ralExcepl|or ex)
[
Corso|e.w(|leL|re|ex.Vessade):
}
calcr|NedNurExcepl|or ex)
[
Corso|e.w(|leL|re|ex.Vessade):
}
}
218
Square Root.
slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
CuslorExcepl|or e = reW CuslorExcepl|or|):
e.3cRoolTesl|):
}
}
}
219
MuItipIe Exceptions
Tre code |r lre l( o|oc| ra l(|dde( ro(e lrar ore excepl|or.
&rde( lrese c|(curslarces ou car rave ro(e lrar ore calcr
o|oc|
Excepl|or W||| oe p(ocessed o lre rea(esl ava||ao|e calcr
o|oc| |e|oW exarp|e |s W(ordl)
Ex: l( [ . }
catch (Exception e) {.}
catch (NegNumException e) {.}
catch (ArgumentOutOfRangeException e) {.}
Unreachable
220
ther types of Exception HandIing
ere(|c calcr
l( [.}
calcr
[ . }
Relr(oW|rd Excepl|ors
l( [.}
calcr |NedNurExcepl|or e)
[
// rard|e lre e((o( ard pass lre ouc|
lr(oW e:
}
Tre l3ay |oc|
- Tre opl|ora| l|ra|| o|oc| W||| del execuled a|Was
- &selu| lo( c|ear|rd up p(ocess o( c|ose lre dalaoase l||es
No argument
rethrow the same
exception
221
Gar-age CoIIection
C# P(od(arre(s reve( d|(ecl| dea||ocale ar oojecl l(or rero( - so ro
'oeere' |eWo(d
Ru|e: A||ocale ar oojecl or lo a raraded reap us|rd '3eu ard lo(del aooul |ll
loW does .NET dele(r|re lral ar oojecl |s ro |orde( reeded wrer |l |s
ur(eacrao|e o lre cu((erl app||cal|or
Exarp|e:
puo||c slal|c |rl Va|r|sl(|rd[ì a(ds)
[
Car c = new Car( );
..
}
When the
application shuts
down, object c may
be destroyed.
222
Gar-age CoIIector
CL er|ls 3euoo| lo( 3eu
.NET da(oade co||eclo( ra|rla|rs a reW oojecl po|rle( Wr|cr
|rd|cales Wre(e lre rexl oojecl srou|d oe p|aced |r lre reap
Assure c1. c2. ard c3 a(e oojecls ol lpe Ca(
c3 c2 c1 &rused reap
next object pointer
223
Gar-age CoIIector.
l lre raraded reap does rol rave eroudr rero(. CLR does da(oade
co||ecl|or. l l(ees lre rero( lo accorrodale lre reW oojecl
wr|cr oojecl rero( |s lo oe (eroved - ¨ro |orde( reeded¨ oas|s
0ojecls lral rave oeer (ecerl| a||ocaled a(e rosl |||e| lo oe l(eed
0ojecls lral rave ||ved lre |ordesl a(e |easl |||e| lo oe oecore l(ee
0ojecls a||ocaled lodelre( W||| oe used lodelre(
To del lr|s |dea CLR uses ar oojecl d(apr lo |roW Wrelre( lre oojecls a(e
sl||| |r use.
Tre olre( oojecls Wr|cr a(e ro |orde( used - ¨seve(ed (ools¨ o( ur(eacrao|e
oojecls a(e (ec|a|red ard lre rero( |s corpacled W|lr recessa( oojecl
po|rle( adjuslrerl
224
Gar-age CoIIector.
Tre a(oade Co||eclo( |r .NET |s |roWr as oe3eraro3a da(oade
co||eclo(.
A||ocaled oojecls a(e so(led |rlo lr(ee d(oups o( dere(al|ors:
generat|on 0: oojecls a||ocaled rosl (ecerl|
generat|on : 0ojecls lral su(v|ve a da(oade co||ecl|or pass a(e
roved |rlo dere(al|or 1
generat|on 2: 0ojecls lral su(v|ve |r dere(al|or 1 a(e roved
|rlo dere(al|or 2
l ro rero( |s ava||ao|e alle( corpacl|or. ar
urlVemoryExoeoro3 |s lr(oWr
225
FinaIizing a Type
Tre da(oade co||ecl|or p(ocess |s rordele(r|r|sl|c
To (e|ease lre rero( |r a l|re| rarre(. ore poss|o|e so|ul|or |s lo ove((|de
3sler.0ojecl.F|ra||ze|) relrod.
we do lo( lr|s or| Wrer C# lpes a(e us|rd urraraded lpes |w|r32 APs) &rraraded
(esou(ces: dalaoase correcl|ors ard 0
Nole lral ou car'l ove((|de lr|s relrod d|(ecl|:
puo||c c|ass F|ra||zedCa(
[
p(olecled ove((|de vo|d F|ra||ze|) [ } // w(ord
}
p(olecled vo|d F|ra||ze|) // dor'l expose lr|s relrod
[
base.Finalize();
}
0o rol del|re oolr a desl(uclo( ard F|ra||ze relrod |r lre sare c|ass
226
IndirectIy Invoking FinaIize()
wrer ar App||cal|or dora|r |s ur|oaded o CLR. lre 3aej relrod |s |rvo|ed lo( a||
l|ra||zao|e oojecls
c|ass F|ra||zedCa(
[
~F|ra||zedCa(|)
[ Corso|e.w(|leL|re|¨F|ra||z|rd¨): } // 3
c|ass F|ra||zeApp
[
static void Main(string[] args)
{
Console.WriteLine("Object creation"); // 1
FinalizedCar fc = new FinalizedCar();
Console.WriteLine("Exiting Main"); // 2
}
}
}
rslead ol us|rd a l|ra||ze( |oecause |l |s cosl|). ou car expose lre 0|spose|) relrod
227
Dispose with usin
w|lr lre p(eserce ol lre us3o slalererl. Wr|cr opers a scope al lre erd ol
Wr|cr a d|ver oojecl W||| oe d|sposed. (eda(d|ess ol Wrelre( lre scope |s
ex|led ro(ra|| o( v|a ar excepl|or.
us|rd| Per rPer = reW Per|Co|o(.Red) )
[
// 0o slull W|lr rPer
}
wrer oojecls a(e ol lre sare lpe. ou ra pul lrer a|| |rs|de lre sare
us3o slalererl:
us|rd| Per rRedPer = reW Per|Co|o(.Red).
r|uePer = reW Per|Co|o(.|ue) )
[
// 0o slull W|lr oolr pers
}
228
Dispose with usin
Fo( |rslarce. ou'|| reed a Forl ard a (usr |l ou Warl lo use lre (apr|cs.0(aW3l(|rd relrod
lo pa|rl sore lexl. &rlo(lurale|. re(e's Wre(e lre us|rd slalererl sla(ls lo o(ea| doWr.
oecause lre lo||oW|rd code dere(ales a corp||e e((o(:
us|rd| Forl rForl = reW Forl|¨A(|a|¨. 1ê).
3o||d(usr r(usr = reW 3o||d(usr|Co|o(.|ue) )
[
// C0VPLE ERR0Rl
}
Tral sr|ppel doesr'l corp||e oecause C# doesr'l |el ou rave ro(e lrar ore lpe |r a s|rd|e
us|rd slalererl. 3o. ou( rexl a|le(ral|ve |s lo resl us|rd slalererls |||e lr|s:
us|rd| Forl rForl = reW Forl|¨A(|a|¨. 1ê) )
[
us|rd| 3o||d(usr r(usr = reW 3o||d(usr|Co|o(.|ue) )
[
[
// 0o slull W|lr a lorl ard a o(usr
}
}
}
229
Dispose with usin
ul use ol ro(e lrar a coup|e ol |eve|s ol resl|rd.
ard ou( code dels ud| p(ell cu|c||
lerce. We rusl sea(cr lo( a oelle(
so|ul|or........
230
ImpIementing IDisposa-Ie
C(eal|rd ard p(ope(| d|spos|rd ol ar oojecl (ecu|(es seve(a|
||res ol co((ecl| W(|ller code.
C# p(ov|des ar auloraled so|ul|or oased or soose |rle(lace
soose |rle(lace p(ov|ded |r .NET |s lo( srrel( arord a||
oojecls lral suppo(ls ar exp||c|l desl(ucl|or
231
IDispose ImpIementation FIow
232
ImpIementing IDisposa-Ie.
pub||c c|ass Hy6|ass : 0|sposab|e
{
pub||c vo|d 0|spose[}
{
6onso|e.wr|teL|ne[6ustom c|ean|ng process};
}
}
puo||c c|ass 0|sposeApp
[
puo||c slal|c vo|d Va|r|sl(|rd[ì a(ds)
[
VC|ass r = reW VC|ass|):
r.0|spose|):
}
}
233
ExampIe
puo||c c|ass C|asse|rdTesled : 0|sposao|e
[
p(|vale ooo| d|sposed=la|se:
p(|vale rade |rd=ru||:
puo||c rade rade
[
del [(elu(r |rd:}
}
// lre corsl(uclo(
puo||c C|asse|rdTesled|)
[
T(ace.w(|leL|re|¨C|asse|rdTesled: Corsl(uclo(¨):
}
// lre desl(uclo(
~C|asse|rdTesled|)
[
T(ace.w(|leL|re|¨C|asse|rdTesled: 0esl(uclo(¨):
// ca|| 0|spose W|lr la|se. 3|rce We'(e |r lre
// desl(uclo( ca||. lre raraded (esou(ces W||| oe
// d|sposed ol arWas.
0|spose|la|se):
}
234
puo||c vo|d 0|spose|)
[
T(ace.w(|leL|re|¨C|asse|rdTesled: 0|spose¨):
// d|spose ol lre raraded ard urraraded (esou(ces
0|spose|l(ue):
// le|| lre C lral lre F|ra||ze p(ocess ro |orde( reeds
// lo oe (ur lo( lr|s oojecl.
C.3upp(essF|ra||ze|lr|s):
}
235
p(olecled v|(lua| vo|d 0|spose|ooo| d|sposeVaradedResou(ces)
[
// p(ocess or| |l rararded ard urraraded (esou(ces rave rol oeer d|sposed ol.
|l |llr|s.d|sposed)
[
T(ace.w(|leL|re|¨C|asse|rdTesled: Resou(ces rol d|sposed¨):
|l |d|sposeVaradedResou(ces)
[
T(ace.w(|leL|re|¨C|asse|rdTesled: 0|spos|rd raraded (esou(ces¨):
// d|spose raraded (esou(ces
|l ||rd l= ru||)
[
|rd.0|spose|):
|rd=ru||:
}
}
// d|spose urraraded (esou(ces
T(ace.w(|leL|re|¨C|asse|rdTesled: 0|spos|rd urraraded (esouces¨):
d|sposed=l(ue:
}
e|se
[
T(ace.w(|leL|re|¨C|asse|rdTesled: Resou(ces a|(ead d|sposed¨):
}
}
236
End of Chapter - 5
Fo( ro(e dela||s or 0|spose |rp|ererlal|or. p|ease
(ele( lo:
WWW.codep(ojecl.cor/csra(p/0|spose.asp
C# loW lo P(od(ar o 0ETEL & 0ETEL
237

448147#010703.0 
,3/90 %!,91472 / 
3/70%740803 70,290.!:-.,9438 

.748419'8:, % 
.0,28 .748419!7088 

,5907


%0!484541 % 

-0.9;08
&3/0789,3/390570;4:889,9041,11,78 %0 %$4:943 :/3-4.841 %!,91472 
# %$ ,3/$ 

%,80,88-7,708 

3/390 570.78 8.&3/0789.11.4:889.9041..

2207 98.3!!747.8479.4250 8.

 .0 .3:.-7:59.9.3:.02039 :543907. .3:.0 8..98 49..79209. :839.202472. .3.43897:.

!747,2207 #4498  9889.4250,3/07747
57430 8,'!747,2207 49,.425090 ! -0.9
,,70   4083 98:554793079,3.0 42:9970,/3 45,7,209070/,8808 4 
0;0!.,8,70.4250 

!70;4:889,9041,11,78 
8,,;,

!747,2207
&8041,;,17439
94
-,./:73/0;0452039..0 4,3:,01700/42 !:70,;,83498:9,-01477,5.39038;0574-028    ,20 4.7488 
,3:,03907,943 

8, !747,2207 
4250.70,94341 9508 .9;0%025,90-7,7 % 47.0/94.43903/9-7990

17,070897,943039708 054203988:08 

3:.08 -.70.3//0-:3 422437:392003308.20 /  .. %.3/949.3:.7488 .909 %-3.078438418. %7:82510//054203924/0 4300/94708907.947 &3343 85..339074507.7:39394908890270897 482:950.3:.88-7.7 44/4-0.3/3 .05943.70..03907.88. %$4:943 :39074507.924/0:80/-.708 425090.0 0.. 09.943 $:554798.3..08 42470 5:2-3 4.80.9. %..03079.708.-3.3:.70/-.-99089334/0 893 -3.

759  42243.$9:/4 % $! % 0-47280-$07. %7.0$50.2047 '   $..3/ .88-7.93$8902  3/48 4728 .$9:/4 % '8:.943 '8:.7 42243.08  %.1..3:.0#:3920 507.80.3:.

43897:.:/34.3:..3/5747.1.3/2.9/01308.9438  .943 809417:089..223.9.943 .3:.3/950 8.3./ .0 %9508 :942.3:.0#:3920 %44.202472.0$50.109 %$ 42243%50$8902 08.90 4.02039 .3.3/850.03907.5488-0/.841 % # 42243.98 8:554790/-907:3920 $ 42243.8:-809419508..9.7-08.9508.1.

3. #4.4250/3943.90...08430574.55.3/8..94383.:79 #..4/0.3/00./824/:08.3:.9438..-02.109 202472.:908902 4/02.30 .438898413897:.3..3.4/0..071.08412.4/09508.:3.4250/2094/8708/03.38  .3/.94380.3300.38.4/01742    ' .0/.8'41.0#:3920 #8984394541 $ 8.02039 .3.55.4/0.943 810920 /.30574..-08.0/..3/48983/...:3.70%.759394 #/4083 9.20.0/ 42243 390720/.3:.439.02./:.9.943/42.943 9.3..397.0/ .55.39.4/0 .:9.3/42.90.088 .94383580:/47.07.0/ 47:32.0:3990.55.0 3897:.97:3920 %.0881470.# 42243....

..74:85729.908.-...943 0- 03.-0/ 17439 03/ ./8 10 7.80..9.88-7./08/. 703/073 .80.35:./3 & 0 .3/49073907.943 3907.080970.9..5.708 3.84574.58:.802..88-7.088 %70.9439/0.08 9..708 .

3:.0#:3920 %$ $  .$ ! 42243.

.8949508 8.40/ 39071./3..90789.8  ..20.7.9:70 09.80/5747. 507..074.202472.3574/:.9474.3.4/09.8.20.22390...0.9. 24898.9..07473!  .88 897:.36:08 883.02039 4 /0090  3:207.37:34343 %03.943 .0 -. 45439078706:70/ :942.7432039 :30 807..

439..8802-  .42507/4083 90307.55. -70.&3/0789.902.4250/394.4/0 98.55.3 ..9438. 0 $4:943 %8802-08  %..90/ .70:5/..0/0503/03.30..94382.88087089070/3$8902 70897 039080.425430398.0843430472470 8 %08082.3/38802-08 3/48..

0 .90.4/0  %42507   8802- 390720/.8802- 09.3:.9. 84:7./.0.

 /08.7025020390/-...:/0831472.817895.7-08.7 1472..943.8802-3.08944907.0..88.8802- 90950209.4390398 4300/147.4254303970897 .8802-08   14:.9 09. 08.3 9-000..7-0890.:90/ 983493-3..39071.9.08..  $.7594341202-07841.7  /08.73.8802-.7  .80.-4:97010703.7 8-.03./.88 .20.0/..8841.42507 9.9./...

8802-08.07843 894109073.55./0130/.  ../.8802- 03#4.9.70/./.0 .8802-08  09..90..70/ 48957010770/2094/ $..8802-08 3903/0/1472:950.8802-..943 90.:943 !7..943 83498./84:7.9.94 34.23084:75747.55.09073.8802-08 &80/-830.55.41.31089 %0209.2 8209.9438 4-.8802-08.70706:70/14700.

.0.3 8973(.30.9. //    43840 79030 ..3:..90/.  5:-.4/.850.89.  39.70..9438  ..25041 898.4250702983897:.39// 39 39 709:73 < < <  %.78  .55  5:-..88...9438 :83$8902 3.2085..-4.:.38..0.38  43840 #0.88. %0.203897:...1..08 0298.../30  < < 5:-.947  5:-.884..42507   09.

3.0/  .3.2./0-8389.41// 094/ 2094/5:-.039// 39 39 .

.

* 709 <.839  (39$  * /.89.4/080  2.7  * /...7  * . 4.// * 894. * -7 8*  * /4.

.

.//  .03/412094/.

 8802- .47 5:-.8802-0907328.31089 9073..09403   .

.

8.8802-4384055.943 00 . '  ...4792    .07   < 24/:04384055.07   < .943  .

.

80   8:-88902   10.32039  .0-.8   .471.'    < 2.

.

2.0-.80   -  .

940.07 !4.47708543/3 2.425083897:.3  .4253  1908.09! 9907.0/.:943 08945  % $07..202094/8....943843901394.3/..30.4/0.09 %88:801:14734970.

 .850..42243%50$8902 %$ %$8.88%50 %$$97:..1472.943950 %$00.90950  .0%50 %$3:207.1.9/08.9:70%50 %$39071.7-084.03950 2:89-0/0130/147# %$.9439.

9202-0789.08349.40/  .8 .0398  09.439.0147/07.3...3. 542475.88%50 $..0/.9/0130.88 .20.%$. $:55479147.39071..3202-0782094/8 574507908 0.-897.8808 :9503079.

42243-0.08 339071.88.08..9202-078 -897.70.8808.8-.8808 94/0130 ..997-:909434090709073.94743.80.3 '8-9 ..-897..7090 -897. .90//70.7090.0/ .7.%$....3 9-0.43.8-9..90789.0/ 80..3 91:3.8808 2502039.339071.478147/07..40...9.943.8 80.8808..8802-08..9-:9 ..0/..3:809  .94341 .

20.%$$97:.8.9:709508 $.

.8841 /08..07-0389.../07.943950 %474:53..9.0/1742.  07..20.:0%50 %$39071.0/..35071472 $2.794.39..9.88 -:9..88..85:70.330.90/ %$3:207.7594341479.20.42243-.88$8902 '.0%50 $.80.-897.

943543907 $8902 :9.850.30/ %$00.78:3/07.90 &801:1470..0$8902 39 .4:/-0.8900..20.:05.3.039.:9$947.8 81:3.1.90950 $.20 01...3/3 $! %  .

9 8973 -44  .9.3 %50 90 8-90 8479 39 43 :43 14.80%50 $8902 90 $8902 $90 $8902 39 $8902 39 $8902 39 $8902 &39 $8902 $30 $8902 4:-0 $8902 -0.39738.9 /4:-0 4-0.%508 %.%$.9 $8902 $973 $8902 440.

074.8' %:808 .3:.903.94382.43.7-090232.943 $ $0941:/03089./3-:9' %/408349 %0.425090809 4110../11073839.9:708.484507. ' % ..0$50.9474..03 %.9/08.70.42243.943070.425072:898:55479 :808 147.4/1:3.1...3/.

.

 !:-..4/44  <  .$:-44 3/$:- 5:-.

3.9 /4:-0 4-0.0 08 4 08 08 08 4 08 08 08 08 08 08  .9 8973 .7 -44 $425.$425..3.0 %50 -90 8-90 8479 39 43 :43 14.

.88....  .250 5:-.

.

425.39 5:-.$.39// 39 39 709:73 < .

.

70.2094/8$.:43 // :43  :43  709:73 < < 3.999.90 %..08 ..0.943  .92502039.425.39 5:-.3:.49$.39 903..33907.425.

708 28.91472 $50.4/0 28.1.47- / 9907 !./07 .88 -7.:943330 0.74$41942243 -0.# % $4:7.0 4/0 %42507 47  28.4700 / .4700 / .884.:943330  ..80.:90 %0.9#:39200.

0.08.2085.0  .3/8.209508.3:.2085.2085.709390 %7:39202.8808 /4083 9 :8083. %..2085..0  .8 $890289074493.059 3.09...43. ' ....203.08:80 41908..0570/0130/80941.

2503 $8902...9.4/.2085.3 $8902.0  43840 79030 0447/  < <  ..8855  43840.883 5:-..0 :83$8902 5:-...89.2085.

2503' % 254798$8902 !:-.4/:055 $:-..3 43840 79030 0447/ 3/$:3/4/:0  .

4/..2085.47- / :833.0$8902 .2503..3  4384079030 0447/  <  .3.0/ :8328.

 5729.7-.08 -92.9.9438 $8902 .438 09.08 $8902 $8902 40. 42243 $8902 .9.9438  % 10 -:11073 09.3  $8902 %70. $6039 $8902  $8902 7. 0$8902 .9.9877.35:.943 09.40.0./3 5729.-. 439..9.2085.9.58 14398 .3074-0./8  .$.09508 . $8902 .250 %3. %70.3 $8902 7. 47.89 ":0:0 09.802.

.943 7.5.024 4384055.8  ..943 3/4855.

5907  .3/41.

 .

9438  ...5907 :/355.

-0.8802-08 024 :9.39073.$9:/4 % #010703.9.08 422.0  .3:.943 '8:.3/30425.

#9..9070.    .431:7.8.748419 %7.9 //905.2047.-08 4:-0. 0084.943147.7432039.8.0/ 3../0/  $.425:907 !74507908 /.7.!.3.

010 .8.943 425383084:7.3/30425..422.

847 .8.70900%08955 .8.%08955 . $.8 .7542507 .9.

.943 .55.70900 00.9.43840.

9,709300 3/48,55.,943

4:9 943,20904:95:90 42532:95084:7.0108
.8.

7$8902 3/48 4728 /%08955 .8 04 .8 

,250 43840-,80/

04 .8 :83$8902 5:-..,8804  5:-.89,9.;4/,3 $973(,78  43840 79030 0447/  < < 

,250 3/48-,80/

.

23433/48  < <  .3 $973(..043 ..4/.9..78  43840 79030 0447/  088.88043  5:-.8 :83$8902 :83$8902 3/48 4728 5:-.89.04 $4  .

4253:950$4:7.008 .

.

  088..7  5:-..7.4/85.88..7 .04 $4 .88  < < .8 :83$8902 5:-..

.

.047.89.7  .88047.07 .07  5:-.8.9.7 .3 $973(. 85.8 :83$8902 5:-.30.78  43840 79030 0447/  ...  < <  ..4/.

8 .7$8902 3/48 4728 /047.07 .8.7 .

79!.'8:.0  .$9:/4 % %$9.

93/4  . %!740.

!740.08 3/484728 :/883010.943 ...8.20.0 0-43974-7..943 3/48$07..043974 :/8$! %0- 55.8802- / $.0 :89420/0-439748 /43840-.7 3/4843974-7.88-7.7 4384055.9%508 3/4855..943 %0-$07.7 $! %0-55.80/ %..9.943 $! %0-$07..

74:3/4707 .08 -. 807.55...9438  ..

%.0 %444 $4:943 54707 '0 .88 '0  .3!.

9  .!740.431:73.

8802-08 %080.430/- %  .:942.#010703.39073.9.70570/0130/8941.8802-08.. 70.

90//93%448 -0.:2039390$4:7.0884770.974807 0503: 84:71703/ 4.90710.54398  #0.04/0  !70574.9.9:70841 % 0-:3 70.08  .

4/0 309  .75.0-$908147 9078  49/49309 .42  .8.

 .

.3:.8  .2039.5907 .0:3/.

3/$97:.9:708  .:0%508.209075.9478 .9438 3:207.3/#010703.3/ :95:9 '.9020398 439744$9.094/8.35:.88 43897:.9020398 $9.7..35:9.0%508 907.9.8.8.3/!.%'$ .8 $9738 .883094/8 77.943$9.9438.3/$973.

.88 %0:83047/.47:808 .8942..8.

.

908.04 ...0 :83$8902 472547989508/0130/349073.8147..8804.9.0 70.3 8973(.3.902039 01308.3.8 :8370..9-0/85480/   5:-.08  .39.8.9.2085.89.78  43840 79030 0447/  709:73  < <  ..34-0.88 :83$9.450.2085.99003/41 .

..9438 .8.7.88 '.

.

04 ..9.78  .4/ .8804.88  5:-.3 8973(.8 :83$8902 ..89.

.

 < < .

.

.9.88  5:-.89.8804.4/ .04 .3  .8 :83$8902 ..

.

 < <  .

7.422.3/30!.209078 .

.

5 .78  43840 79030 422..3/305.89.9.39..78 039  .3 8973(.88  5:-.7.8 :83$8902 .209078  147 39 .8804.

.

78(  709:73  < <  .78 43840 79030 78 < .1470.. 897383.

70- %  .98320247 .70.0 .94 89.9:.0894904-0.3..03.24898.8 30890/01.7/94.07843 04.0.94389.3/34990.4-0. $.88.40.9 389.3/.88.9. $.34-0.7.9...98 .30 04.  4-0.90. $%#&% #$ 478.707010703. 4770.7-.88  .  04. .-08.20..250 0.

78  !439530!439 ..8 .9.4/.39 5:-.947 < 5:-.3 8973(..39 < .89.88!43955  5:-.!439  43840 79030 01.! !439 .:943897:.!439 395 395 55< 5:-.88!439  5:-..

.

947./01.43897:.:9..0/ !4395 530!439   .

.

43897:.7.0/ !747.430 ..2 397!439 43840 79030  :9 <9< 5  5   43840 79030  :9 <9< 5  5   < < .947.

.-08.:9'..:08 !:-.7.01.

4/.250 .395:-...202-078.:942.8801.09/01.89..9.9.3 8973(.:9.:9  5:-.94- 5:-..4-0.:08 .78  01.:9  .:9/3001.

.

:9.90/01..:0 < < 4.0..202-078.

...9.4/.0/ 5:-.-082:89-005.78  39 43840 79030  .939.3 8973(.89.7.

.

7747 <  .

$!&%  &%!&% $8902 43840.250 #0.3/#0./ .3/790./30 ./.8973  .88 790 79030 #0.

.

.9.#  5:-..89./30  43840 79030 $973 < 8  < <  .8 :83$8902 .4/.78  89738 43840 790 3907.# .3 8973(.8.88.8973  843840 #0.

. .8.

.

8.  5:-..9 .9.89.3 8973(.9904.. .4/.88.8 :83$8902 .78  399039  14.

.

9  43840 79030 $973 < 90$97  .9 < 904./4:-0904.9 8  897390$97 % 43840 79030 39 < 9039  43840 79030 4.

.

77..98 4-0.9(4- %   < 43840 79030 $973 <339<34.9<3 4-  < < .414-0.

250 .. .993        47.  0. 0/5439 0307. 543039. :207./0. %$973472.2.2. 0. 47/ 470 471 47 473 47 :7703.

.

9 /<   43840 79030 472.9  5:-.8 :83$8902 .9 472.78  43840 79030 472.3 8973(.9 <   < < 472.9 ..9 3<   43840 79030 472.9 472.9 1<   43840 79030 472.89.9 0<   43840 79030 472.9 <   43840 79030 472.9 1  .9 472.9  472.472.<   43840 79030 472.9 .9  0  472.9  472.9.4/.88472..

:0950477010703...09508.0 -.0950 !729.07 .:095083.80/  .  :98/090 8.7.-0.:/3 897:.:0..0%508 %95082..9:708 %0809508.8808.70.:0950-:97010703.'..-08-054550/4:9 40..70.90/439089.70349 .450 9080.8.3/#010703..4..

250  5:-...4/$420094/  39  .

.

8 39 .

.

84 39.8.

.

..898 .33349.30 <  .

.39  < 5:-.250  897:.4/$420094/  4413044  .944  5:-..

.

883..:0894.3/ 4411 ..

.

.:08411202-078349..301202-078 <  .4/13.

.90/4390.095087010703.90/0.204-0.3/.889508.094904-0.70.5 8832039417010703.09508 %080.7-..4.9 .9020394411 .88%508 .3..301  .8.0 .88 44  5:-.70...3082.7010703./01471..87010703.250 .0908.39  < 49089.40.9 1.

9:708 0.'.4 .0950  .-0 39071.:0950.2470/00507.9320247 8.0 .0.#01 .439.33 #010703.45 47.45 4:.250'.8832039708:98437010703.8  ..:0%508.0%508 03.430 5439394908..0943/0503/039897:.204-0...45 02:89:80430.439..3849077010703.

250 ..

.

#01 .8 .'.

.

. 701%50 .9.88 3307#01..0950 -0.#010703.'.:0  .9... .:8098.%0#01%50 89738 8< < .9#01 897:.9.%88..9#0130 3307#01 39.9.9#01 897:..8973 5:-..88%0#01%50  5:-.

.

93307#01  5:-.9.%8.39897:.%0#01%50701%50 5:-. .9.9:70950  ..:8098.897:.'.'.:0 897:.:0950 -0.2 39.

.

701950 .

.

.2 ..:0950 .9#01 701%50 . .9.9.9.9.9..9#01..9#01 897:..9#01 .. < < 3307#01.9#01 897:. 701%50 5:-.9..3307#01 89738  701%5030%0#01%50 8  897:.

.0/174290-.20.89074/0$8902 -0.9508/07.9 ..9.88 .0/$8902 -0.88  < 88.88 04.88$8902 -0.80.8804.9  <  .9 .07/...8 ..

-446:.8 4-0.....84/0  5:-.0/.79:.%5009%50  5:-.440.94-  5:-.4/3.94- 4-0.88 5:-..$973%4$973  57490. -0.79:.0$8902 5:-.9  5:-.79:..89.9.9 .94-  5:-.0  57490.89.077//03  -/07.2085.-44#010703.8 -0.250 3..8 4-0.88 -0.94- 4-0.06:.3-04.94-  < <  .902-0780430  5:-.36:...79:.3909.90/.90/ -0.9..

20902320247 #09:738.97024.0 #09:738$8902 %50 #09:7383.20389731472.40.3390079.9.0 02-0780430 #09:73897:0431909028-03.0.304-0.9 474-0.70/70107 94900.45 90.8202-07 80.:770394-0.9 6:.425..850.4-0.9 389...883.8 09.2085..943 #09:738.1.0 .7-. .9/039108.84/0 09%50 %4$973 3.47002-07841$8902 -0.3.98.9  .

9094/8 .90$8902 -0.70.

.

3.. 09%50 . %4$973  43840 79030 09.80%50  .78  -%089.3 8973(.9.8 :83$8902 .20389.30 -%089  %4$973 -%089 09.84/0  43840 79030 09%50 < . -%089 .89.4/.84/0 09%50$8902 -0.84/0 < .9 $..88 -%089  5:-. 09.0 43840 79030 %4$973 < .

.

20389. .94.0  < <  ..70. 1 4 6:..8 4 43840 79030 $. 6:. 4-0.9 -%089.8 .3.43/4-0.9080.

20 89733.89731789.2094/8-4.370/013090-0.  1789.4741.79:.250%4$973 6:.077/3$8902 -0.20 $$ 5:-.0/.88!07843  5:-.79:..9094/8 4..077/3890574.0 <  .07/3 .330790/./07. .-90.!07843 < 5:-.20 .0.20 $$883 .20 .203.!07843 897313. 202-073. < 5:-.20 8973883 -90.89.89..0884170/013390-0.8 09...4741..88 0.2013.

20 < 98 1789.077/3%4$973 %41472.20 < 98 .9908973709:730/-$8902 -0.20  8- 5503/472..9 .20  8- 5503/472.9 0 <( 98 ..89.077/08973 %4$973  $973:/078-30$973:/07  8- 5503/472.0  709:738- %4$973  < <  .9 %4$973 :83$8902 %09 .9 .9 $$ < 98 $$  8- 5503/472.88!07843  5:-.4.

;077/36:,8 
6:,8 709:73897:01,3/43190944-0.98 -03.425,70/7010703.0908,204-0.93 20247 0.,34;077/098-0,;47,3//0830394 4-0.98,;0908,20;,:0 ;,:0
-,80/ %,98  033,20 $$ ,041944-0.98,7006:, 903 709:7397:0080709:731,80 

,250
.,88!07843  5:-.4;077/0-44 6:,8 4-0.94  !078439025 !07843 4 1 9025 1789,2098 1789,20 9025 ,89,2098 ,89,20 9025 $$98 $$ 9025 ,098 ,0 709:7397:0 080709:731,80 < <

;077/309,84/0 
03,.,884;077/06:,8 984:/,844;077/0 09,84/0 #09:738.:89429508-05:93, $8902 40.9438 ,89,-0950 %06:,8 ,3/ 09,84/0 2094/8-0.,0/-03/908.03094 /090723090.4770.995094709:73174290.439,307 0307,94341,8.4/0.,3-0.:89420/ 34:70,250 08,:80$$ ,$973202-079,98050.90/94-0 :36:0 ,250 7010794 ;077/0 .8
5:-.4;077/03909,84/0 
709:73$$ 09,84/0 <

,9,%508
0;0739738./,9,9508,.9:,,3,,894,3 0893950/0130/390$89023,2085,.0  ,./,9,950,,808,0
/0130/897:.9:70 950390$89023,2085,.0  /01308,3:2-0741/,9,9508 -:943,8:-809 419040,70.425,399907:084190$ 

 $8902 $973 $8902 -0.9 #.9 $ $8902%50 4 08 08 4 08 4 08 4 08 08 08 08 08 08 08 $8902 $90 $8902 90 $8902 39 $8902 &39 $8902 39 $8902 &39 $8902 &39 $8902 &39 $8902 .30 94 94 94 94    94     94           94  94        & 94&    94       94      97:0471.7 14.3 $8902 0.80  94   290/-8890220247 393. .2.9 /4:-0 -44 /0.9.9.2.. 8973 4-0.8 8-90 -90 8479 :8479 39 :39 43 :43 .%508 .7 $8902 $30 $8902 4:-0 $8902 440..

 '4/ 4:-0 ..41$8902%508 -0.88 &39 0.3 &39 90 &39 3:207.3/$97:.7 $973 77.9 %50 .7.90 $90 $30  440.3/349 .3 39 :9.07.90 '.9438.2.9:708 .8900.90%20 39 :/ 39 %20$5.:0%50 /07. .9950 ..05943 00.0/430 8 897:.

:0 /4:-0 !489.:0 4:-0 /4:-0 ..03139 440.9.:0 /4:-0 3'.'.:0 &39 3'..03139 /4:-0 0..3 -44 .80$973 -44 %7:0$973  .2508 390078 &39 .

47.2508 .7 89  ....7 8!:3...7 .7 809907 .7 809907    ..0 %  ..7 890$5.943  .9:.

 39  .:08 39 14.3/#010703..0%50 '.-.80/20247 . .$9.250390 473903039   $9.'.:0%50 '.9 ...70:80//70..7089470/3.:09508.7 03:2 09..:0%50.:09508 %0809508.70.9-907.

50   $.5070.5 -0.0.98 $.7.4.70.7-.984190809508.90/3.0/0.50070.50%02570.97010703.930$.-08 $.703/70.9 $.0'.40.0/ .970.50  -0.#010703.9438.50 .3.930$.0%50 %0809508.2.50 $..3/0/- % #010703.

250 390 4-0..47708543/3 7010703..   .:095085.07300/0/ 47 0.43.7...250 03.:0950394.9 903-438/430.880/94.5507...9.2094/ 706:73.. .3/&343 43 5..-08030..9.0793.:942..34-0.43.9.:942.94-00 4300/147.880.37.-408.0950 ..

97010703..5  39490.:03.90..7..:0950 89. #0202-079..0 0/30.8 570.34-0.079390.94-0 390 39 4-0.&343 43.4:8-003-40/ ..250 4-0.343:3-4.9..-09.47708543/3.

.

  8973897 8973 4-0.

.

9422-903 -90 42.743 392 4-0.

.

30/390-4839 .3/3498973  .07747 %0950.439.

4/.3/&343..78  ..3 8973(.43.2 89.250 :83$8902 .88!747.9.

.

70.339 .:0950  39239 ..90.

.

:04148 < 4-  43840 79030 4- 09%50  43840 79030 39 4- 09%50  < <  .34-0.0.2094/57494950/949..:8023985.9.9 2398 -40/ .94-  43840 79030 './30  < 89...880/394.9.9 239  43840 #0.4/&80%8 -0.0.:942.9 4-0. &80%8 -0.

:0147.7.0 .0133!747.1 5..9.39/.8830/94.907.24389.7.4389 047/.-0 .3349-0:80/946:..9.8...:08 .20907847709:73.425:90/.-0  .4389 890047/:80/94/013010/:3.4250920  %07014709..34-0..9 7010703.94.4389.4389 -0.3349-0.398 .

.

8832039  .743.

.10/3.4/.274.349079509080.89.0133!747.88.3  43898973897 ..39  5:-.438939 5:-.1: 6:.43898973897 .20 :83$8902 .24389.0880/-.24389.. .4389..398 03..3982:89-07010770/...43 5:-.9.

.

4...4389.39932094/8.450 43840 79030  <3<3<  897 897  < <  .

39.9.93.20 .89.88.43898973897 ..34389..-84:905.  43840 79030  <3<3<3 .7488 %508 :9190.4389 5:-.4389.43  .3/8970707010770/384204907 950 9030.43 897 897  < <  .4/.274.094:80..#010703.9.398.3 ..

 3 445 0 445 /4 0 445  ..94343897:.98 147 445 1470.907.

250 89.8  .3 8973(.07.78  .-4.904.41. .20.4/0...9.10/3:2-07419208  147 44588.%0147 445 474458:80/94907. 09..4/.

.

490  843.8-093908.4504190147445  147 39     43840 79030 :2-078 <   < .

.

  8349.3:80494 -70.08  .8-0070  < 4:. .3:.04907..4393:0 09.

..%01470.

470/.-4...3  $:/7< 393  1470.208  1 8 3/0 1     3  < 43840 79030 4 41$9:/03988.89.8847..3 8973(.208308973( $.484:94907.07.904.77.3.9..78  8973(.  5:-.047/.0  < 3  < <  . 94:990300/94908914790 .4/.902893.98  %22..77. 8:550729  :83$8902 . 897383.   7.3 445 %01470.

3//4.%00 .

0 445 .2#0.9.25 /..4/.0147.9.78  97  $970..70:3.9  8973897303: 0 897#0.079.43/94394-0 209  .3 8973(.0  < < < 089./07897#0.9020398:801:14794809208034:./  5:-.93.880#0.34439299.059430  43840 79030 0 088./070 503%09 . 0494:3/..89./07 480  < ./30  3:  43840 79030 89730  < 897#0.90723./07 #0.

9020398 &303.9020398 1 1 080 $9.43974$9.3/ 901.

94780  .3/-44 3 ...250 .84.0-0900339 .3057088438  349..943.90203934507./4.4507..70.704190/110703.8   #0.40/3 43/943.94780      09..70.:088:.40/3 0.9084343440.4507.08089.

.

339 349.039..-44 897394:9 1%0.34//43097. .4:90.%880..9039709:738. 039 .8 1 94:9 1%0.

.

07747  <  .

.:9 .974: 983. .8084:/. $9. 9842070897.%089.902039 $.4:397 89.0.4/ 1..4:397  . .80..250 89.20.9438 .84 .:/08/01.8  09.-70..90203994.07. 89.

.

:9 < .7747 34-70.80&$ /01..803/.. . .

.

 ..  -70. <  ..3/.4770.80&$&$  -70.803/. /01.:9-70.9 .

 .8043840 79030 44/.78  43840 79030 ( ' %(  43840 790 !0.3 8973(.043840 #0...0 8.0  8973.0  89.3:.250 89.3:.057010703.99../30  39339 !.130. < <  .8043840 79030 ' % ! 2:9970.805.4..9. 3  .34.$9./3 . /01.4/.34.0   -70.9  -70.:943840 79030 0 44/:.3/2470  -70.780 .4:7.

803/.-0 5.3-0 .4:397  . 974:3.91.494 $9.0/-:83494 89.250 89.0..89... /01.902039 494.80&$&$  -70.. .902039 .3/..902039. 89.80&$ .  494. <  .:9-70.

 507.94789...0:80/3.9478 4507.84-0:80/3 .250   .3 .94:.3/ .

94341.9-09.3/...89-090039508 %095041 4507.9478:80/94.9478:80/947057080397:3920 95031472.4507.425.8 %08 4507.34-0.03950 %0.     09..8 4507.9478:80/94/43. $50.94783...7095041 8 .071.88  .98.97:39200907 .

.947894/09072301.79.5.739071.:..9 4-0.4/85..94-  1 4-839 43840 79030 %04-0.0 5:-.984195039007  080 43840 79030 9834939  <   .034-0..9 8:554798. -0.250 8 42243:8041984507.

/907010703.8./.80/ :93.89.05943 3.83..4/.8 340.30.8 4:.8 &83.079950894:97..891.0594387.  4/.9.33.893 190..43..80.250 ..3.0-0 809943: 89.84..05943 87.332.332.80/ 3890...7 32.

.

4  <   .332.80.78  080 43840 79030 49.4/ 4 . 1 /3: / .

0 .88 .88   .88  43840 79030 2%50  :95:9 %5041 .88230..00.250 95041 389.880.3.0 %502%5095041 .88  43840 79030 2 09%50  :95:9 %5041 .

. :89422094/82.70349.7.-0/0.8847 897:..40/3.472. 472.3499.882094/8 . 2094/2:89850.209078 :89422094/82.041.088-9   .2094/8.349709:73.3/ 89.:08 2..9 4-...0133:8942..70/343 89.1900.072094/2:89-0570803938/0.9.05.9..

90/39073.4/094/ < 57.:77039...90/ .3070 .03/039 ..4/094/ < 57...3/98/08.0888290/9490. .8802-479508/07.088$50.0/1742 90/0133. .:77039...088-0431742 90.094/.88.208802- ..4/094/ < .4/094/ < 57490.088-017429843 .90-/01.:9 57490..90 .88070/0130/ .4/094/ < .8802-   .1078 5:-. .88390..088-0.088-09390 8.4/094/ < 39073..

1078 .094/.088$50..

.

02-07.88  .88$420.8-9459438 ..

.

088-0.3070 5:-.094/ < ....4/!:-.

.

889508 57...088-0431742$420..90.90094/ < .4/!7..

.

088-01742$420.90/094/ < .90/.3/08...88.3/.03/039 57490.4/!7490.

.

20.094/ < ..8802- 39073..4/39073.088-0174293908..

.

.4/!7490.90/..90/39073.90/39073.094/ < .088 57490..8802- 57490.

.

7057.4/$420094/ < <   .:93 .70/202-078..&32.90-/01.

9.4/.88   ..88 0.8 89.9.-0.70/.9/408 89.90. %8882.3389.0//70.91742. .3 094/82.3.2094/90398.3  89.9.7.0884:/-0 438403043840  79030  5:-..794 43840 79030 19.04190 .34-0.$9.3-03.9.7.38 9070834300/94..70.88  0 ..8349.3/903.0 %820.9.. 2. 97:3920... 2094/20.89.9.89.40/94:9..34-0.3 .-0 ..-0 419003.9.094/8 .483..9.

78  .884-30.9.70/ . 903 ...3 8973(.9.4/094/  < < 5:-.9.88.88 094/  < < 1094/ 8349/0.9.88$9.88 4- 094/     ..89..250 5:-....889. .89.4/.88  5:-.094/  5:-.

.941989502.2094/8 .90.9..38.//9439489.9.9./. 03. 0.9.4-0.9502.$9.45419010/ . 3.88/0130834389. 57.9.250 ..39..9.84/013089../.9..

.

:77.3..0 .3.83050.38./4:-0.....3.:77.38.0 10/8.0< < 034:.4..8.98 2024714790.0   .04134389.9.38.$.3.90/1470...4:39  5:-.%8.389.88$. .3..4:39 /4:-0-..3.4:394-0.....:77.0 5:-.90$.70../.88.9.0-.

9.89.88$.:77.9.9.9389.4:39  5:-.3/ 8.90/43.0  .20950 ././4:-0.0 < <  .0841908..38.9...3..$.:77... 4-0..0.0 5:-.0-.$9..3.:773907089#.9../4:-0.243.4.70/.3..90  5:-.3/8.4:39 /4:-0-..38.3. 43904907. $9.3.

.70.38.$9.3.9.4:39 89.909700389. 14:07094.9..3 8973(..4/.78  .0841$.9..

.

38.38.:77.38..3...38...4:39830$....4:39   $..92.38....010/ $.38.4:39    <  ..38.4:39   $.$...38.454190..39..4:39830$.4:394-0..4:39830$.

9.9..9434:/44842093 0  .4.$9.9. %03 20247/...

88$9.094/14/07 :83$8902 5:-.9.  5:-..9089..8973(9028308973( 57.9089...89.39945  < .9.9.9..4/$4  147 39945  43840 79030 9028(  < 57..89.9.$9.8973!45  709:73 9028945 (  < 5:-..89..4/!:8 89738  9028 945(8 < 5:-.88 $9.9..

$9..9.88 . $4  43840 79030 902!4550/ $9.78  43840 79030 $9.4/...3 8973(..4390398  $9.88$9..... $4  < < .. !45  43840 79030 $9.9..4390398  $9.. !:8 %  $9.89. !:8 $  $9.094/  5:-.

0 '.7.!.7..:9 4:9 701 5.20907  .7.20.-03:2-07415.7.7.20907!.209078 93.7.28 '.20907 :95:95.7.8305.88 - 7010703.:05.85.0/202-07 $.883094/8 01.20907 .

//   4:9708:9  43840 79030  < <<   708:9  < <  .89.2  5:-..89..883..:9 !.9.7.250 :83$8902 .9.4/.88 :9!.38  .4/.// 39 39 4:939.209075.38  < 5:-.7.3  39  708:9  .

07 ..90.0414:9 5.!..883 30.3 !747.. 7 4:9 .3709:73 24709.2090795089. .38 8 // .7.4/// 39 39 4:9 39.:0174290.0/ !747.0/5747.2 .29490.38  ./.39.4:9 7  5:-.3430.7...2   ..20907!.

 #01 $.78  39.5 <9< .9..4/.5 701.89..5 70139 70139  399025 9025  9025 < 89. 39-  43840 79030 01470$.%0701 2094/ :83$8902 .9.5 <9< . . < <  .88#01  5:-.3 8973(. 701.4/$. 43840 79030 1907$. ..

7.7.943 %05.-03:2-07415.0..7.830/203843.7.3/0130. 094//0. . 0804:09.34-0.2090783.2090789  .307747 4:.7.209072:89-0.28 2094/ %4.%05..7.0.9 3905.77.28 5.7...

28  5:-.4/.250 :83$8902 .88!.9..28 39(89  43840 79030 28  147 39 89 039 43840 79030 89(  < 89.7.3039(  < 8577398 89 3977.3 8973(.7.89.4/8577398 897328 5....78  39(3977.  8577398 89      .9.

.

3803/24700020398 8577398 89    .4:..

.

4:.3803/0880020398 < <  ..

88!07843  57.  3...34-0.784/ 3./41:8343.0 < <  .9 5:-. < 5:-..90-90.20 ..!07843 89733 -90.33900789147905.9089733.4/!739!07843 43840 79030  <8<0..7.0 5:-.3:80.7.0307.28 5.203 .28 3890.:80415.7.0.20 57..20907 0 .

98 5.3.3!747.9.89.4/85.7.98  5 389.2 !07843530!07843 43   85.9 5:-.284-0.784/ 43840 79030 89(  389.34-0.3.9( 89  147 39 89 039  1 89(8!07843 !07843 89( !739!07843  :95:9 080  4380..88.5.041$8902 $973   . -0. -0.041$8902 $973 < 43840 79030  < .

9.4/!07843'.:0 !078435  .30 904-0..883#010703. -:92.35747..89.095085.90/. .:041904-0.!.349.880/-...22.9987010703.0%508 '..:0 1..9 889.3 5:-.:0 90.9.3090.7010703.

.

0  ..90415 5 ..3089.

.

90415 530!07843    <  ..349.309089.

9 889..3 5:-.90/.4/!07843#01 701!078435  ..30904-0.8895085.0 90....9.883#010703.9.!.998 7010703.0 1..8904-0.89.880/-7010703.0%508 #010703.2 2..35747.80.

.

90415 5 ..3089..0  .

.

304-0.5543994.9 530!07843    <  .

2 .3!747..

.

:0 009.:0   009.883'.88-'.8 0.:0   !0784330!07843 009.784/  !739!07843  .784/ !07843'.883'.!.80.:0 43840 79030 !.    !739!07843  !.

.

0 43840 79030 !.88-#010703.883#010703.0 009.80.   7 !739!07843  !.!.784/ !07843#01 7017  8 0.0   !07843730!07843 009.784/ 7 !739!07843   .883#010703.

88 0247 147.4.250 39(.5 77..77.8 950(..-.90/30.77.83.3.70/0.20 ..8.83 .77.80.88.70/.70/07.0/1742$8902 77.77.

.

77.0 39(3977../0.3039 (.7039007.7010703.

.

77.308973 (. 8973(89777.39007.

.

8973. 39(0  < .77.

.

1130!07843(.7747 706:70830047/ !07843($9.

.

9.4-0.77. 897. ( % .77.

.

8838420...:0 39(03039(   < .

.

39.943  .77...

777.77. 39 (2.3:.8 #0.:9/203843.9.97.

.

9.70.973039 ( <  <<./0. 39 (2.77..3:.7.70.

.

39.0 2.97 (.

.

088.0 ..0/77..0/773039((. 39((2...

.

4:238 147 39 2.748.0..0/77(3039 ( 4909.0/77 039 2.4:238..3/.4:238  .3/3/ 74..7.0 .-0.9 89 74.

7$0.7  45%4  09039  039 094074:3/  09&55074:3/  09'.$8902 77.3041002039894 . .03902 $0987.80.0780  $479  3/8.:0  #0.88 3..  0.7.:0  $09'.

0780890.439039841430 /203843.77..0847809890..430 /203843.3/:5507-4:3/ #0970..77.77.0398 3/0 #0.943. %4/090723034 410020398 0398.:041.3.0940893.0 .3: 4584:7.70./ 435745079 %4/0907230407.77. .. $4798.

4/.4 .77.250 89. . $..78  8973(1789.208$90.3 8973(.0 423./< 43840 79030 070890.77..9.

.

208 039 43840 790 .8/0.208.!7393.070.0780 1789.43..20 <9 1789.0780/ .77.208(  43840 79030 3  77.208  43840 79030 070890.70/ 147 39 1789. #0.

.

208(  43840 79030 3  43840 79030 0.3/5739 147 39 1789..20 <9 1789.208(  43840 #0.70/4:9.#0.20 <9 1789.-:9. 0.208 039 43840 790 .77.208    147 39 1789.7 1789./   77./30  < .208 039 43840 790 .0780.

.

74:9./  .0.-:9.

9.  ./77.250 5:-.39( #0..89.

.

 39(.89.9./89000203984190.77 039  709:73.70. .   $8902 77.77(.77 < 5:-.77.773039( 147 39 .77 039 .39( $47977.  39(. $479 .

.

 709:73.3. <  .84798.77.

 3977../77.3 8973(.   .2 5:-.4/.9.3!747.89.78  39(3977..#0.

.

 3977. .77. 039 43840 79030 3977.70.-0147084793  147 39 3977.(  3977.$47977.0020398 43840 79030 77./90.

.

190784793  147 39 3977..8479900020398 43840 79030 77.(  <  . 039 43840 79030 3977.

9078.3/349..35:..9078 95.7.$973..870:.339.4/0.94341&3.70570884389.9.90.324/190...35:.88  8:5547989495084189738 22:9..806:039.90.9078.3  .9:.9434190$8902 $973950 19830..7.088..:80/94705708039 909 %08973047/8..439..439039841..30/ 3902 .-0 0.334924/190.40.30/ 3902 :9.94383 89738.3-0:80/147 .339.425089732..9438.3/5.10.990732.7.9.848:554798..8479.79424/190.8973 :8090 $8902 %09 $973:/07.439.-0 0.9:70343..

.8047407.7..047705..4541.897398420.80  .9078 %0802094/8.425480/4194 /8.80..0389733 :5507.7.308938973 &80/9438079.038973 &80/945..$8902 77..88 039 43.0.709089738 425./.0  %4&5507 %4407 %85745079709:738900394190.98..3089739.907 %0802094/87024.70%4  45  38079  !.:770398973 %82094/709:738.4541./019 !..897393..425.0  #05.7089489738 %82094/709:738..9  ..90. .70../#9 #024.170830.

3/ $9.8:-8973 :80 45.893/0 1 .$9738 478973. 425.3/.3/ %72$9.893/0 13 %4.8 3/89 .7941908973 :80 38079 #05..0 #024.0 !.3/45%4 %4.70./019 !..3/%4&5507 %424/1.70 7/3.3090.80 :80 %4407.70%4 6:.7989 %44-9.3903/041908:-897347:3.3/$59 %4.475./#9 %72 %723/ .8973.4/0 :80 &803/0 1 3/0 13 ..425.45.9043047247089738 :80 $:-8973.79 .70 425.78438 :80 425.

70 8 8  43840 79030  7/3. 8 8  39$973 425. 425.70  1  43840 79030 .  080 43840 79030 .  080 43840 79030 .  0801  43840 79030 .70 7/3. $9738 39$973 425.  :5:9 7/3.70 .  43840 79030 425.  .  1  43840 79030 . .  0801  43840 79030 .0.3341$973094/8 $9738.

.0 00908.70%4 8 .041$973.454198$9733407.9..0 39 89.10/389.793/0 8973 .80 .3.850.3.4:39  38079 380798.0-0333..9.8973 38079 39 89.70%4 398 425..3.:0  %4407 #09:738. 850..10/548943  5:-.7.25088 %4&5507   .3/709:738 .0  5:-.339 #024.9078 174298389.850.793/0 39 .47043$973094/8 425.8973 #024.10/3/0548943398389.850.10/3:2-0741.

$8902 %09 $973:/07 0.09 .90/ 094/89.094./ 4:709:73.3349 -024/10/43.0/22:9.9:.8 -003.9 3890.7034924/1390:3/073-:110741900893 89734-0.30 $973 .339024/1.8973 4-0.79424/190...039 84209208 944743.3349-024/10/43.709:73. ..0089.550. 89738.88  .1708.454190-:11073 :5507..:8098..8973 04-0.80 98349011.38 89738...-0 %820.439039841.9 :8090$8902 %09 $973:/07 .9 4:..943 19830.250 034:803/%4&5507 2088.9..088.:0.$973 ..45084189738 84:943 &80$973:/07 1742$8902 %09 490 $973 8.7022:9..79424/1.70.-80/ 470..-0-0.439.9:.

88  5:-.4/.9....88.3.3   $973:/072:110730$973:/07 :1107  .89.250 :83$8902 :83$8902 %09 .

.

9090-:1107478973-:/07 2:1107 5503/ 8.90/  43840 79030 2:1107  .70.70..

.

80  8973407.8973 8973:5507..0798.802:1107 %4$973 %4407  43840 79030 407.%4$973 .$973:/0794.802:1107 %4$973 %4&5507  43840 79030 :5507...80  < < ..43.

/08. 574.:942./08.208 .-03.9..908.39 ..:08   %81.93 .250 03:2447#0/ :0 7003 04< 03:2!48943 11 3<  .9073.3841.9..:807 /0130/39007950.020.70.4389..33.147..7.99.3.89 4147/8-.3:207.8833902.03:207.9574.9438.208943:2-078 %003:2047/.94383 33:207..

94739.943 .3:207.8 ..250  03:24478  #0/  7003  .3.55382-4.20894 3:207.

.

 :0 .

.

 .

.

4478 :0 43840 79030 . .9438 4478. .9438$8902 39 &833:207. %039073.950:80/147 03:207.

.

947 '! <  .250  03:225%50-90  ..3.07 4707 4397.:0 < .

9 09.:08 80130/ 43.88 472.:041.90/9509498 897306:.943 43840 79030 3:2 09&3/073%50 95041 4478 .80.4389.2014790..08903.39390 03:207.20 09&3/073%50 09'.$8902 3:2 ..303:207..943 #09:738909504103:207.0798.039 #0970.

.

.07988973.77.3983 03:207..41.$8902 39 .08.390898303:2 1 3:2 80130/ 95041 4478 :0  43.4389.4389.0.3.0907.943 %4.:084190.

780 95041 4478 #0/   .:09403:24-0.780 4478.9 !...7447 4478 3:2 !.

43840 79030 3:2 09&3/073%50 95041 $9.004447  080 43840 79030 4 0/43 9.11  #09:738$8902 39 1 3:2 80130/ 95041 4478  04 43840 79030 08 0...004447    .

.250 77.9 95041 4478    < :95:9 #0/ 39 :0 39 7003 39  .:08 95041 4478  1470.4-3:2 09'. 447834-  43840 79030  %4$973  43840 79030 39 < 3:2 472..

..390 011.3.43897:.9478 2:89.3.090-030198414-0.9:708.0 .03..3.08 .7:20398 0.90//.9:708.4189..9478 9...94..3 970/0130/01.9 2.0.:0%50  . $97:..3 %070834$8902 $97:.9 47039.4...0/1742 $8902 '.. .58:.3250203939071.43897:.88 /07.70.943 0.9:7083 $97:..9..02094/8 31.943  0 03.$97:..9:70.439.:9.

$%&% 397 89733 392  #047 ..3.782 < < .   < < ..20 5:-..78 $%&%$420 3030$%&%  #.9$%&%  5:-.203 .250 :83$8902 897:.9.4/.88  5:-.88.89.20 $%$ 8 .3   $%&%8 8 #04 8 ..39.39#04 5:-.78 5:-.8973.

9... .2085.082.3.2085.20 $07..2085..2085.830 3.0 0 .88083.0 !:993...3.0   $8902 2 2%09#0.0 $08843  08945 0-& .349-0.705740./0797  425.3/01304:7433.2085.3.2085.943147...047..0833:8942.9 %4:80../0797   :83$8902 2 2%09#0.0 &8390047/3.0 %5.2085.3.44/ 57...07 &80739071.08 $8902 890 % 80893 3..

8808.250 88:209.94:.5574..3/0.8808$6:..5.08.43 %447..70/0..309080.70 94.0 .943417.0453.70 7.3/8.4:/ -0:80/ .40.. .

.

43 <  %$.890.2085.508  5:-.0$....508- .0 ...43.950  < .8 :83$8902 .503.8..887.880.0 < 5:-..059:.307 410. .98.88$6:..70 < 5:-.2085.439..

905574.9073.. .

.

.70 .88$6:.508  .0$..70 < < .8 :83$8902 3.$6:.2085.

.

2085.0 < < .0 .8 :83$8902 3.887.7.0$.508  ...

.

.8 :83$8902 3.43 < < 909700.43  < < /0130/3$.508 :83$8902 :83$.880.0.2085.2085.43 .70 7.508  .055..3/ 0.8808$6:..2085.943  .508 3.88$.0307.70  7.0$.4300300..0 .5083.43..708630$6:.705:93903.50024  $6:...2085.0  0.0 $.0 ..

88$6:...508 ..508  5:-.0 < 5:-.08 &83$8902 .887.8083 3.20..3.508 :83$.0$.880....#084..2085.70 < 5:-.43 < < :83$8902 :83$.2085..

.

70  %0.708/01303-49 903.88990 .0983.508.508 $6:.204190..08 %47084.70$630$6:.:93.903.557457.508 $6:...3/ $5.8 :80 $.0 %0/01.70$6 30 $.2041905740.7747 $6:.9  .70  ":.033'$ 8903.20.2085...2085.2085..1903.88$6:.08 $.0.

5907 .3/41 .

 .

5907  !9  ..

3/:9.947 809 ..08847 09 .-0.8.883 '8-9 3.20/!745079 3079.58:...943 .88.0/.8808 !4247582 -897..3.9..3/094/  .9.0 $0.08 .

88  ...43889841/.0307.888.:8942&8070130/%50 &% .9.9438 2094/8 .997-:908 .250%424/0..8808 .3/1:3.325400.88.25400 0.3 /0130. .

...47 36.&.25400.. 4.9/.4 5.: :..  61:73..61: 6165: 36.465.95335.:   .88 4736 .099#..

2085..$4:7..8825400  ..025400  5:-.04/0 :83$8902 3.

.

9014..20 57.9039025 57.:77!.57..9.9.9089731:. .90/... 57.

.

01.947 5:-.:9.25400 < .

.

9.20 39025 14.25400 89731:.:8942.947 5:-.:77!.  .

.

 <  .20 98 025025 98 .201:.9.88339073.89.. 490:8041 98 047/ 98 1:.:77!.:77!.90/.

04/0 439/ .$4:7.

.

 .9.4/.24:39< .:77!.043:8 14.14798025 5:-.:25905..24:39 .

.

  43840 79030  < 025  < 5:-..4/.20 < 1:.:77!.98  < < <  .3 8973(.4/85. < .$9.9.90 5:-.78  2540003025400 40      0 .$49089.043:8   0 85..98  43840 79030 .89.20  43840 79030 !.$9.

.430834930../0/ 472094/7084:943 709:73950.  <  .708.9438.088../3.20.3/ 98 .088..7 08 1905.70..:77!.7 890047/ 98 .7.84-0:80/94147.943 5:-..0430.3..88202-073.094/ .3/90.20.830.9.8 43897:.20 98 1:.25400 89731:.43897:.3-04.209073.9.074.94794.20.20  907804 $9.20 0925/ ./341094/888.074.9478.074.202-071:3.3 9:80 98 047/  %0047/ 98 .34907 /:73904-0.

70/0133490708543/94908. !43.47/0130/--.3/.077/090-0.094970..20.970.38..8 .943/09.439.3203947/00. 038:- ..72502039.0 8 .80..8 3079.88084.58:.88  90.20 2088.70088039..20.8 .388:- ..3:..3.0  .98908.880847/07.943 /3:330.943 !4247582 9890.8808 .90/4-0.0/.70..20.088.0598 3..94385 8 .8.-94190.

2508 3.58:./07130#0./07 .943 #0...

.

/09.70//03 :.8.

.65:7 1 503 144 2/1  ..%3.

.

 903 9. 1 480  &.9.8010 "/0.08890/.574.0 !4247582 &. .3.65 9.:.7 619.  .-.7 3079.

16  ..%3.65 .9 %.65:7 ..

9.3/2:9.90/.9438904-0.9.84574.34-0.90/ .04103.9 8389..0889039073. 494/4 98 &8357..943 %02.47009. /70. 047/8 %42.9./943./08942094/8 013097...0 84:/-0.58:. 57490.90/..08847.20/5745079  .3/57490./0890390794189.9472094/8 0130.909057...202-07/..3.40/94.90 5:-.9 9.3..8  3.58:.35:.9.90/ 39073. 574.

8973$09..9089731:.947 ...20 709:731:.9089731:.20< < :9.8825400  57.08847 ..897309.203< <  .20 89733  1:.20 5:-..250 ..8825400  57.20 5:-.

2041905745079 5:-.9.3  2540003025400  5 25 ..89.9.3/0130.20/10/.3.3903-0:80/3 .3/809 2094/8 %057450798.8303.208.4/:8394 /110703909 ..7..20/5745079 94.88!74507908 4:.90/.5890 57... %08057450793.4/.3  88:2025 8903..

.

809 43840 79030 0 25 .

.

09 <  .

.88  57.88.39. 5:-..3/809094/8 :83$8902 3.009*809  .09 ..2085.9039.

.

5745079  09.

.

08847  709:73. < 809....

.

78  ..9.88.88  4-   43840 79030 4-   < < < 09 -4.4/...3 8973(.947  ..88  89.08847 809 -4.884-30.20/5745079  .947  3. 2:9... .2:9.:0 < < < .

3/790 3!74507908 %03..4:88/0./ .20/5745079390570./ 3.8#.3/790 49470897.990.08841.8.#0.-09470..

/ 3825/0130.  5:-.:77!..9!. 5:-.:0< < 809. <  .:77!. 47790 43825/0130.   09709:73.14. 47#0.809-4.< .09-4.574507994:9.574507994:9.14.9!.

089.9.43897:..9.9..9.9478.70/.574507908.9.0 25400 25 .:80 .3/./.3-0:80/147574507908.9478 %089.43897:.70:80/9439.3.3/34994.89.70 00.3389.  .43897:.70.089.947-0/0.889. 08 -:998897..9478...9.70-4:3/ 94.943 $9..9 349080574507908.3.300.84 %043/110703..:90//:734-0.43897:.047/.9.88.

78  25400 425.425.3  <  .425.3.208 < 25400 425.20 5:-.9.9.9.3..3..89.250 89.9.8825400  57. 8973.425.20.3  09709:73.:0< < < 5:-.5745079 5:-.. 8973425.9089.3..89.20< 809..4/.748419 43840 79030 %03.3 8973(..

25400  ...20 89.8825400  57.9.9.43897:.250 89.20.425...9.. 8973.78  .425.3.748419 < < 5:-.3.89.4/.9089.9..3 8973(.947 5:-.

.

-0489.9020398349300/0/ .

.

208 <  25400 425.748419 43840 79030 %03.3.3  <  .25400 425.

/43 5:-.43897:.9.883.943047/94-0:80/8 70.947 ./43 10/8 0./43 397410/ 4:..:0949070.3 9./ 3574507908574.0593./0/.70.570807..3.#0.4/$420094/ 7410/<.../ 30/8 #0.

.

.3.902.. 7747 $9.88.20907   .4389 /0.9.97:3 920 %04907.34:9 47 701 5.98.4389 87084.0 40.943 %0/110703.88 92.9.3 ./43 87084.9.70..70./43 10/8.0/..-04482.7./945..9 ./43 10/.794 .884..07 89.0/.4389.3/89.7..70.39.:08-4:3/94.84-0:80/ 98:801:94.4250 920.8.439093.

-090039508 3079.8  3079.94385 &.70.0.9  .9.47009.478 8 .01.3:#9:65 4736 .908.3.94385 09:889.3.0574.42083941.3.8 .70.0 3079..3.7998 .5.4/070:80 3079.94385 .70./08/0503/03..

0725400  57..2085.025400  5:-....3.3.:0< < < <  .0/..88.88 :83$8902 3.07 07.:43:2-07 598  09709:733:2-07 1 59438< 8093:2-07 1 59438..90:433:2-07 1 59438 5:-.

39:2-$.025400  5:-..0/.08!07843 07.2085.88$.90393:207 1$.:0< < < <  .08 5:-..08< 8093:207 1$.08  09709:733:207 1$..$.08..88 :83$8902 3.08!0784325400  57..

8843897:.3.07 89731:.20 025 .425090 84:7.:77!.890-..9.9..0 5740..43897:.4/0  .80 1:.3.80.947.:942.250 5:-.80 .. 3:2-07 1 594383:2-07 1 598< #0107943079...43897:.88.88.20 39025 14. :43 3:2-07 1 598 -.947 -/01.3/$:-..:77!..0.88.914/0714790.9478 8:-..:9 .

90 202-07.0/.9438  ...57..9..0 3 .90/047/ 4:349.-897.8309509430472470-.889..8808 57490.80 ..3 9-030790/ 903:8090 047/80.03 8:-.9.88 9..3..8808 $0.0/ 80.80.3-0..9430/70.37:3 9204592.9..47010.9-.-08 .472094/8.03...9..3349... :9503079...3994/083.079.0880/-8:-.0/.00.84-0.0880/-0.3.88 983495072990/94.8403....8808 14:.9:708418 ..88.8808 57490.3 9-0..0.90//.3...88.

.88390$89023..250 5:-.08!07843147$.0/!%$..8808..702489:801:147/083389.0/.08!07843$.0 .8808 &.250 $0.5./.0/...88!%$.2085.9 #'&.8808 $973.3:#9:65 //.8808:3/07 !%$.430 .05...08!07843  <  ..8:-.3 993412470.0850450  $3.80.3/.08!07843.3:#9:65 4736 .79 9208.00.80.8894 .08!07843 08. 9 $0..

32039.439.

.94320.30/ .8808.7. 70.0.00.33 .8439.8 .0/.88 984//949341#.30/../48..4 %:73 3 89.889.38.8.9  90:8..88./ 0.438/0794.943.7 8.8439.439.941903307.943 47.33.0 :804190..943 00.90  #010794439...38..943.//3202-0789490.439...42509084:7. .32039 14/0714790.#.8894904:98/047/ 706:708/00.94385 09:8.88 %405480901:3.0/.92./4.3/.88 #./4 .7.88 81:3..73890. #.4/0  ./4 8.

089425400.07  4:74-0.1.389.0/94:970.2502039.880884:/-0...4-0.47009..9908:-.08!07843 %820./0/1107039 39071.880894574.302094/9425400 .8894-0.9.9438 412094/89.9.0/174225400 40..-094574.077/0 047/8  .24:39< %82094/8. .9439574.7/94 .98/07.//0/.24:39 ..07.0..3/ $.0894/0839894-0.70.88:209.8 5:-.3..3/4..79:.9.043:8 14..94:.20  !4247582.2094/41. .0/1107039147.0.8  !4247582 !4247582890.:77!..88 !42475828.0/-908.88.48..-9147.42243147.203../08  47.0/974:. .9850.250 ./0/11070392502039.4/.

.80.3079 1742.03984190-....202502039.-897.8808 -897..88 30793 .882.41902094/8 574507908  .054247582 :950.80.2502039908.830.8808574.-897..88082.0 .08  39071..3.08.0.9.88300/8 942502039  3079....../0 002039841-493079..9.39.3/.9.08 3.0.88300/894708543/ 3 39071.90/980192:89-030790/  .3.88082....943..88 9..7-08902094/8 574507908 ...3/0.883908....054247582 :950.3/0.250203943047247039071..9.3/39071.08.888.%50841!4247582 39071.80.9.70088039.890-.0/08.88  !4247582974:..20 39071./0139438414..8870..830 -.03989.3349-0389.

88.42509070/013094:9... .370:8090-.043:8 14.24:39 .3.8825400  5:-.0843:8  < < 4:..043:8 14..24:39  398.4/.:77!.:3.79:.80..0843:8  -.88$.9..9.24:39 8. ...80 .882094/  .9.:: 5:-...043:8 .4.0 908:-.077/0 .250 .882094/-:8390047/-.80 9073..08 8.80.24:39< < 5:-.08!0784325400  5:-..4/.390-.0843:8  1 3:2-07 1$..

2.9..0/  19025400..888/0.70/.3/98..8.307747 2540003025400  ..9 .-897.-897.3..2.-897..9 .88..3349-080...439..08!07843  ..9890300/147...94743.9.9 .9 9090 14438929 .88 408944 184204308..8885072990/ -:9349706:70/ 94.88 3.88.39.3 ..90//70. .$.-897.08.32540047..-897.-897.-897.8 .8808 3.3..3349-0389.9202-078 3.9.4250 9200774794:809030 4507.9.-897.

-897.077/0.9.4/  ..250 ..88  5:-..9.4/  < ...88  5:-....-897.88  5:-..9.-897.4.4/ < < .

.

/0.884.3.9  .9:../08.94341< <    %0.//943.2502039.077/08.70/.7034 .08.883974/:...3 2502039.09/4083 9574....94341 2:89.09070.3.-897..943 $3.-897.9:.9.-897.2094/ -:983.3.92094/  .08.3/574.883974/:.-897.-897..84-0/0.9  .2502039.9202-0783 85072990/ -:9349706:70/ 94-0343 ...

7 < 7/309..: 79 9.::&.9  .3 50.9 9. <> > &. 03.0 ..887./:.3619.:469 5..7 < <> 7/306991 619.335./:.9.0.88 0834. 070.4..$.43/408 > #010794$.::.65 &. 7/30. < > %08:-.7 7/3003.0/4083494.: . .077/07.07.::903 &.508 !740.656  7/3003.9.0.80.50.6 103.

07 10.88 .88174230793.8 .2040< ..7039..0  1.094//3 094//38455489041094/4.3/0130. 4.3570.. 41985.7. ./09843. .88.80 !09.3/574.0  5:-...03990 ..077/3 88:209.9 .950417...077/087..078433  40.2094/7..3994570. :80 30047/ 5:-.4:7804:. -.4:84.

.

88.  43840 79030  .70..07843  . .../0-.89070.97.80.3/ 90/07.8841.88...078433  < < 30 047/-70..4/7. 305:-..9..0/.80.-897.90.8825190.3 .94385-09003-.

30 4/107 .

.

80  5:-..9.39 .0/.9.7.88.8807.80  305:-...89.89.9.39 5:-.89.39 < "..%03024/107 :83$8902 5:-.    5:-.

.

20/3 5:-...89.9.4/.3    43840 79030   .

.

553..07.85.904.80  .:041 43840 79030 .

.

..08890//03.:041 43840 79030   ..

.

85.90:3//03202-07 < <  .

5907  .3/41.

3/ -0.059438 .5907  ..910920  .

9.0.-0.059438 .040.5907 -0.08 .3.8 $8902 .88 .8.-0%508  .3/8548.943 -.3. :/33...8.05943 -.05943 $89020.3.059438 :/3:89420/.059438 :950.9.05943.98.8 .9813.7-.

.:80/--./.55.4:39 3:2-07  ..8349-003.574-028.708.07..-0.9 %0574-022.280.3/..059438 7938419.4/0-.9.4/0 4.. 47./09477478 :8.5747.4:390/147390 .943 8.42509.8 0793.80 39073897394.77.4:39070/ 345747.2207850710.0714 -4:3/41..574-028..70 03.3..:80/--4:8 :80735:99.

2239:32.-: 77478077478.7941905747.14720/8973394.342.9 706:708.90728 :898..4.7:3334:7 .202470.70.01394381479700.705747.250 .88:204:.42243:80/.3$$  .2.303/:8074039078. 4: .2207 470.943 470.843./:. .250 .0397.&543907 1..0.3.909-49.:80/-903/.90/20247 708:933.0/ 14:2...30774743905.0..55.94/0090.

9.:80/-..2.93443070898 45033..:7703941130 30.3.477:590/10 439../.7:3 920077473905747.7.990259394.:289.342.994.250 .93.. .439744.2207.419080.43/9439..079080 0.4330.3.2 47.8990 .059438.0397.. .05943.309.98.90728 .808 905747..98 .059438.08  .809.-.42243:80/.01394381479700.

47 03.05943897431742.930798 174290 $8902 .30.300.05943.2 %080.342.3/84 43  .4:39070/-.43/94347:3050.08 390 %7.41.05943 .05943  3/0 :9 1#.:770/ %-.2047 .943 30.90/-0..4/0070.88 30.05943 0494:3/.88-7.3974/:..80.707:3920 .34-0.:935747..99.84..574-02 .3.059438.30.059438.708/0130 :9 10247.70.307747.

%0#4041 %.4390941.045203990.3/0.3/34.22078740/9074307747. 9390.0:8041902.. .250 ./0.7094.:08  ..80941 3:207.55..894.970570803934307747 .05943 %7.22.3989.943 470.4389.3/3 %070.43/9438 ..3/2./0130..03.35747.30.82094/709:73 ./943.05943.

05943.%0#4041 %.3/3 .

. .07 8900774797.382  .55320.

/0130* % & 39$420:3.943  .

.

88:20842093.550383981  .

.

$420:3.039  .:0 709:73* % & < .9.7-3.:808901443709:73.9.334913/10   < %82094/8349..3  39709'.* % & 57391 .801/08.4/2.943  1 709'..

3/3 $ %8574.7/39007747.05943..8.0594388901.3 70.5574.58494190./.04507834.4224394.9/0..830897:..9079...90903.58:.5574./09.:310/ .9/03910890574-02.0780 34907.9:70/ 5.989./08.8.99.97..0/83.:2.3/4907 051:31470.89.9.9403.0.43/943394.89.3/3 ..:94198..20 2088.:09.709390 %:3.3.059438.3/  0.0 %0-0.3:.3:207.7594341 90574-02 .80.439.05943.08 9.0../.0 .9.704-0.3.39.9 97070/900....3/3 $97:.759.05943  .3 70.-0/08.041 %0.9407747.9...9:70/..%0#4041 %..

0890:804114:7390770.9:70/0.9705708039890/09..93.889509.88 9490.4/09.:770/ 202-079..05943.3.41..059438 !747.41.05943 70.90/039908 .05943  .3/3 3./ 2094/ -4.9.841900.942841 %.40900.05943 9.9574..08847.07 -4.99748. 900.94.05943..4/09.4.2239897:.3389.%0.041900.

05943 7420....943..88.80.05943.05943 .88082:89-0/07.707057080390/-.88 .0/ $8902.880.059438.05943.70/07.88 3 0../ 43  ..05943.$8902 .3/55.7070.05943.05943.0/174290-:9 30.05943 48941902020-078/0130/-$8902 .

:80/90 .89.%7.0 $4:7.33 %85745079709:738.80.80950 ..0594389.05943 709:738..997070/900.841570..0510/08.:770390.709$90 0.9970900.05943 088. /09.8802-9.05943  .204190.041.9970900.9./08.&#94.05943 709:738909092088.094/.4:80.0 %..0/08.0 $9.-4:9902094/9.7-083:2074:8 /09.8.7-39007747 3.05943.88 !745079 053 3307.7-3 900774731:/09.05943 806:03.$8902 .

:77$500/2..05943 5:-.780.4/.90/ 509.  1 ./ 43840 79030  <84:94147/07  509.0307.070./97:0 < 080 43840 79030 :77$500/ < .:77$500/  . 1 .90 39/09.%743.007.20  .84.20  080  ..:77$500/  < <  ..:77$500/ /09...$500/  43840 79030  <.780.

007.:77$500/2.%743.4/.780..:77$500/ /09../ 43840 79030  <84:94147/07  509..0307.90 39/09. 1 .../97:0 .780.05943 5:-.20  080  .:77$500/  .$500/  . 1 .

.

:77$500/  <  .90/ 509.30.05943 8973 472.&80974047/947.9  <.20  < 080 43840 79030 :77$500/ < .84.070.05943 97430.80.

72.9..7 $19   97 .9..3.730.78  43840 79030  70.3 8973(...059438 89.3/890553439  .7.93.4/.

.

 .7 82.7 .059430  43840 79030 3 7747   43840 79030 094/ < 0 %.90   < ..0  < .05943  147 39   2.8500/949707900.709$90  43840 79030 088.007.0 < 0 088..0 < 0 $4:7.9.$500/:55.0  43840 79030 $4:7..8990.

.

0883.3/0/ 574.  <  .8-003.902039 43840 79030 3  :9410.4393:0899030989.%007747.059434.

8808174290.98.3/324/0-.3.34-0.30.841..994705708039.904:7430.059438 %0#8:554798.05943 .557457..908..70.84..3.70.0598410.3:.800.4/0 %07:3920.43.059434-0.05943.05943.80/4390 ..3/57490.:78 4:.90/-4.0:808. %.14724197.8808- /07.0594303 94.30..90-.

...9.

 897:.3/3   .9:70/ 0.13.05943.

2.3 49072094/8 -44#024..0.059438..  709:7397.0. .9 24:39 < < 709:731..0742.9  1 898  -44.059438 4/09..4:39 8973.24:39  -44898 '07124:39 ..70. .397...9 24:39  1 .397.9 /0.80 <   .9:8080.707.3/247074-:899.

0841 %7./.20907847.4/08 :8087.90/147.:70.7.:0 2:89574..38314.9.439.9438 0  3! #09:73307747.9/0503/843709:73. 077475.49071:3.059434-0.43/943   .4/0 2:89-0.39.4/02:89-0:5/.../0.094/8 4/09.8.70/11.0.3/:5/.33007747./943.:9940903/.4/08.3/0/574507 7747...-4:9 1.90 %003970 84:7.//943.

043:8 .97 -4.3/3.90..059434:2:8957490. -4...89430.0..059438 %4.3/0.99.3/ .30.9. 97  254000 0 .

.

  .0 < ..3:7010703.9.

.

05943 <   .30..3/0.

05943   ..30.0594387.-4.80.059434. 8.700.-4.4/09.439744089490 .3/07 1340.9.:90/9070894190.-038390..9434190.70.2:89-0:80/ 97-4...:90/ %4..4/03905747.059434.830.90/.:78 4-.:78939.-4..9. -4.:90/ 190790.30.30. .059438.4/0800.059439097 .9448147.9. ..3.-4.80..557457.7.30.4:890.97 -4. -4..2 .9.90.9 8.059434-0.450 90.8470974900.30..9.4. 03.98..80/ 479743 93.0700.05943 03.3/.9.9..4393:08 89  .

1.043:8 .059438 97  254000 0 ..9.3$50..

.

0 < . :#010703.059430  .9.0..3:7010703.

.

89.574507.4393:0390.9..370.05943 00.0.0.30.2.1907.9..07174290077479..9...4393:0.-4.:80/900.9.90   . ...:39.-4.-4.3/07814:3/ 1343014:3/ 90723..0/ %0.49007747 974 0  < 190.-0.:943.059438709743 90309..4.. 19.447 1.3 9 90392:8970974 843370/.3 .

:7703.041..3 .902039 %0974 89.342.943.4:889:.904.974 89.9020398:80/9483.

9 &8:.83.9020398:80/997 .05943   .9 -.0594389743 905747.059434-0...30.3/94803/90077474-0.9.90974 89.9490.9.07 7.9..05943.. 89.30.3/08980. 89.0.9020398 03.4797 13.05943 97405708843( 05708843 8.2448 14790.9020399.30.

88%74%089  5:-..4/.250 974 :83$8902 5:-.9....:78 1 83:  $8902 7:2039:.89..05943  < .3   :95:9 897383: %014430.059434.05943  974 307:2039:.

.

34900.:90/ 43840 790 %08973883:  < <   .

.   ... - 39. -   ..$8902 39 !../30  .  -$8902 39 !. /  43840 790 39079017893:2-07 .780 43840 #0.3 8973(.250 97 .780 43840 #0.4/.88//398  89.9.43/3:2-07 . :83$8902 ./30  43840 790 39079080.78  39.9.

.97  /.

.  43840 79030 .9.059430  43840 79030 094/ < 0 %. - < .0 < 0 $4:7.0 < 0 088.709$90  43840 79030 088. .0  43840 79030 $4:7..0  709:73 < 43840 79030 .- < .

- < /  < < 39079017893:2-07 .3 $8902 $973( . 094/'4/.43/3:2-07 .  39079080.

.

05943 088./0-074  $4:7..2094/970900.0//398 .09902590/94/.

:770390.05943..05943 709:73890094/.0 $9.9.:80/90 .8802-9.0510 /09.88 48941902020-078/0130/-$8902 .05943 088..80950  .041.70 70..05943.89.709$90 0.$8902 .0 %.0594389.841570.05943 709:73890909/08.997070/900.7-39007747 3.204190.05943 806:03..4:80.%7.0 $4:7.80./ 43 !745079 053 3307.9970900.33 &#94.

%7.0 $9.%7.....%7.89.9...059430  43840 79030 $9. ..250 $9.9708:90/3 9743900.0  <  ..31449014419007747 8 473 ...041.05943 0. < 0 $9.0 85..8806:03.

250 053 97  ..

.

05943  .059434-0.0594330..8973 .30.9 5.883.05943 2.90.70.059432.

.

3/$4:7.0574507908 2.05943 $4:7.80990053.0053!747.2 .05943 053$0090#0./20 9910 2.

.

.059434-0. .059430  .97490.9.05943 < .9 9742.

.

/85.059434-0./20 9910 $4:7.9 8574507908 43840 79030 053 0 053  43840 79030 $4:7.0  < 053$0090#0.900.0053  .0 0 $4:7.

794-:/:807/0130/ 0.088..7039.202-078/0130/390 5.00..88/07.:/3:8942.059438 0130.059438.70:801:  842092089830.30:807/0130/.3.05943 4:2.077/0.88  .4.79:.0/1742 $8902 .059438 %4:90$89020.

943.05943  5:-.0594355.80 $0.0:8942..0594355.943.0:2-07.05943 897328  -.05943 897328 .880:2.880:2..0:2.05943  .:83$8902 3.05943  -.0:2.059433307  -.2085.80 28 3307 < < $6:.05943  ..05943 < 5:-.70#449  ...80 28 < 5:-.9.0:2.

.88:8942./4:-0$6#449 /4:-03  1 3 .$6:.70#449 .05943  5:-.

.

7.947 .8 ...

.

40/  .05943 $0.9.974300:2.0:2-07349.

.

9 $679 3  <  ..947 974300:2.:9.05943  709:73..8/01.

5:-./30  /4:-0708:9$6#449 3  43840 79030 $6#449 < 708:9  < ..3:2-07  3$8902 4:-0 !.0  < <  $6:.9.9..059430  43840 79030 0 088.780 43840 #0.. 472.9.70#449 .059430  43840 79030 0 088. 0:2.4/$6#449%089  /4:-03 97  43840 790 3907.0  < .

05943030:8942.78  :8942.$6:..3 8973(.9.70#449 89.05943  0 $6#449%089  < < <  .4/.

05943-0574.059430  < &370.024709. ..9.30.2.3.:950.9. -4.7089...970724709.-0.084:.3430.4/039097-4.3. .9..:289.0880/-9030.7. 0:2. 7:2039 :9 1#.... -4.9.059438 %0.2508743  97 < .34300.059430  < ..059430  < ..9. 040.05943 &3/079080.-0  ....

  < #09743.059438 4..059430   .7:2039 97 < ....907950841. 0:2.9. 97 < .05943.3/3 0307.9.9.

.

 9740 < 70974908.9.:90/.-4. 4.0.05943 %013.. %045943.-.8 &801:147.08847.13.80108  .48090/.20 0.3/5.33:5574.3/09007747..0900.8890-:.

9.90.. -0/089740/  .250 5:-.9438:98 /43 4-0.0/0.55.943 !747.943 .3.2207830..9174220247 8434 /0090 047/ #:04.34-0..55.3/14709.34-0.9.39.7.94394.2.-0-90.9.30.:77039.07/70..34-0.3 8973(.7-.78  .040.7   < 0390 .89..98344307300/0/0398 :370..4.5:83 30 .9/0..-4:99 4/408 %/09072309.2.90.

0/3900.. .0.984:/-05.7-..5 88:20.947 0298304- 14730 %.9841950.9543907.704-0.908070903094-0.3/.. &3:80/0. .. .5 3094-0.7 .39.9472.38.040.7-.304-0. 3/.9543907  .40. .

98.070/7449847:370.039.0/0..0 .7-...98..943 917008902024794.9 543907.88 -0.98...90/...947 1902..9..20/.7-.700.0.5/408349.9.70344307:80/ 80.040.0034:20247 #/408.702489094-01700/ -0.425.4.920247894-07024.7070.3/90202478.989.40.0-00370.0/ 344307300/0/-.97.0/9043089.34-0..594340907904-0.989.90/940907-0:80/940907 %40998/0.-0 4-0.3.9090304-0.90/930.#:808.89094-0-0.4224/.9 .4201700 -0..70 893:80  %049074-0.4.98.4-0.74-0./:892039  ..088.

. .7-.947 %0.7-.90/4-0.030307..0.0.98.7024.70 24.3 :9 10247..9473 %8343..-0.989.98:7..80307..943 -0.425.0/3940307.98.40..943 .7-.0/ 3940307.039 0307.9435.947 4.943 0307.0 .7-.4.9438 0307..943  4-0.1907.40..88.943.943 134202478.98:7..943 -0.040.040.989.943.05943 89743  .7084790/394970074:58470307.90/248970.

3.70:83:32.80.3/ 4909.4/3.3.3 94.3307 4305488-084:9438944.0 2094/  041479843039508.077/0 $8902 -0.-.077/0982094//70.883.0/ 7084:7.7-.0/9508 3!8 &32.0/..0.8090202473. %4700.94:.9 3.3.7  57490..943574.3..9438.9.40.077/0.08/.9202.9 5:-.90/4.4330.%50 %0.0888343/09072389.0 <.

.

90/.743 < 57490.4/3.0 .

.

0  < 4349/0130-49.20.947.02094/3908.3/3.80 3./43 905480982094/  -..88  ./0897:.

0/.433. 13./0/-# 903.0 2094/83.0 03.883..-04-0.7 43840 79030 3.7  =3.98 ..3/70.055  .943/42...38:34.355.0/.3 < .40/147.93.883.

.

4/. 89.70.943  .9.9.3 8973(.78  43840 79030  -0..

.

303.7  43840 79030 93.71.3  . 3.0/.0/.

.

./41:83..07 -0. < < < 3890.:8098.489 4:.3054809085480 2094/  .13.

47.05943  :83 !032!0330!03 447 #0/   .45038.04190:83 89...99003/41 990570803.034-0.7/088410907908.9-0/85480/ 70.450.8..30.854809:83..4508 090/3472.902039 .

.

489:1192!03 < 034-0.7041908.98.902039 :83 !032#0/!0330!03 447 #0/ 2:0!0330!03 447 :0   .20950 4:2.38/0908.20 :83 89.5:9902.

.

489:119-495038 <  .

3.854809:83 47389.908.5..425007747 :83 439243930439 7.$9732094/ 945.3/.4/00307.8 7.  $4/7:827:830$4/7:8 447 :0   .90203989./43  -0..0 4: 300/.90 070 807090:83 89.398420909 &31479:3.:80901443.3994:80907.439.79894-70.7:814:.

.

830 :83 89.902039 $4 4:7309.9835509/4083 9...34309503.024709.9020398098 :83 439243930439 7. !## # < %.9073.9.:80/4083 9094:.    :83 $4/7:827:830$4/7:8 447 :0    .08943089:83 89.4250-0.

.

-7:8 < < <  .3/.1439.489:119.

7.147..0 02:8980.3/4:7.4/0098:570996:.-09907 84:943  .084130893  .854809:83 :9:804124709.4:50410. 03.3.

:942.4/0 574.3./08. 30841.0 85480 39071..93./0/3 %8147822097.3/574507/8548341.979903.98:554798.9/0897:.80/4385480 39071..9706:70880.305. 4-0.250203938548.0574.-0 70.4770.943  .07.34-0.243.90/84:943-.989.

854802502039.9434  .

.250203938548..888548.89..0.9.4/85480  43840 79030 :8942..4/.78  .88230..33574.88  2 85480  < <  .088  < < 5:-.3 8973(.88..-0  5:-.-0 5:-.888548055  5:-.

90-44/85480/1.80 57.023: 5:-.02.-0  57.0  09709:732< < .5:-.8803%0890/8548...902.2...88.

.

947  < .90..8803%0890/  %7..0 79030 .43897:.947 5:-.8803%0890/43897:.

.

947 =..947  .90/0897:.8803%0890/0897:.0 79030 .8803%0890/  %7.

.

00 70390 ...80 $3.8548091.

.

0/7084:7.947.3.08-0 . 902./0897:..

.

3.250 .80  <  .8 85480 1./85480/41.

0 79030 .4/85480  %7.5:-.8803%0890/85480  ...

.

0/7084:7.0/.3/:32.08 85480 97:0  .3.3./8548041902.

.

088344307300/8 .9903.90909.0574.

.

94-07:3147984-0.0 98  <  .9  $:5570883.

08  .57490.79:..0/#084:7.3.4/85480 -44/85480.90/.

.

3.3.0/7084:7.0349-003/85480/41 1 98 /85480/  %7.8803%0890/#084:7.0884312..0/7084:7..8803%0890/854832.30/..08  .08349/85480/  1 /85480.574.0 79030 .3.3/:32.0 79030 .0/#084:7.08  %7.3.08.

.

3.08 1 23:  2 85480  23: < < ./854802.0/7084:7.

.

08  /85480/97:0 < 080  %7.08 %7.0/7084:.70.8803%0890/85483:32.3./85480:32.08.0 79030 .0/7084:7.3.//85480/  < <  .0 79030 ...8803%0890/#084:7.

943 50.80 7010794  .843854802502039.3/41.5907  472470/09.42.4/05740.9 .

8.75..

85 494!747.85480 .2-% %  .

 .