0 ratings 0% found this document useful (0 votes) 43 views 25 pages Dot NET Unit 2
The document provides an overview of the .NET framework, including its libraries, assemblies, and the C# programming language. It discusses the structure and functions of assemblies, the importance of metadata, and the characteristics of C#. Additionally, it highlights C#'s object-oriented features, flexibility, and compatibility with the .NET environment.
AI-enhanced title and description
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here .
Available Formats
Download as PDF or read online on Scribd
Go to previous items Go to next items
Save Dot NET unit 2 For Later ana abit cates ae tg th PEPURIY of moby,
ye tay aces the web oF em rom tg,
¥e Libraries in Net
vw ut cnn ey oe rap caso CSS, tan
een erent sen Soe OSS poy
aarti Te rt cs ee tn ce,
sere sen ans» ptm ji set 0 The tc
fey ey ien
“wt be man ast es ay
«ben eet
om esos
ron ad cs
+ Damas cess
+ ameessng
+ Renetng
+ etectons
“The Net las ray is amon to alanguage of Nt That mean he way
acess files n VB et witb exact sae Ci, and in ct 8 oor anguaes
Net. You tam trary ery for nes, b wo ln evr language.
‘Asta comeon oa posal appleaton,Cierentiypes of aplcsion
acon mata use of Nat ass Sra we
wa
Console appeatons
Windows GUI sopetons
|ASP_Notaplcatons
20M. Web sonics
“The Net ass rary i ie it wo pas
©
‘Bas0 Class Library (BCL)
Ie standard rary which is van oa te programming lnguapes |
ti. ih. Net ramework, BCL provides pro-doed namospars, ase
‘and functions which haps in portoming a the uncions comment very
‘programming language tke Memo Managomert, Flo Reading, Oatabase
ending, StingHanding Rely Access ce. Thoavalabiy of BL speeds
phe dvotopment process arate.
Framework Cass Library (FOL)
‘The Framework Class Libary (FL) i superset ofthe BCL cases and
‘eter tte entre dass brary tat hips wen Ne ramowerk. Wines an
expanded oe fibres, incadig Windows Foms, ADONET. ASP.NET,
Language nage Qui, Windows Communion Feundton among
to er enemtetnsch Faces ninacame we
Peabo nition noes
i hanecssteanic naan geream
Sakti sewers osteorensse1 ceonapore Te
cae cece ieee espatn
Scenes
or1.9 Assemblies in .Net framework
Gazal re nating os ol Nel mwa The Ne ASEM
pet he CLR exeutes. ASSO i
et len, reas coe tat he CLF “A
ee ire ona terourcenmaton at are bul o wrk epee anda
ope unt Rectory
“Te reat ng about asebles i that ey ae setsosebing. A the det,
‘site sseentiy roe win te absentee Because aNET assent,
‘Srsths riomason win el mates XCOPY fonconaly poss. tig
ss eseniy asinle a 909
1.91 Structure of An Assembly
“Te suchen fe peal aso is shown a gr 1.12.
‘Asses aro made up ol otowng prs
4, Assombly Mantost
“Ine assembly mates aso contin
son pba he scons
Carre tat he appcabon aways uses te core ese. Whon youre
gt have mute vrsons oan ascemby on the sare mace, tis
rgvtant 1 abl them caretly £0 tt be CLR hoi wich ene to use.
ly manest conan name, cuter anguagesndilomaton abut
relerenoed assembles
2. Type metadata
‘An azzably cents varous modules, Each moo consis metadta an
MSIL Type matadaa contains normaten onthe pas hate expt by
ihe aserbiy such as secstypemision mfomaton, class and etace
rlomton and oe sce eloma ako coisa pti
see posed pes and eoues Rescues te Hes sth a MP FJ tes
Matt any cere needy epleaton
2 sit
in izes enemas gio
1.92 Functions of an Assembly
Te Funeton fn sssomby 8
1 eons coetatne CLR exces Scots in a orl excetaio
(Peet cereus coesrthve nesta asonty rants
cam a bee 2 toms sec Bounty. AnasenBy eu a which pomisins
tegen | | Pepents || Prin
ra Pats el 4 Lom a ype beaay Every es ety nes, he nana be
esanbiy ih restos
4. toms lronce sco Dun The asserts antes ots
“ssonly melda a ed or refoWing pet an satin SoU
aime toques
vsteee mung ere, yes ond e20uCeS NINO SIME Asem
evermore as aunt, y
6 fist untatwecn sd side exeeton suppor. Two assemblies y
the cae name bt win eer vorsions cn rn sioby 0 abo
‘ountow tat dopent ona spe version use assemBY of at ey,
7. oma. deopment ni Wren an appton sts, ony he asset
‘rte aplaton ein cas rte presen SSEEMDILS, uch,
‘eataaten resources coting AY lasses can boeing
cnoerant
1.9.3 Types of Assemblies
Thee ee woes ef asconbas
1. Pat azeos
[vate eee 6 on assembly tha s aval opt apt
wre eyo bape A Pate Assembly canot be relerences oui
“ope cle dre ey ae eps A Pate assay nae neo}
be nue mente aptcaton hat wes
2 Stared secenties
“Keraesacerb pubic eesemty als shared by mull apps
team be rterenced by mee than one appcaton. In onder to shares
asconbly, te assy mustbo expt but for is purpose by gira tt
ceyeoxaprieat sengnane.Stongnama corset an aseebl/ =i)
‘Stongrame retest name he et assembly, version rumba, cut
‘ety ar pute yoko,
194 Static vs Dynamie Assembles
“orembies can bo eae a wal
nie asamblon ao ets on
km portable execute (PE) es,
ri ase ave coated at
andcinbe eseeied ect famthe ear Thay aia seat beh
2k
=
seonsouniey Te msorbiietesralestverioraie ny, 1 ne!
fest in .Net
‘hscey Marites | 2 flo that conning Metadata about Net eases.
rnty Manes consis clacton of dna ht dees how the elements in
few nasonBly relat fo oach abet
pnassembly mares conaing 88 he atadaa need o soci the asses
ferson eqitements and socuty Wort, and all metadsta needed to de to
eo ofthe assembly and zane rlerncos lo resouces ara lasses The
‘Geom anit canbe stored in aor aPE fle (an ext cri th Mosc
fromesete Ianguoge (MSL) ende orn standalone PE le Bs eoiains cy
sembly mans information.
{L104 Assembly Manifest Contents
pesmi ants consis to fotoving information.
5
6
Assently care
inirmaton on cute or language he assent cursor
‘rong mare lemon ke, pubic key, the asomtly has been gen a
Unt ies ne asomiy
“ype referer intormaton
‘Ata ol ner assembles tat ao staal releronced by Ine assenhy
‘Yecan ad orchango srneamaton ina aseriy mares using asery
sion you cod.
1.102 Funetions of Assembly Manifest
Funcon of assembiys manta are
2.
Enders he les that ako vp he assembly.
Enumerate other assets co which te essenly cere
a12 Gos tow owes tbe esses NPE and EDUEES apg,
‘eat covan ox erctaatons and iplementations,
4. Renae Be asorby sedesong
Proves ail isrecten betneen nsUner OF UE he assent
eve ese perenne.
1.11 Meta Data
easter homaton which dears the characteris your program,
-Armades meters contre onrytirg hat needed art wih anathema
Meta cova or stores th flowing omaton:
(2) Description ofthe assemiy
+ eray (assy name, version number, eure of fnguage te
sssenty pots pbc hy)
Tenge: pata epored
+ Omer ascents ts sseambiy depends on
+ Secery pemsons needed
()Deserpton of pee
Neve vsity tase class, antearaces implemented
+ Member (methods felts, papers, events ested pes
fo) Atos
Orvekpers can as metadiao he cc trough etbetes.Aibates
‘een cescrpve laments tat mod pes and members.
During the come tine of sue code, Metdata is ereted wth Mixosot
IrteredateLanqnge (St) and sored fe cated Mantest Bat Mead
(4S: oper wrgpedin a praia Exectta (PE), Dung the nme of
‘ogra, Jt n Te 1) compere CL use the Metta and converts MSL
‘ro natve code When codes exc, err oad meld no memory
nd eforonces& © scoveritormaton about your coe’ lataee, member
[Rhetanc, ands on Metadstadescrbes every pe and member defined nyo
‘cateina language nel meaner
ant Advantages of Metadata
psvatages of etait ae:
4. Saleserbing es
CUR modes and assembles ao elldesebing, K modules meta
contains everyting needed Io itract wih another module, Metadeta
‘atomtcatyprodee the ctor ot etaco Detnen Langage (0),
toyoucan we one te for both etiion and nplmoraton,
2 Language Ineroperabity
Mada proves altho neatoneqred abot compact frou
Inne clas fom a PE ta writen tern guage.
‘Simpl Programming mode!
data th ey taser roraering model anc elites enon
fornetace Dain anguoge (DL fies ead tes orany extemal tog
ot component etree,
4 Extensible
Metadata exten trough use cf atibtes
LUL2 Attributes
nen we define cas in C+, we ean use the Keys pbc end private
“Tose keywords provide agstona information about cass members. These
keywords ls deine the behavior of cass manbesby dsc te acessy
tbe classes, Compiler re designed to recogiz ese predetnns keywords
‘na you canna rata hese Keywords youre
eowovorCLR tows you 0 at yourselkeywor-e descrpve decors,
Autos ar saved wen the msiaaats ardeante cast cose
‘oureace othe CLR ero tot ppicatonbohavor ature. Tha Nea,
upphos many use atte. Youean ln dai argdovopyaurown bes
erwee
When you compile your code for the runtime, attributes aro also converted
Is into.
MSIL and placed inside a portable executable (PE) file along with metadata generat
: enerated
by the compiler. Attributes allow you to place extra descriptive information into
metadata that can be-exifacted using (untime reflection services. The compiler
creates attributes when you declare instances of special classes that derive from,
System Attribute.
Attributes allow you to add
other language that targets the runtime,
Uses of attributes
Attributes are used t0 :
4. Describe how to serialize data
your own descriptive elements to C#, VB.net or any
without having to rewrite your complies.
enforce security
2. Specify characteristics that are used to
piler so the code remains easy
3, _ Limit optimizations by the justin-time (JIT) com
to debug
Record the name of a file or the author of code
rms development
5. Control the visibility of controls and members during fo
Describe your code in
behavior in creative new ways
sscriptive elements to C#, VB.net, other language
practically any way conceivable and to affect run-time
o
‘Allow you to add your own des
that targets the runtimne, without having to rewrite your compiler.
x
reise
4, Explain building blocks of .Net Platform,
2. What are the purpose of CLR, CTS and CLS?
3. _ Distinguish betvveen Managed and Unmanaged Code.
4, What are the functions of CLR?
5, _ Distinugish bet veen Value Types and Reference Types.
6. — Explain various features of Net.
Fim
[30]Introduction to C#
2.1 Introduction
C# (Pronounced C Sharp) is an object oriented programming language. C# was
introduced by Microsoft in June 2000. It is first component oriented language. It is
derived from C and C++ language. C# is directly related to C, C++ and Java. The
family tree of Cf is shown in figure 2.1
FIGURE 2.1
itis simple, flexible and type safe language. It is the only language designed for the
-Net framework. The software developers who are familiar with C# Programming
can quickly construct a whole range of applications for the new Microsoft.NET
development environment. It is a part of the NET suite which facilitates tools and
Services that fully exploit both computing and communications. C# is suitable for
developing web-based applications,
[82]2.2 Characteristics of C#
The characteristics of C# are :
1.
Object Oriented
C# supports all the features of object oriented language such as encapsulation,
inheritance and polymorphism. It treats everything as an object and there are
no global functions, variables and constants C#.
Flexibility & Power
C# has the flexibility which permits typed, extensible metadata that can be
applied to any object. A project architect can define domain-specific attributes
and apply them to any language, element, classes, interfaces and so on.
Simple
C# eliminates the use of tedious operators such as -->, and pointers. C# treats
integer and Boolean as two different data types, which enable the compiler to
recognize the use of = in place of = = with if statement.
Consistent
C# supports only one integer type and there is no limitation of range.
Garbage collection
This memory management feature leads all managed objects. Garbage
collection is a feature of .NET that C# uses during runtime.
Exception handling
The .NET standardizes the exception handling across languages. C# offers
the conditional keyword to contro! the flaw and make the code more readable.
Type Safe
C# provides various type safe measures, which are :
(a) Dynamically allocated objects and arrays are initialised to zero.
(b) Produces an error message while using an uninitialised variable.
(33)2.3
(c)_ Enforces overflow checking in arithmeti operations.
(a) Checks the range of an array and wams whon the access goes out of
bound.
8 Name spaces
aces are C# program elements which help to organize programs,
Namespi
.s and a particular
Functionally related classes are grouped into namespaces
namespace has to be included in a software program to access the classes
and objects within it.
9. Versionable
C# supports versioning that enables the existing applications to run on different
versions with the help of new and override keywords.
10. Indexes
C# has indexes which help to access value ina class with an array like syntax.
41. Security
In C#, unsafe codes must be explicitly declared with by the modifier as unsafe
to prevent accident features.
12. Compatible
C# contains the .NET specifications and therefore, allow inter operation with
other .NET languages.
13. Extensive inter-operability
The extensive inter-operability makes C# the obvious choice for most of the
software developers.
The C# Keywords
Keywords are the words that have a standard, predefined meanings. These keywords
can be used only for their intended purpose, they cannot be redefined by the
Programmer. All keywords must be written in lowercase. The keywords are also
known as Reserved words. There are 77 keywords in C# as shown in table 2.1.
(34]TABLE 2.1
abstract delegate if override switch
as do implicit params this
base double in private throw
bool else int protected true
break enum interface public try
byte event intemal readonly typeof
case explicit is ref int
catch exten lock return ulong
char false tong sbyte unchecked
checked finally namespace sealed unsafe
class fixed new short ushort
const float null sizeof using
continue for object stackalloc virtual
decimal foreach operator static volatile
default goto out string void
struct while
2.4 Identifiers
{dentifiers.refer to the names assigne
user-defined item.
The rules for identifier are .
1. An identifier may consists of letters, digits and underscore( _).
2. — The first character must be a letter or underscore.
3. — Special symbols and blanks are not allowed.
4. Keywords.or Reserved.words.are.not allowed,, However,.C#.permits.you,to,
precede a keyword withan @, For example, @do js a,valid identifier.
5. Both upper case and lower case letters are allowed and are considered to be
distinguishable. e.g. the variable SUM is not same as sum or Sum.
[35]‘Blank paces are not lowed
area komord,
“ho fst charactor mst be alter
‘gn is ot towed.
2.5. Data Types
Vetus quanttes sc a conan vate et. cccuring in ¢C# progr mest
‘hve a type assansted wth tem Tae canbe one ac enly one ype assole
wean ony. CF ppt a very lage mbar data pes. The typeof an ety
tables to cong blomaton abut
(a) tsmecrng
©) Constainssppeebe ot
(9) Posstie va of he ety
(6) Poastie operations ape ontha ety
(6) Method or inion ta canbe used wih
‘Dea Pe in tar Cacgotzedin tree paas shown nite 22.
ea
Daa ie
Vantoen | [Recwoten| [Rete
25:1 Value Types
fora asin, sha 84 Ve es
‘are ofa fixed langth and stored on the stack of memory. When aval 7
{is assigned to anctnar variable, te vale is actualy coped, Tis means that
onal copies of te value ae vai in tbe memory. ae
ade oe varie: thn te ae ances
itanychangas are made to vale o ny .
sabes nt chinged. Te vate types ae hed no to categnes as shown
vigr023
oavan yes are cited wo ee (0) Floating pen aster ype can haa acona pan ot
(2) Prete tpt ‘ruber sue 9 4725 900-1425.75.Te spectyanuberiobe
Prana yer otro 4 me 78 Pe pa.
Crean enpe np eon ty crit oF 8 HO a. Pre?
pes ar tra bce fee eats
1. mame es
ic tre hea Be flowing NP
5 tag pes
5 Rassngpoit pes
1+ Decial ps
Integral ype integra yp Pld whol FUMES exangy
10,6815. «220. real data ype consis steps
‘Signed end Unsigned, ooch of which euppons ou ipo
rages.
The sw ange # Ig types a shown in ao 22
S.No] type | sie | ange
cn)
1 [ove fe | a280127
2 |emoe | 16 | -2reetoaarer
3 fm |e | arrears
4 [ona | ee | szeasranacasa7ss08
9 9223572008054775907
5 [ome |e | owass
6 | ustoa | 16 | oroessas
7 Jue | se | oro 20457205
© | uong fe | oto reeasresara700ssi618
of toa pm you rus seperd he charactor (or) te aie
suchas WEF you ort Ft valu wil rated a oble.A
(ch Satin poi yon eter a Noto aruba. Tele 23 shows
‘he tosting pit pes, ose, recon ar ange
Type | ste | Precision | Range
nits)
wo [a2 | Page | textowwaax 10
cone | o | tsteags| sox tow 1710"
(a) Decknet ypes:The Deca ype dosigeta prtorm nae
nd manetanycaleuatons. To spect a number obec ecm
‘ype, jou mus append ie actor M (of) 0 he value euch
4570.25, youre vaue wie eted as cube. THe
tie, precio ad range smal pee shown able 24
Tyee Precision | Range
nis)
“amal| a8 | B29 | TERT w TORI
‘Boolean pes
‘Te Boolean ype (boas ueato testa parca conson dra te
exccuton rogram. The bool ype vara cantake ony no ale
ety ten ere bewry Po
tome pen pon,
oo8 chmcter pes
‘crescent sts ng ean NOMEN Th
sangect ener ps
ice + robs (or? Ore)
range + 1 eS08
(Gornnat cuss unicode. Terle,82@ of ear pe 6
AlPrograms > Microsoft Visual Stadio 2008 > Microsoft,
Views Studio 2008,
‘cron tok ta 26
From the File menu, eect
File > New 3 Project
New Projet log box appears as shown below9.
10.
In the Project types pane, select Visual C#.
In the Templates pano, solect Console Application to create a console
application.
Enter a name for the console application in the Name text box.
Click OK button.
program as shown below :
Visual Studio would provide a skeletion
GtaRBe
_ sae
Except the first, delete the other using statement. Change the name of
class and make other changes as you wish.
Type the C# program.
Save the program using Ctrl+S.
Compile and execute the program using Ctrl+F5.
2.13 Console Output
Console defines two output methods :
[54]prom World —
I
i
1
@
0)
write( )
This method outputs one or more values to this screen. This method does not
add a newline character at the end of the output.
Example 2.17
The statements .
Console.Write ("Hello");
Console.Write (" World");
will display the following output Hello World.
WriteLine( )
This method outputs one or more values to the screen. This method adds a
newline character at the end of the output.
Example 2.18
The statements
Console.WriteLine ("Hello");
Console.WriteLine ("World");
will display the following output
Hello ©
WriteLine () method is also used to display the Value of variables. The
general form of WriteLine () method is
Console.WriteLine (format.
Where vi, v2 ete are the Variables.
ontains both static text and markers whicH indicate the
+ (position of the values ofthe variables to be Printed markers an index
numbér in curly bracket.
Example 2.19
(a) Console. WriteLine ("Area, Is {0}",
- 155}(b) Console.WriteLine ("Value of x Is (0} and
value of y IS {1}", x, y);
Suppose x = 50 and y = 70. Then we get the output as
Value of x Is 50 and value of y Is 70
sents the first variable ir
le: jg-the Tast i.e y-
in the list i.e x and {1)
In this example, {0} repre:
represents the second: ‘variabl
2.14 Console Input
Console defines two input methods
(@)
(b)
Read()
This method read a single character.
ReadLine( )
This method reads characters until you press Enter key. This method retums
this line of characters as a string.
Example 2.20
‘Study the following program
using system; \
class Welcome
static void Main()
I
|
!
!
1
I
| "
i seeage ette Mac is your Name?"
name = Cons.
| Console.Write( "Neto {oye ae! y
} © {0}", name);
!
|
I
!
XN
|
|
|
I
|
|
|
|
+ |
; |
I
!
|
I
|
Run :
What is
your name? shi
Hello Shivank ivankIn this program, the first statement simply writes
"What is your name?"
to the screen.
The Console.ReadLine( ) statement causes the program to wait for user
input at the console. The user types input, and presses the Enter key. The
retum value from this method is stored in string variable, name.
The last statement writes to the screen or console as described earlier.
You know that ReadLine( ) Method returns string data type only. If you want
to receive different types of inputs, then it becomes necessary to convert the
received string into appropriate data type.
Example 2.21
using System;
class sample
{
static void Main()
it
string sage;
int age;
Console.Write("Enter your age : ");
sage = Console.ReadLine();
age = Int32.Parse(sage);
Console.WriteLine("Your age is {0}", age);
Run +
Enter your age : 18
Your age is 18 I
eee ep"
QoOete
‘nti program. heft statement simply te “Enter your age" foto Cone so vn coven be tng et ia Rai)
ben! appropiate dala ypo. Tho above example can be weton as also
“The Console ReadLinet ) statement causes the progam f0 wat oF nny i me :
trom tho user, who types anor and han proses Enter Koy. Tis My,
'sretumed inte orm ofa sing noha sage vb, whieh 88 9 py,
‘Sica we must evaluate he versinptin te trmofan ta Pe ert,
‘sagemustbe converte eto tergerype. Tis canbe done wit the Conan,
wea is |
‘The rest spl eto ape vrs. wie an Ite 1 Came a sa 1
Consolorteivevine(“enver two nusbers
oir 1 PU %conwere-toanes#tconcove-ReedLine()) i
BEE on net wore [pe bs Sam econ me ;
ae es monet '
: 1 Shactewweivenine(“sun of nusbers is (0)"s sumit
\ | Saneteteatint 1
' I Ib 1
\ I I \
1 1 mun 1
1 ' [Ener two numbers {
: ! 130 1
i ! tio i
i \ [Sun of munbers is 70 \
I ' ae %
! I
PY aE, ! Some metod inthe Convert lass to convert hosting coved ug
Ho eo merareegey | Reade) appropiate data po are
He econ ee i
| Grwoleneitetine(ain of mater is (0}*, amy: |
f, Swatrteniinty ee ae
1) . i float Conver. ToSingle( )
i ! table ‘conver ToDo)
' ' seca Cone Tedecmat)
i \ char Conver Tat)
! | unsigned short value | Convert: ToUtnt{ )
I tn onvrTtt2)
a12.18 Scope of Variables
Te tara be gen a pen wn ah he eb cy
‘TS ell depends upon the ace were we have dco ai ny
‘what Ye Ris using. Maity tere are tro hoes fate.
(9) Local Vartan
‘The scope of lca varie is win he metas of Kacten wher thy
Inte sborecose a and bare local variable whoee scopes win them
metodsunt The moment the contra comes 0 of tha maton which the
tai Is fined te variable and ts vale I st.
0) State Varaton
Sta varabies are the varsbes whlch retan thir value throughout the
‘Brora. Cf, ea varies acts Kk gcbal variables in C+. Wo acess
evalu of sate vais trough the cass nae,
ter
ee
i
‘
1 tease in a = 2;
SSRIS Maete” wold mnthodeant>
tee 0-8)
i contole.tetzatioa(sempie-4):
1
1
t
‘natin the above example, sake vale accessed through css
ae access and manipulate the static variables.
ame. A state mato can ont
crvecas Ta ee
sven we acc by ng cet
ere es mr am pce scr teaser Bo
‘Malo method teminates.
-
i 1
t 1
i 1
i 1
Pe sae at = noe emp i
1 console.WriteLine(ob}-0)7 i
| 1
}
\ eae
ke
\Srauyowasvubam wae Toon ee
Leeson2.16 Boxing and Unboxing
As you know that in object-oriented programminy fe avowed
by using objects. Since value types such as int
use them to call methods. In C#, itis possible
type and vice-versa by using boxing and unbo
=
ods (OF functions) ar"
therefore, We cannot
jue type to 2 object
ig, moth
are not objects,
to convert the val
xing techniques.
bject type on
2.16.1-Boxing
on the stack to a0
Boxing is the process ‘of converting the value type
the heap. For example
ee are,
1 int num = 107 |
I object objnum = ar //[ereates & box I
a
ee eae
The boxing operation creates a COPY of the value of the num integer to the object
‘objnum. When the ‘corniler finds a value type in place ofa reference type, it creates
1e of the value type. Now both the variables
which it places the valu
ut the value of objnum resides 0!
erefore, in future,
n the heap. This means
>, an object box into
if there is change
Snum and objnum exist bt
that the viaue are indepen
~ 2 ¢ in the value of num, the value of objt
dent of each othe’. The
num is not affected.
2.16.2 Unboxing
jote that we
Unboxing means the conversion of object type back to the value type. Ne
ly unbox a variable that has already been boxed.
can onl
For example 2.26
pooocee coon
I int num = 20; eae i
} object objnum = num; // box num |
foes are eee (ane) objnum; // unbox ‘objnum
Sie Pe Oe ae Pega LL ad
During unboxing, C# i ;
eine a eas checks that the value type we request is actuallY
conversion. If it is, the
. » the value is unboxed.
te)