0% found this document useful (0 votes)
49 views25 pages

NCC Unit-1

dg

Uploaded by

Suman Kunwar
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
0% found this document useful (0 votes)
49 views25 pages

NCC Unit-1

dg

Uploaded by

Suman Kunwar
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
You are on page 1/ 25
LJ Note Junction Best Note Provider Note By: Roshan BiSt UNIT-4 ° Language Preliminaries @Indpoduclion to Ned Leameuonks NET 98 a sofdwane, framework wach 43 designed and dnb yy Microsoft, Fresh’ version of the. Ned framework vas 1.0 came. the, dear 2002. Tas, use ob cleelps Wridows oe based oar Vob-laaed gril ai Web ce NET Frames wi i de rere sede f Tiel EI bon dea: CHANET OVB.NET, Cr+, whet “Bratt NET che, et of NET £iamewonkes (rrdtbecbine. ef NET Femmes) The. basie:..avchidectune of the, NET framework 48 a8 shown belno: Gpplicadions| nee Forms > ADO.NET -+Framerork Class Hby: CLR | >Comrner hanguage Rundi Fae eT fmol Arcee. Common. legs Runsime, fone t CLR 48 as Pramenork yunbine nme oe ihe Prgram. CLR wets Like a. irda Tage “in ec VAL AET lan ma oa oe rules wee a) aa ‘nocd by GR, aa? Boe: Object declnation, ereadt aba Lizes, beguage ss >. id: ed > Tdorabie Delelo per Pan beonerd (19) i b) Examononk baby: Sy ( to i Hs eplecln jab, jech—onlented class vranies ani aide waked vith Cha. Tt 2% josh the dhe. hi er os fl ba a 5 am the Jom. Inedalling .NET eae eae ide neleg et of CLR and FL ca pre syshen Applicadions: Win Forms! Ferrnst ‘This 44 used dir dlevelp rhe fet based aepiatine “Wekepad: 18 aM ral fa. chi apple SRNET! This 48 use levelo pi i aa si rene ADO.NET: This, 18 used dn devel op , with databases such a Oral. gears ® Comtlabion. and. Execubion of NE 1 applications, Any’ code. wptlen im sey iNET com baind Lan ‘oe le ssn (pl lake? ms of an C18, CTS, PTL a8 the Lenguagethab Co can urd doable On, seit. ng. Th 48 converted, ado bon by Ol et 4 an Sime, comptler. (21) and, these bis tree sone. doadled en" Re selects ata Hh Deb fe. con, iy Were Vebocon Bao fl apes: i IM only an ass 48 withod 9 Dlrcabien, te le inten sa pootnal ald @Racie languages construdls: ata Types: Data, chu shor ¢ Se dee mip a eg ane fe Seat ieee gren aslorage ane el te veniableName = abe: and. e258: seer te DBI shade * Cevcudes a sch of code then. 2, cndtban Bp, then., Flee slalemord: selech one fbn sebs of dines a : MY The Shon Ele Tf. spallemard selec! one of ayy the ef bynes, to execule . Seed Cage sfalbrrand; celecl ene many sels of bnes ty execute Y swith Core: fort eae Mloopnag Shedemonds: ds | Namespace he aa NamneS, class Program lade td Ma (ling ops Bo spokah dovps This Lop 48 used to esp Hoel each -tfem Saat Fach (Type. name. #7 collechin-chjech)$ “ //e4olements fo execulle B ee using System, ts frofach.$ ws Programs shabic. votd Mat (abngh 1 2 at , ; ~ Lagat “Shyawn "Ha ene names = new 5} forka (ehy name 44 hoes cal Epildoetare)s iD Gree Readline( ne 3 oe Bp Avraus: ae Ig Arsitdedenatns’ dyel] evap rents | aD) Recomm Sd T rumbers; Armay tnibalzabint nd £7 wray= new mblstfts23,4,88 OR Art PY anew Beene ori ad aA mC] Ss $11213,4,5 re IR a sa Ee aes OMe dimensional array In C# mibhiltmengion can be. declared, the. dada, seta baat con Se “pence mMEDST on. = new Wee @ Three-dimenstonal Tg att On PST inc ins a Keay Access} elements: “ems © eee ee caro n ee <= , an 7 2/9 3.4% Tathegae on ARES, Console. hbibeltne (an t2,24)3 [J dubpul = 5 @ Ia lagged axnayt 4 con “ sbbalied. with too Aquane. oe CIC 4 ane fell spials brackod i py fe ot ama ancl Secmd, ond. ~spectby en 8 no, f n ary mb CIC wnay = neio and (2] ig amor lO = eno td [61$4,0,,3,4,5%5 [a = now. and ial 10%5 amrogy [2] = ‘hen rc tg £455) SE Gre P edn ysies> nee (og Mebheda) : en ew cl a rbot clels underedand anne CH Mecess Modifios: Can Sie yo ak He or another assem, ad emi 2 or = nod aan only be sen ot Li lel sce Menne ‘- ar pen eee, ode m sane chas ar jon class, a dnb Ape on Seale ca be come by any code m tha 3, 10 eclanadion : “Spb ett othe a nan pte) Booval publte “ad Sum (tab a a SDS t= a+b} 3 rd Sum(2)3)5 Umebbod. call. DShmgs: . L Syntax s: LI vantable_n 5 congle: ake] st) OR dedlanation willy stze can be dono agi saint] vaniable Nae = ried S. [sree]; 7 Shtnal | o%= nue "Shs Stalemonts th cbabonent d to tans conbol to bo si pod sll go ” wal Whol ad of dhe bp or exist Syl: goto Labeled “dalinad Probar Yhis shademord #8 to torminabe. the cecilblng, of the ng tr which ho aid rebar the cok En io te ol eae ib § stem; rane ond wre veh Shlovndf Sade Tl sa Cobrrgt] aags)f wd $210, j=20, -reault=0; nesull = sun0sNunbes (,))! Console. Wrebelane, [Result , nosull); Const Readline(J, endef. frcin publtc and: umf Numbers Cond a, mt b)} wd. x= a+b; 8 Rebar ms 3 8 3 @, Objecd — dsierded, Frgrammning Ca): Blass and Obiechs A shes cmetsds ef dale declanabions plus tye diel * on (B a Neral die ae 48 pnivate, cxtons (or dS) ano Ic delbine thl lad alone can a ee Gite de ody od line ble well fal. aces 4 fs iz any er oF pce of al ace hype," OOF Of ma Syrdaw te define closer class className i Yalan ploclocteas Ih 0 Syrdacc bo create, cbjecd. 4 ae Caso ane senda gents Bias a Eg, objmame i 1 Bields and pnoperbi Si , that an- object contains, Bielde aoe he vouuhis?y a ‘ermati be. read. oy att alrecHly ,cubjecd fy applrable date ned HK Befiing Redes, yp, dase Sample. Claas ie 2 shtg sunpleFold 2 Def ini ie: Prporties have d “poo etl fpesks has gon aie wich . JeChass$ van publ ad sample hoepenfy § ged sobs? 3 comple elacs samplalacs $ Seamplet peeled samples WRebon the value shored. m Yo fol. peed carples : [stare the value in Lhe fel. 3 sel =) sample =values Constructs A conshructoy 13.0 special mebhed. of tre class ar automate “invled, Whenever. ansfance of She cbdss 48 creaded, Like? mebhode a consdruchor. also conbaina the collechin of sredruchions ane executed ab the Lima _ of objeck creation. ol 43 used, Jy assign sinlbiab valves fo Ba 4 ers of the. same. class, >Conehrucken, of & class must dave the same name as dhe. clase Name —~ ay 4 negides, 7A corebructsr doesnit have any saeboe. Supe snob even void, PA dass can shave. Cbal number. of consprucders A shatte eonsdyetoy dain be. a amelerteas, consfr py, = Access mod Po aan i be ; conbert 1d: eae, tel tw eoclevcl declaration fy Scan call the, enshruchy, E: sles “ Tee Pulte cass sample Coes public -Saraplollase( ) Ed code. goee hore 4 fon object 48 crealed f sarnple Class, <0 above construebor 48 abd, leblass obj = new sample Class (); Default nab don A vonabruedlr. wth no pearl foramelortoed. consdructort A consfruchor owing at Leas oe Coot ; be: (Poramebertced constructor, using Syolems, rantbabace paramebertacd Conshucdor$ ASS samp) Class$ Volaba. members, of class . S name; and Sd, Irralleds LO Samplellaas (slitog name, ond ad) this mame. =narey 3 this. dc tds Wain. Mebhod public stadic. vatd ManC) fete will anke. pramelortecd, eonshruchor, v sompleClassbh = Yow sample lass (“Ran”, a)! Console, Wrileltne (Name =” + obj name + Cand, ae’. 4d)} 3 8 @.C# Indexerst Café Indexers are ugul bro 28 spark ann 5 A CH 4ndexer 18 a. closs prop: th alan ins 2 902 a. er variable of a dass or odbyui Tn. O#, tndexers are Created \irg Ahis z Yad bbocke cole. 4 falas an aay. At noord, Index: ane applicable. on both dbesses ay ee hie Creafh Sbegek Lzamplis ge tndesesempleS class Program class ae er Lag pov shin LI names = view C10); whl chin [nd 9] i ooo ea 3 ae names ft] = values F 3 3 sbabic votd Mata (shingl 1 ax95) ih tne tt “ndexertlass Team = rew tndexerClassl)s Tear EO] = “Rocky? 5 Team. [1] = “Teena”; Console, Whiteline, (TeamfOl)s @Tnhordances The. capaliih of a class A dotve noporties and chorachentshies from Airaghih 18 called ade Syraces " Zaccess-spedifins ches Zbase_class>$ 3 | Class $ 3 New ef cabhd. clersved clos © dase called base. classes. eae ed Exempla | Using Syed; ee Zicheribance F os dats aim public class Pinent(laas 1 public werd. enbOI$ Cae (“tm a ponent clos.” 3 public class Child Class PanetClass $ Consebe, Wrtteltre (mum) 3 Console, Wrileline (“Dam a. chal. doss?s 3 @. Use of “hase” word: In CH, base k Fielda, covedructors and mebhods ae ee word wiht. snedence. Ieeyword, 48 uged bo access af er aur use base , comes rucdor or ansdan ce. ackesser only, We cath use at one the shale mebhod, ee at ve eee word § cies Faget alc aes PagrbCaess 2210; ble PowndClazs() ne Cot dahl pubic void. prtrd prind 08 3 Coneste, Wot telone (“Fanent Claas,”)5 public clags daldZloss Rnondllass$ public ChildClass() ¢ base (d$ “al aii ( *Cbald, Consbruchor)s base.Rp foe Vids (hate 205 3hR @Mellod Oyernidings Th ardor abe i-th comic mnbbed went seh need. $y woth aa panend crerdh pcs aes method pe a healed ie vine 1 ond erent ay drnplenn lon dt ral led AT sol vinbial byssard means of 3g ara he poms dp be. overnigs ne the. further. chill classes fo prvide. Deine Meld od; A wa Cou iar = an acl a dived spool ig a Wielvab webbed, panenct class clo provi Ream - mounes espace radlhed Ocrntding§ wake Staktal vord. dtsplas () P console, Wrtfeline ong chtaply mebhed?)s Sdeived cless class dans t dass 4 13 blic overrtde votd replay OF P ade a lcone fates ‘lass duspley methods class Pro: vane sdattc vad Mam (abimgl] ongs)f class ie new dass2 0; ob). cosplay (3 Bs a Oubpud Sub chess ctl mnebed, @Method, Hong _ Mebhod. eae cow be. achieved vain word, bhen a method ya b, Ooo Lal ellthady fed ig * ponent class, Bocampbes iste edit re mn display Console, ak ("Super dacs display, veethod’); class Sh class 4$, public new vote deg play OF. Conse lle ("Sub class display mebhod”)s 3 As i class Pro $ hedic void, Mam Gobtngl] an95)} class 2 a new class2.()$ ob}, r display ()s 4 NUL dru: Iso. bn C# structure, 48 a asia i tig sche a dass, Gs BG dasses , atntehines have! behavions and abbotbudes, oH CCE omodefi 5 struchors, ande Ss. ‘ical Piqecled. pipes rable cn sete public. sbibhe vend. Mata [= [J] os)} Books Baokt; esis Ook cbeclasedl */ Bookt. Salle = 6 po i” Bookd, subj jeclot = Bookt . 2d‘ eS fet" rig @DEnwnst Aw enumeraty 6 a of vared, eliger cmetarls, fy enumerated, bye ‘% adanel using the enum word, Ce enumerctions ane Soahe dada fu’, te other ioor 3, enumeration ng ths oon. vabiess and, camel schol ar can rob ae Dance. and. Con UE ar can n fs eclaning enum, Vaniable Lae ¢ enum Zenum name> F Pe enumeration List > Esamnples enum. ays J Suny Mons Tite 5 Ned. thio» Fit, Sab, B@ariffrences bebveen such and. enum, Struct Whe “shruch? word. 58, used $y The, Serum? cred £8 Used declare. che re a " declne. aie aha ae eee both data, oe can. only cob Enum Vani ™A ci supports a, private [sith Brum. does not save. private bub nod profecded access Spectfon and, pokes ded, access sspectfies| wy hres. supports encapsilti ion Vs Ente neuen support When the suche, 12 cleclaned, reales the ie of the objects can be. pre he camel tt @. Abshedt Class: bole flat and eal clase pe dab iby Ue Classes can be, leclared. is La thle five le male cha ri Aen classed, and. Sm sea wand oe ear of those ches ee vine te usd be a derived. chao Rrample oheleet less As whe ii baliecth od (3 bie 6 oe be a leds class Dentved | Abs Claes $ publte oventde vord AbshachMethed ()$ % Consol, Waele ("Ovansding AbshrachNellod, an Derived. Caas”)s 3 class DopAbs!cact Class Stabic vod, Mar. bal ol angst Derned, d= new Dertved. ()$ di Now Abstract Mebed (; d. Abstract Mebhod ls 3 ®. Sealed, class: Sealed clacses an used, to rosfrtel tro onhertance. feabane. of object onlenled, prograrming, Once a class - 8 defined as a seabed class, the clash cannol’ be subverted, Tn Cat, the sealed modifier 16 used to olofine a, class aa sealed Sypebace sealed clase clas_name Fale class Teoh! Bird § Mesechvg a sealed, ess a class Pamples Tesh Egy Trhertdig tho sealed, class chow evron. Ee class fro £ aes cabins 3 A Rrror 090509 ‘Beample’s cannth derive froma. seabed Lupe Heed! deface: An anberfa ya woh a hss. Tb 48 an enti, thab yy ~ Stet wore ar & convention Dibooface Ne Starke walt Lobes “TD? . Db has no aniglemortations } jush the, declaration of the anebhode wtPhoud the be 7 ahaae 6 can aie more. than one. foco but: Trberfacos ane te sraplome a ip wi felt dar oft Pope a ches, Syndaces glahe, [Face 3 @Prdbia) Classes: tr cata clase defilin canbe cided aro ld Tf class dledinishon. 48 fuel over mi lbp ho 4S declaned ag a Pr A pubbte pes class re ie de. avd, 23 srivale. Int g push ee Cone oc aby thig.c 5 Aha Yi ‘ih aliclass Cordef | Cc iS, Pra le ve folloef 3 coe Wridel me. ("Corda $08, $48”, =)s 4 ces hah suse oe Cd pid na ok (58) miylords Rind Corde( I Bee the congebe vtrdow Phihs a6 46 we 5 Pddeade and Everts: ln dd ocbes a Ae one. Sm the Luredion eb 4n C/C+4, ch wef ety i 0 ih. ells which medlod. a be. une oot * cog oud! A ene’ 48 a sefnence. Aype- sani TUNE, to aaah “the. sreference can ileal ae ale. Declanadion: 7 “Spal, Aype> Delegaleloe> ang he Shjeed- Grealion ds ves Aidigabslene : (ale ipl vw Srnplealegalel ais the a Ching LI aps) Rel d= view) Soph Deeg (oy fanc)5 403 Snvocadion ube slate vtd Myfine ()$ i Conde unalone “T wag called, by colegae’s 5 @, Collecdiona: Colac ao a, mare. Hale weg 3 vey o work ‘ul goog of shed Ue spy i PA api the i De can ‘on a (Ze A or te jap quid cee eit ed ate A colleclion sg a class, 40 ee vial, dulone class eit gceneed A dlemads to Dhal, Ae Exauny et using S pian Collections, % martes Paes Grlectntep heating class Pager’ Maar (aking co “pt * Aviaylted alls nes ve hls Tacs ae of al. Ada ay ( ope ha al. Remnove (88)5 a : CornsaleWrtelsne (alaCave)s % 3 : @, Generics: A genento collection. enforces 2. sale So Shab mo ether. dodo. re eae add st vite ees i ection. we. dp Me zs: He ae et ah, "Whe Gienente Qllection classes ot uricler. She. systems ‘Collections, Grenente mames pace. ‘he class Ushiche one. presend om his aaa ane as follonsi- shack AT> Sorbed lish 47> QuevedT> liad 27> lekedltad 21> Dredtoneny nefers do the. dype of values we wort fo sdacunder Boon geamples » ust et fen. Collections. Girone manda de ce Generic Appeic: fie ee ead fs Mf Static votd. Mam leed Xard> Jel neo fo ta ends dst, Add (2); hrabcahing> Isl = new bred zohling>l)5 e892, Add. (tH), @ ibe. TO: For file, TO duo main streams ane used: mpub stream and De. oubpub stream. The snpud Stream 4a vised for ead dod ft file ond dhe ejub “abcoam, ihe aoe * the culpub 45 ita for ovina a C# TO Classes’ 4d FrleSheam:, Used 4o yeaa. Soon ad. toile 4 any docabion smal DPilorefor Used fon- porns operations on files. 2» Fle. Hebps m rnavipulabing fi 3, a» Menon Shreeuns Used. for random access do stream debe honed an Ae eal Used for rag chorale fone byte bra 6>Shream. Watton: Th 48 used. for toning chonraclers toa shea. pshing Reader! TE $6 used for veadig foma, skiing buffer. BS Shrng Wailens TH 18 used for eonitig silo a aby buffer. @ humor shisrn. sncode. eocdroneshsls ‘ / The ved polgrnorphion means having mens forms, Fey mexphion Dll he to. big fn ah melt td cele mcs en“ sits function. overload ya. Thee nalng example, shows vaing funezion. ie do pant deffount labia aypest Neo L erphienpplieadin vata tent void. prt (nt 4 £ 3 Conaole, Wileltve(2)5 int (double 22 i rents (Ss 4 Ss. a rit bn (2) shabic. void ee (sheet ong vintdata, p= neo me Raddabal iis pie ne , ps print (400,253) Pp print (“Hell 05 3 3 eee Bb pacphion: CF allnas 3 to orale ababract classes Dhak are. vged provide portal class Jraplen endabin of an antes a fore 48 comple vl when a feved clas the rom, th The. follooing pro ram dlemmcht adrales an ab: ahaha ce ales ‘4 pege UP the ih gee sina ess Sherk ea 05 pu» 6 ane. (5 % class obted Shera Care 205 and b0)2 ct wy has ia public — Pela iv ) Console, Wi Rectan 3 area”) ; elon (utdbh Jens Re vealent, dass Adie ite a Mam tobngC ong) n Re ioe ‘a Ls anal b: orate Wedbehmne (“Arear” a)3 (40,05 DEING (Language Sohegreled Suey Fundamental: hour aled. i ni as a anhcts agree pe pe hye fon os abilities, Ainecthy snl the cat dogge. Ww ING, Eg a Fixed class angus cmabHel? juad bike classes,/mellods, We can wife LINQ queries In C delahases , XM deeumenta, IAd0.NEr Be: in ccllection. objecds that Sup orls IEnunerable on Nene tee 2t> are I ma support 43. ales pil in ies fo: ere) are 'o: Se dee sarin cee elaear sec Lally, we. LKINg3 ‘ EEN 5 afl 2 well-ondered,and digh-level lav than SQb. We can also use LING, wt Co ana av calleckiong 1 gives U3 a now dimension dn solve old. pr nan effect manner > With ne. help of LING we can. easly work wrth any dupe. of dota. one dike SQ), trbshies, Kees Peas nal resslon, Objecxs an lections, Wisalizers, ta corm prin el Bxomeles dass KINGGU Fapressions$ stebte vote Mam. OF bil scorea = new md $9%)92 846035 UDefire tho resélon. Tan bb soe f score 4m Stoves Bee sure >80 ewecshe Me lech scores foreach (smb Pad score Query) Console. Writeltne (a4 ”), is 3 Poutput 97.92 84 Gilorble EareetiE ci sp eomvoierd wy fd “4, anon nae aon He al ale nae eg an vote Tle 2 foo (called av i as a pasamelos Lambola expressions ane exp eased bf ing, S| (Srpah ponamelons) =) > Beant MP stra ee mnlt JPad “ti Fai Caledon. Generics wi olen, we namespace, nel css aie and del (nt 4); vee us ooo ago) * aio q wan te 7 ay nd at eee aa: de oi a) 48 a mM ls doy eal ude. C# vides Bee ate. Selly dp ele roll exception “a, ee whic can cause an exception. 3 et (q e. xt : ee stolenendes Gor henddg He excep, Frnally § W cleanup code. Example: Leb itn oy Sie exxeptink ther we fy 4 access on of dec: “tle SS Pees, abel wt patel £1 ays) “ Udeclore, ntl Boa t index 4. abl I oom = $4, Sag MDI oply valueg of anhay eel 9203 9Lanrs, len ee Congde. btlelsne (Cnn £91)3 Vivy bo acces tnvaled, andes ef chee. Vike (an C#D)s a Vr. exception, enron 18 dhmwn am me. , excep him handling of ab ede dry cabeh, oman cfertiy age gt wn ty ole Poel eb. &. PS or 8 td Mate (5 {1 os)i wa an= $4, s2/eite 2 lengths It). me console Kiel Ltt gS Console vide Line (on, 64D Etch (Cndex Odd bm €) i asi bhtleline (An Becepti ds es Message) d, Fal § 3 Congole -hsleline (“Bxcephion led succespilly); @. Ly de He trandle. *ne. exceptions ? wu, fs, We chandle exception. hecause 4 helps to ynarnbair. Lhe vonrnel ae Slow of the. ide pea i win unexpecde craeh pss yp el ial “Eh aloo shes dole te Meals tle 4S A declan 4. Led % used. fo A, sfonrelion runtime about owns of various elements iis ort vende, shruclunes, repo eben le, oon add ded pane vformadl iy uh an Brae ee Ato sive sed Il ta Epub ia de Slee pb ped vane, _panamelerevalve,..5] Predefined ri os a Adboot Adsbatlule Usages t The pe-gedingl a abbabule Abbslalsage sone sng a eee teeth ke, glass cam i el agp - oh Spl tabi oF aNulte Lo- ablnornultrple, file ie hewbd ches This Ee abbibute males a condifimal ose execution. af rie OW ae Ye fe ie Lena empl wll ly ily - ef. ue Sul q. ACR rahe 25 igh the values of dhe ado debuygang a i a ey lle Thy va yw 3 Obsolete: ed ab bute make ae awk en fn pete 5) erable uo ce find nm the a! discard & atte an Sydoxt [obsalede (message “] LObsolebe Caine jsenor )] g. Benham cus rete we Ji a dh p yumaming. mee 18 an eggicl at ee Giadies pled or Ue 4d Jelayed, Tf an: aie ee d, tke am 5 i ONES prgees te complete p takes om Ushi asyncnnon, the, mpeg” orden ale ahold Cre ‘ and awash iar mm C# are used. yn. syne rt Rane of As ane le of eayichsenss P 48 Lhod we ie ui dee ons sp erg >unning a So, concwrhen a ‘he Bek this Tit es fac henefobse yetho than a eso con be trp ctsig le ot 3) He an relent ‘ ie athe Tne Hip th las ad tte > Rel oe tina Asymes TF ae c bey fend fa function "ae ve Se sai aon Syale: “pe agyne vid, CallProcess() 48 vsed when we ward to call ay furedion pol le pute bale Taale Log frocess() Selon foal urd) => 08 © syaloncteadng Ted 5 F Now, we wi 4, call he. proeas alo Hert we wl pug did Ihc

You might also like