0% found this document useful (0 votes)
33 views

Dot Net

Note of Dot Net Technolog

Uploaded by

shreraj555
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)
33 views

Dot Net

Note of Dot Net Technolog

Uploaded by

shreraj555
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/ 3
What do you mean by property in c# mmathod? Compare automatie property with ‘ther ‘types of property with sued I cea property is 4 member of a class that Nalue of te propery and eptnaly a sete rneted for tng the value o he property Sllowong the dass to contol how the ta Scere and modes rmetod a funeion ht performs some action SF computation while 2 propery used (0 Drove accesso an underyng pice of at ot sere abaicenaplet iat the dfeence Crate sng rare: 1 eperty Publi seng Kame get (veto rare e¢ (name =valu:) (© Consolevirteline( Hell, my name is Goma Mowsyoute define propery wihoutexphaty Sefning the backing Feld The complet Sitomatcaly generator» priate backing fle publ cs Pevon {publ sting Name gets) Readaonly Poperty A read-only propery ony Droperty can only be set within the css onsuctrorwthnthe dere Pgrttesting name: publesting Name (Gettsname= value) ¥ pubievolsPoeNamed ( Eonsleittin( Name: name Waternl Property Aveo property oy provides & eter method so the vabe ofthe publ cs Prion Cate srng rare, publ sting Name (fetianame value) FovbievtdpoiNamed ("consletiteinet Name: name: ‘of constructors used in G with example th Ga consouca a spedal method tats estonia objet ose etait Contr: & deta constrctor i 4 onstrctor 1s automatially erated by the ‘comple paste sting Mame (get set) (7 Dela publi Persong (Name "Uanown’s more peemeters allows you totale =n publesting Name ges) HPaameterzed conecor pustePenenistingrame) {Name = name: Cony Censor” A Copy constr Is & ‘onaractortha ete sme objet coppeg C pub stong Named ge set) Copy constucter Dubie PeronPerion othe) (Name = coterie: 1 Expl Simple ard ty to learn, especally for developers Tamia ith lke languages seh 35 Tanguage which means support the concepts of euses, object, inhertance, and Type Safe CE sa typesate langage, which means‘ hebs prevent type errs a comple Memory Management’ CH wes automatic memory management tough a festre called thers of memory eas ae dangling pene Pinform independence: cts desgned fo be Eamman Language Infastucure (LO, whieh ows Ch code tobe compled ito an intermediate language (i) tha an run 09 any tres of CH some of the major Explain overview of Microsoft_.NET {framework and its components deta development pitorm developed by Misa Tor bulling and tunning appleatons on “The NET Fameworkconsst fhe folowing ey components Common Language Runsine (CLR The CLs ception handing and garbage colection Framewore Class Livary (FOL) The FEL 2 fanevonalty ASPNET.ASPNET. Is 2 web development indows Forme: Windows Forms i «graphical er ieerace (GUD famewere for bullng NET i2 fee, opensource develope platform “evloped by tterosot tat alors you bul Imunysiferen types of appeston ining Web mobi desktop. games ad teret of Things) applestons I pronces » content Programming. model. extensive faevork Your appicatons Component NET Framework. The ie the orginal rode for bulding deskop. wed, and server ‘plications on Windows. kinds are css Tay eated the Ramevort Cas Urry Fl) ‘ever progarmng anguage. NET Core Tiss 8 erosion, epen source, Signs or bulaing moder cous ase, aed Nghperfomance applcatens Rsvpoort evelopment on Windows macOS, and Linu nd is ptmived fr contained workoua, INET Coe isa the foundation forthe tet ‘esto of NET cle NETS whine evlved Into NET 8 Long-term Suppor verson i ae od iat gas Unt tran ype terol Sass. Ean spt Staples now yore ce sete at ie fae pg pe ‘ens cote rss eer cpreon ype vein, Deira css yo er ane ype Sere bode we mes ha an Seenananay me me oem beac percocet Cathar ous vantomeetng eh carota spe iatcingaenttn codbraye stent seat What do you mean by lambda expression? types of lambda in CH wth example. [Namba exoresion in Chi an anenmout function that alows you to wre inte code Wwthowt expt defning + method mbes epreson te pes “nt arameter => expression Thee ae two man ypesolambda expresions Satement Lambda: TOE type. of lambs ‘preston edt defn 3 lock sf ode tha fry races 0 and requres an exo retun Statement to retum 2 valveSrample of # Funecin ints d= 8) => int sum bvetun Sum Conste tenets Output 8 Brpesion Lambs; This ype of lambs Irethods I doesnt reute cry braces (a thereto keynora Farce inn mi = (8) => Console retest Si 1/ Opa 5 Tombs expression withthe Acton delegate: Zevoncsng> prmMerage = mestage => Console itetincimesege prnMesage ell, ward; (7 Output Hele worl mit Wit a program to creato user {orm in one ASPNET web page and display fied data in another page Ta ceate a use registaionormin one ASPRET veo page and ely the led dan anotne ‘age you can everson varale to pas he terdermonsvate th seregitratonaipeegitraton Farm Page! ee age Tanguage=c RutoeventWireup= "true Codetehind-"UserRegistration aps er” Inhees"Webhoptenton scmegatatons > ocriPehins “html amined og BPRHAE > hesaranat“rever= “ihead> form "orm rnatverver> “as sh UreRegtratonFarmih2> “asp etBor 1D=eame™ rnatseners “asp fentbox ~'cemall rnatseners p> ce> orm “bey sims Useregistratonaspecs ‘sing System namespace Webppteton {publ paral dase ( prtected vod Page Londobject sender, Exensagse) 0 crentngee) 1 Store er at inset varables Sesion Name = athare Tex Seoiantmai" = beta Text Rediectothe ply bape, Response ede DispayuserDetalsaspe ” ek(bjet sender Displayuse etal aspx Display Page: ose. Page Language=cr RutocventWireupe'trus Codedenine=DisplayUserDetalls spies” Inherts="WebAppleaion DisplyuserDetall” ntl ase ioe rg 898hb > Shead nmatwsener> ctlesUser Detar heats cbody> —clorm ie ormt* chUser —Detascin2>

serang>Name k= Seisonenat > “ips cla orm DisplytseDetaaspues sing Sten namespace WebAplcaton {puble paral "eles DupleyUserDetate Stem MebULage { protected veld Page Lendobject sender Evens) Check session ai Sesion ema’ = nal [Sesser Ena ould RespanceRedrect UseRegiraton spe renal Wee a program for handling exception in [ASPNETianding excepsons in ASPNET it Important for maintaining the stably and relabity of your web aplication You can use tres lok cath ae han seein Your ASPNETapolcaton Heres aso examole {eemonstate excepton handling ASPNET Detar We Fo se Page Language" RetotventWirevpertrue: Codedehine=*Oefault aspect” Shumbenlnshtpsnwn Ws. og" 99H:oI> headvunst"sever “tile>Exception Hanngide> orm runatseser> “dvs tucepionHandingsih2> ‘aspLabel 1D=bRes™ ruat~sever>casplabed “ian forms cboy> hems Detetaspees sing Systersnemespace WebAoplation Cee ole paral deer Deft Sytem Page otecied void. Page Leutobjectsende, entire) Cry ( Ti Smale an escption Utron new SeeptantTns 2 simulated eeption | eaten eaten 08 ( Tvanaetheexepion Herat Tet = "An ator occured * extessage Ih Write a C# program to show insert and st operation in dntabare ‘Tedemonstste net and eect epertions ina database using Ch, you can use ADONET to Interact th the eatabace Heres an example thing SOL Seer athe aatabase Fas you ned cesta table n your database to store the data You can vee the flowing SOL ‘evptta cate simple Sides able (0a vr PAAR Wey DENT, Name NVARCAAROO), Age NT): Nest you can ure the folowing CE code to pesorminsert and vet operons {ing ystems using System Data Scent {ss Program (tc vo Wand svourCannetion Sting, Hee ser operation ‘sng GelConnecton connection » new Salconnectinlconnectonsvngt ‘connection Open, Sng iserQvery = "NSERT INTO Students (Name, Agel VALUES (eName, ge Sekconmand insentComma SalcommandinsenQuery, connection Ineertcommand arameters Adal aN tet vonn oe InsetCommand Parameters Adaithaue oes) int rawsfecred = Insertcommmand ExeuteNon dey Convolentetines Rows fete byinsert persion tonsa, | ele operation Thang (SelCannecton connection SalConnedton(conneconseng (connecton Open sting seletQuery = "SELECT 14 Name, Age Selcommand sletCormand SelcommanatelectQvery conection Salostaeacer reader = selectConmandrecitetease whe YeaderRead) Inti reader eth) ring ame = ease GetSng() incage=revcerGethts20 employees ~ new Lstcemployee> | ‘ew zmplayee (d= 1, Name "John Doe, Salary = 2500, Aes = "athmand) ‘new Employed satay = 18000 Adres new Employes (1d 3, Name = “Ae Jennson Say "= 30000, Aas = and Ir LING aun 0 select employees with var seeceimplyees = fom emp in eps Taher ema Slary > 2000 8a emp Adres “Aatwnand select emp 17 Dispaseleted enployes foreach varemp nseectedEmployees) "Cantera ne SU (empl, Name lempNane), Salary: temper, Addiess fempadaesi. 1) ) Define operator overloading. White © Ci program to. overload. binery operator ‘peratorovereading nC allows yout deine the behavior of operators f= 2 fr feperatos with your own dasses ina way tht Maker sence Jor the cates semantics or ‘male you can dene how the 1 operon Shou behave when adding to instances of Your ess ogeter {ing System dla vecar( pubbeint gett) publi ge set) preven 1 Overoud he + operator tad two veers buble state Vector operator s(¥ecor econ) (returner econ FY sam) Public overde suing Testing ( ecu $10,0075)) cles Program! ate vois Main ( ‘vetorv = ew veto 2 econ v2 =e Veto, 4 vector sum =v 42 ConvaleitetineS¥1s (i, v2 2 sum (um = What is a Query expression? Write» c# program to select Students who are ved In Kinipur and studied In Patan Muttple Campus using In Ce 2 query exresson ie readable and concse wy to wie queries “sng LNG angie arated Qe Here an example rogrsm that let students \aho tved in iotpur and stew at Patan Multiple campus ung 2 qery expression ‘sing System ‘ing System ing cre stident Dubliesting Name (gets) Publesting aeress get set) publesting Colege( get ses) ) cliss Program satevod Mand ( Untestudent udents = new UsteStudents {net Student (Name ohn Ares “opus Colge™= "Patan lite mous ew Stent Rare = ae’ Ade “xathmanasCallege = "Patan Mule Compu 1 new Student { Name = “Bob” Adaress enput Colge~ Kathnands Univesty ew Student Name = "Eve ae = “entpur Calge = Patan Muliple Camu Ir ar seleceestadents = fom student dente lahore stedentAderess = "ipa? Select stent foreach var stocet n selected) OC Consaleirtelnels"rs(tuders are), Address tudert Ass, Calege ‘Gtdentcollege: 1), What ie CLR? List and explain the festure (Of CLRGIR stands for common Language untine, Rls the_exeecton envionment Drove by the NET Famer for tonnng ere re some ky features ofthe CAR ‘Automate Memery Management (Garbage Colleton: The LA aces garage clector ‘hat automaticaly manages the alcation and ealcaon of meray for abject Duscintine UT Complaton. The UR wes 2 ‘ample ta canverInermedate Language (L) Excepon Handling The CLR provides robust, Support for exception handing. alloweng Geveopers torte cade that can steely banal cxceptons nd recover rom vrs “ype fey The CLR enforces type safety by werthing the type corecness of al manages SeeuyThe CLR proves a seewty model ha helps in protecing the system andthe Ponty What do you mean by static class a constrctor” Explain ith suitable example. In ch atti cars ea ca that cannet be Instantted ands pial used prow uty fenton or contr instance af he cs thing yer Ste cer witha ate rnathod F pubes it ant) (etna Shir cas wits aconseucer pubes Pan ( publsting Name ge set) buble age geese) i Pwcaeceroedconstecor publ Penonting name tage) (hame= ame, Age age "public veld PeDerasd¢ Console Wrteline Nae: Name. Age Age?) 1} class Progr (tte vl Min. {ing state retnod om asta ss Intsum = Math Aes, 3) Conte viele 1 Creating an instance af cass with Person pron =new PesonAee 30: peson PaneDeast; 1) What do you mean by operator overloading?” Write a CH program to ‘domonstrta binary and relational operator foverioeding. Operator overloading feature Ince that allows you te dene how operates Should eave when applic to Instances ofa flee This lows youtoure apetetas he te, whyoureastom pe Using System dssPont | ool nt X (ge se pubicintY get se) push Fenix st) ) 7 Ovetlondng the Beaty + operatr Lee ble sate Pent operator Pont pt, Pint pat ein new Polta1X p24 BLY p2¥h 1 Oveloaang tbe ub wae boo oper pe recum piX==p2Xtleph¥ == p2¥i } erlang he = operon to hack #0 points ere not equ publ statc bool opertert+Point I, Pein 2) ‘retrmifpt == pak ‘overeating the «operator to compate 190 point bed onthe dance fom the engin too, public at bol operator 20s peator te chexifto Pont a, Pin 1) How virtual method is used to achieve Synamic binding in CH? Explain with the help of suitable program, Ince, the vita eyord is used to declare 2 rath na bve dt that ean be overseen cer here the actcal method inskmentaion ‘orbe called determines a unte bated on thetype ofthe bier Heres an example to demonstate how vita methods achieve énamve nang Alass Animal publievitua vid Makesoundd {Consoleirceline( Anal maxes sun) dics Dog’ Animal publ overnce void Makesounet) ( Consolevireline Dog but cdasscat Animal publi overnge void MakeSounet ( Consalerteline Cat mea dass regan tae woi Mas famal animal = new Anal Sheva akesouna rials new Dot umalakesoundl 1 Output Dag bas animal new et rmaldtsesounl | utput Cat meow 3 Define inheritance, Wrte a C# program to emonstretsmultlevel and” multiple Irhertance isa fardamental conceat in cbject-ovente programing (00) that allows neu ctf nhert trues and metho sing Syste ase dass tlss nial publ verde {onsaiertetine isting’ lass09: Arona uate vord Bad {Consake wireline Dog sbarking. 11 pened css inbetng fom Dog ‘ss Labrador: Dog publ oid Dpy 0 (onsale wietine Labrador 2 ype oe" Tichss Pega (static ors Man TebrderDislyy nore lebedortat) wh Single hertance: A ls ean inher rom only fone bate ct Tithe ment comonen pe of inhereane NulvelInertance: A dered cars can aio tet aru bate cae for anther dt ein ‘han of nhertance, Ferrel hertance: More than one deed WMulpte hertance Shrough leraces) Cb does net suport mulpleinhertance a esses However a. cist can. implement tolle ruteple inheritance harp yb nhertanee Ti i ormore types afnhertance = combination of too be

You might also like