H5绔己鍒舵í灞忓悗锛屼笉鑳芥粴鍔ㄦ祻瑙堜互鍙妉i鏍囩瀹藉害涓嶈兘鎾戞弧锛屼袱涓棶棰樼殑瑙e喅鏂规硶
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了H5绔己鍒舵í灞忓悗锛屼笉鑳芥粴鍔ㄦ祻瑙堜互鍙妉i鏍囩瀹藉害涓嶈兘鎾戞弧锛屼袱涓棶棰樼殑瑙e喅鏂规硶相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/blank' title='blank'>blank
tar ref div 璋冭瘯 瑙e喅鏂规硶 mamicode 鍏ュ彛 闂鐢?net鍋欱/S缁撴瀯鐨勭郴缁燂紝鎮ㄦ槸鐢ㄥ嚑灞傜粨鏋勬潵寮€鍙戯紝姣忎竴灞備箣闂寸殑鍏崇郴浠ュ強涓轰粈涔堣杩欐牱鍒嗗眰锛?nbsp;
绛旓細
浠庝笅鑷充笂鍒嗗埆涓猴細鏁版嵁璁块棶灞傘€佷笟鍔¢€昏緫灞傦紙鍙堟垨鎴愪负棰嗗煙灞傦級銆佽〃绀哄眰
鏁版嵁璁块棶灞傦細鏈夋椂鍊欎篃绉颁负鏄寔涔呭眰锛屽叾鍔熻兘涓昏鏄礋璐f暟鎹簱鐨勮闂?nbsp;
涓氬姟閫昏緫灞傦細鏄暣涓郴缁熺殑鏍稿績锛屽畠涓庤繖涓郴缁熺殑涓氬姟锛堥鍩燂級鏈夊叧
琛ㄧず灞傦細鏄郴缁熺殑UI閮ㄥ垎锛岃礋璐d娇鐢ㄨ€呬笌鏁翠釜绯荤粺鐨勪氦浜掋€?nbsp;
浼樼偣锛?nbsp; 鍒嗗伐鏄庣‘锛屾潯鐞嗘竻鏅帮紝鏄撲簬璋冭瘯锛岃€屼笖鍏锋湁鍙墿灞曟€с€?nbsp;
缂虹偣锛?nbsp; 澧炲姞鎴愭湰銆?/p>
鍒嗗眰寮忕粨鏋勭┒绔熷叾浼樺娍浣曞湪锛?nbsp;
1銆佸紑鍙戜汉鍛樺彲浠ュ彧鍏虫敞鏁翠釜缁撴瀯涓殑鍏朵腑鏌愪竴灞傦紱
2銆佸彲浠ュ緢瀹规槗鐨勭敤鏂扮殑瀹炵幇鏉ユ浛鎹㈠師鏈夊眰娆$殑瀹炵幇锛?nbsp;
3銆佸彲浠ラ檷浣庡眰涓庡眰涔嬮棿鐨勪緷璧栵紱
4銆佹湁鍒╀簬鏍囧噯鍖栵紱
5銆佸埄浜庡悇灞傞€昏緫鐨勫鐢ㄣ€?nbsp;
姒傛嫭鏉ヨ锛屽垎灞傚紡璁捐鍙互杈捐嚦濡備笅鐩殑锛氬垎鏁e叧娉ㄣ€佹澗鏁h€﹀悎銆侀€昏緫澶嶇敤銆佹爣鍑嗗畾涔夈€?/p>
鍒嗗眰寮忕粨鏋勪篃涓嶅彲閬垮厤鍏锋湁涓€浜涚己闄凤細
1銆侀檷浣庝簡绯荤粺鐨勬€ц兘銆傝繖鏄笉瑷€鑰屽柣鐨勩€傚鏋滀笉閲囩敤鍒嗗眰寮忕粨鏋勶紝寰堝涓氬姟鍙互鐩存帴閫犺鏁版嵁搴擄紝浠ユ鑾峰彇鐩稿簲鐨勬暟鎹紝濡備粖鍗村繀椤婚€氳繃涓棿灞傛潵瀹屾垚銆?nbsp;
2銆佹湁鏃朵細瀵艰嚧绾ц仈鐨勪慨鏀广€傝繖绉嶄慨鏀瑰挨鍏朵綋鐜板湪鑷笂鑰屼笅鐨勬柟鍚戙€傚鏋滃湪琛ㄧず灞備腑闇€瑕佸鍔犱竴涓姛鑳斤紝涓轰繚璇佸叾璁捐绗﹀悎鍒嗗眰寮忕粨鏋勶紝鍙兘闇€瑕佸湪鐩稿簲鐨勪笟鍔¢€昏緫灞傚拰鏁版嵁璁块棶灞備腑閮藉鍔犵浉搴旂殑浠g爜銆?/p>
MVC妯″紡
MVC(Model-View-Controller)鎶婁氦浜掔郴缁熺殑缁勬垚鍒嗚В鎴愭ā鍨嬨€佽鍥俱€佹帶鍒跺櫒涓夌閮ㄤ欢
mvc鐨勪紭鐐癸細
1.閫氳繃鎶婇」鐩垎鎴恗odel view鍜宑ontroller锛屼娇寰楀鏉傞」鐩洿鍔犲鏄撶淮鎶ゃ€?/p>
2.娌℃湁浣跨敤view state鍜屾湇鍔″櫒琛ㄥ崟鎺т欢锛屽彲浠ユ洿鏂逛究鐨勬帶鍒跺簲鐢ㄧ▼搴忕殑琛屼负
3.搴旂敤绋嬪簭閫氳繃controller鏉ユ帶鍒剁▼搴忚姹傦紝鍙互鎻愪緵涓板瘜鐨剈rl閲嶅啓銆?/p>
4.瀵瑰崟鍏冩祴璇曠殑鏀寔鏇村姞鍑鸿壊
5.鍦ㄥ洟闃熷紑鍙戞ā寮忎笅琛ㄧ幇鏇村嚭浼?/p>
MVC鐨勪笉瓒筹細
锛?锛夊鍔犱簡绯荤粺缁撴瀯鍜屽疄鐜扮殑澶嶆潅鎬с€傚浜庣畝鍗曠殑鐣岄潰锛屼弗鏍奸伒寰狹VC锛屼娇妯″瀷銆佽鍥句笌鎺у埗鍣ㄥ垎绂伙紝浼氬鍔犵粨鏋勭殑澶嶆潅鎬э紝骞跺彲鑳戒骇鐢熻繃澶氱殑鏇存柊鎿嶄綔锛岄檷浣庤繍琛屾晥鐜囥€?nbsp;
锛?锛夎鍥句笌鎺у埗鍣ㄩ棿鐨勮繃浜庣揣瀵嗙殑杩炴帴銆傝鍥句笌鎺у埗鍣ㄦ槸鐩镐簰鍒嗙锛屼絾纭疄鑱旂郴绱у瘑鐨勯儴浠讹紝瑙嗗浘娌℃湁鎺у埗鍣ㄧ殑瀛樺湪锛屽叾搴旂敤鏄緢鏈夐檺鐨勶紝鍙嶄箣浜︾劧锛岃繖鏍峰氨濡ㄧ浜嗕粬浠殑鐙珛閲嶇敤銆?nbsp;
锛?锛夎鍥惧妯″瀷鏁版嵁鐨勪綆鏁堢巼璁块棶銆備緷鎹ā鍨嬫搷浣滄帴鍙g殑涓嶅悓锛岃鍥惧彲鑳介渶瑕佸娆¤皟鐢ㄦ墠鑳借幏寰楄冻澶熺殑鏄剧ず鏁版嵁銆傚鏈彉鍖栨暟鎹殑涓嶅繀瑕佺殑棰戠箒璁块棶锛屼篃灏嗘崯瀹虫搷浣滄€ц兘銆?/p>
asp.net濡備綍瀹炵幇MVC妯″紡锛屼妇渚嬭鏄庯紒
web/business/dataaccess
鍒椾妇ASP.NET 椤甸潰涔嬮棿浼犻€掑€肩殑鍑犵鏂瑰紡銆?nbsp;
1.浣跨敤QueryString, 濡?...?id=1; response. Redirect()....
2.浣跨敤Session鍙橀噺
3.浣跨敤Server.Transfer
璇疯鏄庡湪.net涓父鐢ㄧ殑鍑犵椤甸潰闂翠紶閫掑弬鏁扮殑鏂规硶锛屽苟璇村嚭浠栦滑鐨勪紭缂虹偣銆?/strong> ViewState鐢ㄦ潵淇濆瓨椤甸潰鐘舵€侊紝灏辨槸璇存彁浜や箣鍚庢垜浠繕鍙互鐪嬪埌鏂囨湰妗嗛噷闈㈢殑鍐呭灏辨槸ViewState淇濆瓨鐨勫姛鍔炽€?nbsp; ASP.Net椤甸潰鐢熷懡鍛ㄦ湡 1. Page_Init(); ADO.net涓父鐢ㄧ殑瀵硅薄鏈夊摢浜涳紵鍒嗗埆鎻忚堪涓€涓嬨€?nbsp; DataReader鍜孌ataSet鐨勫紓鍚?nbsp; 瀛樺偍杩囩▼鍜宻ql璇彞鐨勪紭缂虹偣 浼樼偣锛?/strong> 2.鍑忓皯缃戠粶娴侀噺 瀛樺偍杩囩▼浣嶄簬鏈嶅姟鍣ㄤ笂锛岃皟鐢ㄧ殑鏃跺€欏彧椤讳紶閫掑瓨鍌ㄨ繃绋嬬殑鍚嶇О浠ュ強鍙傛暟锛屼笉鐢ㄦ瘡娆¤闂兘浼犻€掑緢闀跨殑sql 璇彞銆?/p>
4.瀹夊叏鎬?nbsp; 鍑忓皯sql 娉ㄥ叆寮忔敾鍑汇€?/p>
5.鍙淮鎶ゆ€ч珮 鏇存柊瀛樺偍杩囩▼閫氬父姣旀洿鏀广€佹祴璇曚互鍙婇噸鏂伴儴缃茬▼搴忛泦闇€瑕佽緝灏戠殑鏃堕棿鍜岀簿鍔涖€?/p>
缂虹偣锛?/strong> 1.浜や簰鎬у樊 銆?/p>
2.鍙Щ妞嶆€у樊 璇村嚭浣犳墍浜嗚В鐨勬暟鎹簱璁块棶缁勪欢(渚嬪ADO锛岃嚦灏?绉? Microsoft Jet OLE DB Provider锛孌esktop Database Drivers ODBC Driver锛孷isual FoxPro ODBC Driver 浠€涔堟槸闈㈠悜瀵硅薄 鎬庢牱瀹炵幇澶氭€?/strong> 1.閫氳繃瀵硅薄鐩存帴璋冪敤鎴愬憳鍑芥暟鏃讹紝濮嬬粓榛樿浣跨敤璇ュ璞$殑绫荤殑鎴愬憳鍑芥暟锛堥櫎闈炵敤::鏄剧ず鎸囧畾绫诲悕锛夈€?/p>
2.閫氳繃鎸囧悜瀵硅薄鐨勬寚閽堟垨寮曠敤璋冪敤鎴愬憳鍑芥暟鏃讹細濡傛灉璇ュ嚱鏁版槸瀹炲嚱鏁帮紝鍒欒皟鐢ㄨ鎸囬拡鎴栧紩鐢ㄧ殑绫荤殑鎴愬憳鍑芥暟锛涘鏋滆鍑?/p>
鏁版槸铏氬嚱鏁帮紝鍒欒皟鐢ㄨ鎸囬拡鎴栧紩鐢ㄦ寚鍚戠殑瀵硅薄鐨勭被鐨勬垚鍛樺嚱鏁般€?nbsp; 闈㈠悜瀵硅薄鐨勬€濇兂涓昏鍖呮嫭浠€涔堬紵 浠€涔堟槸瑁呯鍜屾媶绠憋紵 浠€涔堟槸Interface锛熷畠涓嶢bstract Class鏈変粈涔堝尯鍒紵 鎺ュ彛(Interface)鏄敤鏉ュ畾涔夎涓鸿鑼冪殑锛屼笉浼氭湁鍏蜂綋瀹炵幇锛岃€屾娊璞$被闄ゅ畾涔夎涓鸿鑼冨锛屽彲浠ユ湁閮ㄥ垎瀹炵幇锛屼絾涓€ 涓被鑳藉疄鐜板涓帴鍙o紝浣嗗彧鑳界户鎵夸竴涓埗绫?nbsp; 浠€涔堟椂鍊欎娇鐢ㄦ娊璞$被锛屼粈涔堟椂鍊欑敤鎺ュ彛 鐜帮紝涔熷彲浠ュ畾涔夐潪闈欐€佺殑绫诲彉閲忋€傛娊璞$被鏄被锛屾墍浠ュ彧鑳借鍗曠户鎵匡紝浣嗘槸鎺ュ彛鍗村彲浠ヤ竴娆″疄鐜板涓€傛娊璞$被鍙互 鎻愪緵鏌愪簺鏂规硶鐨勯儴鍒嗗疄鐜帮紝鎺ュ彛涓嶅彲浠?鎶借薄绫荤殑瀹炰緥鏄畠鐨勫瓙绫荤粰鍑虹殑銆傛帴鍙g殑瀹炰緥鏄疄鐜版帴鍙g殑绫荤粰鍑虹殑銆?/p>
鍐嶆娊璞$被涓姞鍏ヤ竴涓柟娉曪紝閭d箞瀹冪殑瀛愮被灏卞悓鏃舵湁浜嗚繖涓柟娉曘€傝€屽湪鎺ュ彛涓姞鍏ユ柊鐨勬柟娉曪紝閭d箞瀹炵幇瀹冪殑绫诲氨瑕?/p>
閲嶆柊缂栧啓锛堣繖灏辨槸涓轰粈涔堣鎺ュ彛鏄竴涓被鐨勮鑼冧簡锛夈€傛帴鍙f垚鍛樿瀹氫箟涓哄叕鍏辩殑锛屼絾鎶借薄绫荤殑鎴愬憳涔熷彲浠ユ槸绉佹湁 鐨勩€佸彈淇濇姢鐨勩€佸唴閮ㄧ殑鎴栧彈淇濇姢鐨勫唴閮ㄦ垚鍛橈紙鍏朵腑鍙椾繚鎶ょ殑鍐呴儴鎴愬憳鍙兘鍦ㄥ簲鐢ㄧ▼搴忕殑浠g爜鎴栨淳鐢熺被涓闂級銆?/p>
姝ゅ鎺ュ彛涓嶈兘鍖呭惈瀛楁銆佹瀯閫犲嚱鏁般€佹瀽鏋勫嚱鏁般€侀潤鎬佹垚鍛樻垨甯搁噺銆?nbsp; 浠€涔堟槸鎶借薄绫伙紙abstract class锛夛紵 璞$被鐨勬娊璞℃柟娉曞悗鎵嶈兘琚疄渚嬪寲銆?/p>
浣曟椂蹇呴』澹版槑涓€涓被涓烘娊璞$被锛?nbsp; 鎺?strong>鍙o紙interface锛夋槸浠€涔堬紵 涓轰粈涔堜笉鑳芥寚瀹氭帴鍙d腑鏂规硶鐨勪慨楗扮锛?nbsp; 鍙互缁ф壙澶氫釜鎺ュ彛涔堬紵 閭d箞濡傛灉杩欎簺鎺ュ彛涓湁閲嶅鐨勬柟娉曞悕绉板憿锛?nbsp; 鎺ュ彛鍜屾娊璞$被鐨勫尯鍒槸浠€涔堬紵 瀹氭柟娉曠殑璁块棶淇グ绗︺€?/p>
璇﹁堪.NET閲宑lass鍜宻truct鐨勫紓鍚岋紒 绫绘槸寮曠敤绫诲瀷锛屽彲浠ョ户鎵跨被銆佹帴鍙e拰琚户鎵匡紝鏈夐粯璁ょ殑鏋勯€犲嚱鏁帮紝鏈夋瀽鏋勫嚱鏁帮紝鍙互浣跨敤abstract鍜宻ealed锛屾湁protected淇グ绗︼紝蹇呴』浣跨敤new鍒濆鍖栥€?nbsp; 濡備綍閫夋嫨缁撴瀯杩樻槸绫?nbsp; C#涓殑鎺ュ彛鍜岀被鏈変粈涔堝紓鍚屻€?/strong> const鍜宺eadonly鏈変粈涔堝尯鍒紵 鐢╯ealed淇グ鐨勭被鏈変粈涔堢壒鐐?nbsp; 杩滀笉浼氭湁浠讳綍娲剧敓绫伙紝鎵€浠ュ瀵嗗皝绫荤殑瀹炰緥鐨勮櫄鎷熷嚱鏁版垚鍛樼殑璋冪敤鍙互杞崲涓洪潪铏氭嫙璋冪敤鏉ュ鐞嗐€?nbsp; 铏氬嚱鏁扮殑鐢ㄦ硶 瑙i噴virtual銆乻ealed銆乷verride鍜宎bstract鐨勫尯鍒?nbsp; 閲嶈浇鍜岃鍐欐湁浠€涔堝尯鍒紵 鍦ㄦ柟娉曞畾涔変腑锛寁irtual鏈変粈涔堝惈涔夛紵 鑳藉灏嗛潪闈欐€佺殑鏂规硶瑕嗗啓鎴愰潤鎬佹柟娉曞悧锛?/strong> 鍙互瑕嗗啓绉佹湁鐨勮櫄鏂规硶鍚楋紵 鑳藉闃绘鏌愪竴涓被琚叾浠栫被缁ф壙鍚楋紵 鑳藉瀹炵幇鍏佽鏌愪釜绫诲埆缁ф壙锛屼絾涓嶅厑璁稿叾涓殑鏌愪釜鏂规硶琚鍐欏悧锛?/strong> 濡備綍鍖哄埆閲嶈浇鏂规硶锛?/strong> c#缁ф壙锛?/strong> base 琛ㄧず褰撳墠瀵硅薄鍩虹被鐨勫疄渚?浣跨敤base鍏抽敭瀛楀彲浠ヨ皟鐢ㄥ熀绫荤殑鎴愬憳)this琛ㄧず褰撳墠绫荤殑瀹炰緥 鍦ㄩ潤鎬佹柟娉曚腑涓嶅彲浠ヤ娇鐢╞ase鍜宼his鍏抽敭瀛?nbsp; 娲剧敓绫讳細缁ф壙鍩虹被鎵€鏈夌殑鎴愬憳浣嗘槸鏋勯€犲嚱鏁板拰鏋愭瀯鍑芥暟涓嶄細琚户鎵?nbsp; 娉ㄦ剰濡傛灉娲剧敓绫荤殑鏂规硶鍜屽熀绫荤殑鏂规硶鍚屽悕鍒欏熀绫讳腑鐨勬柟娉曞皢浼氳闅愯棌濡傛灉闇€瑕侀殣钘忓垯鍙互浣跨敤鍏抽敭瀛梟ew鏉ラ殣钘忓鏋滀笉鍐檔ew鍏抽敭瀛楅粯璁ゅ鐞嗕负闅愯棌铏界劧鍩虹被涓悓鍚嶇殑鏂规硶琚殣钘忎簡浣嗘槸杩樻槸鍙互閫氳繃base鍏抽敭瀛楁潵璋冪敤 //濡傛灉瀛愮被鏂规硶鐨勬柟娉曞悕鍜屽熀绫荤殑鏂规硶鍚嶇浉鍚屾椂锛岀郴缁熷皢闅愯棌鍩虹被鍚屽悕鏂规硶锛岃嚜鍔ㄨ皟鐢ㄥ瓙绫荤殑鍚屽悕鏂规硶 //娲剧敓绫讳細缁ф壙鍩虹被鎵€鏈夌殑鎴愬憳锛屼絾鏄笉鑳芥樉绀鸿皟鐢ㄥ熀绫荤殑鏄湁鎴愬憳 //鍦ㄦ淳鐢熺被涓笉鍙互璋冪敤鍩虹被鐨勬槸鏈夋垚鍛橈紝濡俷um1锛宯um2锛屼絾鏄彲浠ュ疄鐜拌皟鐢ㄥ熀绫绘柟娉?nbsp; virtual 鐢ㄥ湪鍩虹被涓寚瀹氫竴涓櫄鏂规硶灞炴€ц〃绀鸿繖涓柟娉曞睘鎬у彲浠ラ噸鍐?nbsp; override 鐢ㄥ湪娲剧敓绫讳腑琛ㄧず瀵瑰熀绫昏櫄鏂规硶灞炴€х殑閲嶅啓 涓嶈兘閲嶅啓闈炶櫄鏂规硶鎴栭潤鎬佹柟娉曢噸鍐欑殑鍩烘柟娉曞繀椤绘槸 virtualabstract 鎴?nbsp;override 鐨勪负浠€涔?nbsp;override 涔熷彲浠ラ噸鍐欏憿鍥犱负鍩虹被涓殑 override 瀹為檯涓婃槸瀵瑰熀绫荤殑鍩虹被杩涜鐨勯噸鍐欑敱浜庣户鎵垮彲浼犻€掓墍浠ヤ篃鍙互瀵瑰熀绫讳腑 override 鐨勬柟娉曡繘琛岄噸鍐?/p>
override 澹版槑涓嶈兘鏇存敼 virtual 鏂规硶鐨勫彲璁块棶鎬verride 鏂规硶鍜?nbsp;virtual 鏂规硶蹇呴』鍏锋湁鐩稿悓鐨勮闂骇鍒慨楗扮 涓嶈兘浣跨敤淇グ绗?newstaticvirtual 鎴?nbsp;abstract 鏉ヤ慨鏀?nbsp;override 鏂规硶 閲嶅啓灞炴€у0鏄庡繀椤绘寚瀹氫笌缁ф壙灞炴€у畬鍏ㄧ浉鍚岀殑璁块棶淇グ绗︾被鍨嬪拰鍚嶇О骞朵笖琚噸鍐欑殑灞炴€у繀椤绘槸 virtualabstract 鎴杘verride 鐨?nbsp; 鏍囪鍏佽琚噸鍐欎慨楗伴潤鎬佹柟娉曚腑涓嶅厑璁镐娇鐢╲irtual鍏抽敭瀛楁垚鍛樺彉閲忓厑璁镐娇鐢╲irtual鍏抽敭瀛?nbsp; 灞炴€у彲浠ヨ澹版槑涓鸿櫄灞炴€?浣跨敤virtual鍏抽敭瀛? 閲嶅啓鍩虹被鐨勬柟娉?閲嶅啓鍚屽悕鐨勬柟娉曚腑鏈塿irtual鍏抽敭瀛楃殑鏂规硶) 閲嶅啓鍜岄殣钘忕殑鍖哄埆闅愯棌(new鍏抽敭瀛?鏄粰瀛愮被鐨勫悓鍚嶆柟娉曞垎閰嶆柊鐨勫唴瀛樼┖闂撮噸鍐?override鍏抽敭瀛?鏄瓙绫荤殑鍚屽悕鏂规硶鏀惧湪鍩虹被鍚屽悕鏂规硶鐨勫師鏉ユ墍鍦ㄤ綅缃熀绫荤殑鍚屽悕鏂规硶浣嶇疆鍚戝悗绉?nbsp; 灞炴€т篃鍙互閲嶅啓 virtual鍏抽敭瀛楀拰override鍏抽敭瀛楁槸鎴愬鍑虹幇鐨勫惁鍒欐槸璇硶閿欒 娲剧敓绫诲彲浠ラ€氳繃灏嗛噸鍐欏0鏄庝负 sealed 鏉ュ仠姝㈣櫄鎷熺户鎵胯繖闇€瑕佸湪绫绘垚鍛樺0鏄庝腑鐨?nbsp;override 鍏抽敭瀛楀墠闈㈡斁缃?nbsp;sealed 鍏抽敭瀛?nbsp; 鍦ㄥ瓙绫讳腑閲嶅啓鍩虹被涓殑铏氭柟娉曟椂鍙互浣跨敤base鍏抽敭瀛楄皟鐢ㄥ熀绫讳腑鐨勮櫄鏂规硶 //浣跨敤base鍏抽敭鍙互鍦ㄥ瓙绫讳腑璁块棶鍩虹被鍚屽悕鐨勬柟娉?nbsp; //鐖剁被鐨勫紩鐢ㄦ寚鍚戝瓙绫荤殑瀹炰緥 Test ts = new Test2(); 鐖剁被鐨勫紩鐢ㄦ寚鍚戝瓙绫荤殑瀹炰緥(璋冪敤鐨勬槸瀛愮被鐨勬柟娉? 鐖剁被鐨勫紩鐢ㄥ彧璁よ瘑鐖剁被鐨勬柟娉曚笉璁よ瘑瀛愮被鐨勬柊鏂规硶鍙互鐢ㄦ潵璋冪敤琚瓙绫昏鐩栫殑鐖剁被鐨勬柟娉?nbsp; 鐖剁被鐨勫紩鐢ㄤ緷鐒跺埌鐖剁被鏂规硶浣嶇疆鍘昏皟鐢ㄥ鏋滃熀绫绘柟娉曡澹版槑涓簐irtual骞朵笖鍦ㄥ瓙绫讳腑琚玱verride缁撴灉璁块棶鍒扮殑鏄瀛愮被override鐨勬柟娉?nbsp; C#涓殑濮旀墭鏄粈涔堬紵浜嬩欢鏄笉鏄竴绉嶅鎵橈紵 C#涓殑鍫嗗拰鏍?/strong> 鏍堬紙Stack锛夌敱绯荤粺绠$悊鐢熷瓨鏈燂紝瀛樺偍浠g爜鎵ц鍜岃皟鐢ㄨ矾寰勶紝鎵ц鎴栬皟鐢ㄥ畬姣曞嵆浠庢爤涓竻闄わ紱 1銆佷娇鐢╮ef鍨嬪弬鏁版椂锛屼紶鍏ョ殑鍙傛暟蹇呴』鍏堣鍒濆鍖栥€傚out鑰岃█锛屽繀椤诲湪鏂规硶涓鍏跺畬鎴愬垵濮嬪寲銆?/p>
2銆佷娇鐢╮ef鍜宱ut鏃讹紝鍦ㄦ柟娉曠殑鍙傛暟鍜屾墽琛屾柟娉曟椂锛岄兘瑕佸姞Ref鎴朞ut鍏抽敭瀛椼€備互婊¤冻鍖归厤銆?/p>
3銆乷ut閫傚悎鐢ㄥ湪闇€瑕乺etrun澶氫釜杩斿洖鍊肩殑鍦版柟锛岃€宺ef鍒欑敤鍦ㄩ渶瑕佽璋冪敤鐨勬柟娉曚慨鏀硅皟鐢ㄨ€呯殑寮曠敤鐨勬椂鍊欍€?/p>
浣犲娉涘瀷浜嗚В鍚楋紵绠€鍗曡鏄庝竴涓嬫硾鍨嬬殑鏈変粈涔堝ソ澶勶紵 娉涘瀷锛氶€氳繃鍙傛暟鍖栫被鍨嬫潵瀹炵幇鍦ㄥ悓涓€浠戒唬鐮佷笂鎿嶄綔澶氱鏁版嵁绫诲瀷銆傚埄鐢?ldquo;鍙傛暟鍖栫被鍨?rdquo;灏嗙被鍨嬫娊璞″寲锛屼粠鑰屽疄鐜扮伒娲荤殑澶嶇敤 C#涓墍鏈夊璞″叡鍚岀殑鍩虹被鏄粈涔堬紵 濡備綍鍦–#涓疄鐜扮户鎵匡紵 C#鏀寔澶氶噸缁ф壙鍚楋紵 琚玴rotected淇グ鐨勫睘鎬?鏂规硶鍦ㄤ綍澶勫彲浠ヨ闂紵 绉佹湁鎴愬憳浼氳缁ф壙涔堬紵 C#鎻愪緵涓€涓粯璁ょ殑鏃犲弬鏋勯€犲嚱鏁帮紝褰撴垜瀹炵幇浜嗗彟澶栦竴涓湁涓€涓弬鏁扮殑鏋勯€犲嚱鏁版椂锛岃繕鎯充繚鐣欒繖涓棤鍙傛暟鐨勬瀯 閫犲嚱鏁般€傝繖鏍锋垜搴旇鍐欏嚑涓瀯閫犲嚱鏁帮紵 鍑芥暟銆?nbsp; 绠€杩?private銆?protected銆?public銆?internal 淇グ绗︾殑璁块棶鏉冮檺銆?nbsp; new鐨勪袱绉嶇敤娉?/strong> .new鏈夊嚑绉嶇敤娉?/strong> 绗簩绉?瑕嗙洊鏂规硶 public new XXXX(){} 绗笁绉?new 绾︽潫鎸囧畾娉涘瀷绫诲0鏄庝腑鐨勪换浣曠被鍨嬪弬鏁伴兘蹇呴』鏈夊叕鍏辩殑鏃犲弬鏁版瀯閫犲嚱鏁般€?nbsp; 3.datagrid.datasouse鍙互杩炴帴浠€涔堟暟鎹簮 [dataset,datatable,dataview] dataset,datatable,dataview , IList 绫绘垚鍛樻湁( )绉嶅彲璁块棶褰㈠紡 鍙闂€э細public ,protected ,private,internal 濮旀墭涓庝簨浠剁殑鐢ㄦ硶 浼犲叆鏌愪釜灞炴€х殑SET鏂规硶鐨勯殣鍚弬鏁扮殑鍚嶇О鏄粈涔堬紵 string鏄€肩被鍨嬭繕鏄紩鐢ㄧ被鍨? 寮曠敤绫诲瀷 String绫讳笌StringBuilder绫绘湁浠€涔堝尯鍒紵涓轰粈涔堝湪.Net绫诲簱涓鍚屾椂瀛樺湪杩?涓被锛?绠€绛? stringBuilder姣攕tring鏇磋妭绾﹀唴瀛?鎵€浠tringBuilder鏇村揩 String 瀵硅薄鏄笉鍙敼鍙樼殑銆傛瘡娆′娇鐢?System.String 绫讳腑鐨勬柟娉曚箣涓€鎴栬繘琛岃繍绠楁椂锛堝璧嬪€笺€佹嫾鎺ョ瓑锛夋椂锛岄兘瑕?/p>
鍦ㄥ唴瀛樹腑鍒涘缓涓€涓柊鐨勫瓧绗︿覆瀵硅薄锛岃繖灏遍渶瑕佷负璇ユ柊瀵硅薄鍒嗛厤鏂扮殑绌洪棿銆傝€?StringBuilder 鍒欎笉浼氥€傚湪闇€瑕佸瀛?/p>
绗︿覆鎵ц閲嶅淇敼鐨勬儏鍐典笅锛屼笌鍒涘缓鏂扮殑 String 瀵硅薄鐩稿叧鐨勭郴缁熷紑閿€鍙兘浼氶潪甯告槀璐点€傚鏋滆淇敼瀛楃涓茶€屼笉 鍒涘缓鏂扮殑瀵硅薄锛屽垯鍙互浣跨敤 System.Text.StringBuilder 绫汇€備緥濡傦紝褰撳湪涓€涓惊鐜腑灏嗚澶氬瓧绗︿覆杩炴帴鍦ㄤ竴璧锋椂 锛屼娇鐢?StringBuilder 绫诲彲浠ユ彁鍗囨€ц兘銆?nbsp; 鍦–锛冧腑锛宻tring str = null 涓?string str = “” 璇峰敖閲忎娇鐢ㄦ枃瀛楁垨鍥捐薄璇存槑鍏朵腑鐨勫尯鍒€?nbsp; ASP.net鐨勮韩浠介獙璇佹柟寮忔湁鍝簺锛熷垎鍒槸浠€涔堝師鐞嗭紵 c#涓殑涓夊厓杩愮畻绗︽槸 锛燂細 .鑳界敤foreach閬嶅巻璁块棶鐨勫璞¢渶瑕佸疄鐜?strong>() .<%# %> 鍜?<% %> 鏈変粈涔堝尯鍒紵 <%# %>琛ㄧず缁戝畾鐨勬暟鎹簮 <% %>鏄湇鍔″櫒绔唬鐮佸潡 甯搁噺 鍦?net锛圕# or vb.net锛変腑濡備綍鑾峰緱褰撳墠绐椾綋鎴栨帶浠剁殑鍙ユ焺锛岀壒鍒槸鎺т欢鏈韩鐨勫彞鏌勶紙璇峰垪涓撅級 this(C#) Me(vb.net). .C#鍙惁瀵瑰唴瀛樿繘琛岀洿鎺ョ殑鎿嶄綔锛?/strong> 鍦?net涓嬶紝.net寮曠敤浜嗗瀮鍦惧洖鏀讹紙GC锛夊姛鑳斤紝瀹冩浛浠d簡绋嬪簭鍛?涓嶈繃鍦–#涓紝涓嶈兘鐩存帴瀹炵幇Finalize鏂规硶锛岃€屾槸鍦ㄦ瀽鏋勫嚱鏁颁腑璋冪敤鍩虹被鐨凢inalize()鏂规硶 DateTime鏄惁鍙互涓簄ull? 涓嶈兘锛屽洜涓哄叾涓篠truct绫诲瀷锛岃€岀粨鏋勫睘浜庡€肩被鍨嬶紝鍊肩被鍨嬩笉鑳戒负null,鍙湁寮曠敤绫诲瀷鎵嶈兘琚祴鍊糿ull DateTime.Parse(myString); 杩欒浠g爜鏈変粈涔堥棶棰橈紵 鏈夐棶棰橈紝褰搈yString涓嶈兘婊¤冻鏃堕棿鏍煎紡瑕佹眰鐨勬椂鍊欙紝浼氬紩鍙戝紓甯革紝寤鸿浣跨敤DateTime.TryParse() net鐨勯敊璇鐞嗘満鍒舵槸: 閲囩敤try->catch->finally缁撴瀯锛?nbsp; 涓轰粈涔堜笉鎻愬€atch(Exception) catch(Exception e){throw e;}鍜宑atch(Exception e){throw;}鐨勫尯鍒?/strong> 灏嗗彂鐢熺殑寮傚父瀵硅薄鎶涘嚭锛屽彟涓€涓彧鏄姏鍑哄紓甯革紝骞舵病鏈夋姏鍑哄師寮傚父瀵硅薄锛?nbsp; error鍜宔xception鍖哄埆锛?/strong> error 琛ㄧず鎭㈠涓嶆槸涓嶅彲鑳戒絾寰堝洶闅剧殑鎯呭喌涓嬬殑涓€绉嶄弗閲嶉棶棰樸€傛瘮濡傝鍐呭瓨婧㈠嚭銆備笉鍙兘鎸囨湜绋嬪簭鑳藉鐞嗚繖鏍风殑鎯呭喌銆?/p>
exception 琛ㄧず涓€绉嶈璁℃垨瀹炵幇闂銆備篃灏辨槸璇达紝瀹冭〃绀哄鏋滅▼搴忚繍琛屾甯革紝浠庝笉浼氬彂鐢熺殑鎯呭喌銆?/p>
GET涓嶱OST鐨勫尯鍒?/strong> 鍦ㄤ娇鐢?POST 鏂规硶鐨勬儏鍐典笅锛屼紶杈撴暟鎹椂涓嶄細灏嗘暟鎹綔涓?URL 鐨勪竴閮ㄥ垎锛涘畠浠細浣滀负涓€涓嫭绔嬬殑瀹炰綋鏉ヤ紶杈撱€傚洜姝わ紝POST 鏂规硶鏇村畨鍏紝浣犱篃鍙互鐢ㄨ繖涓柟娉曚紶杈撴洿澶氱殑鏁版嵁銆傝€屼笖鐢?POST 浼犺緭鐨勬暟鎹笉涓€瀹氳鏄枃鏈紝鐢?GET 鏂规硶浼犺緭鐨勫嵈涓€瀹氳鏄枃鏈€?/p>
锛?锛塯et鏄粠鏈嶅姟鍣ㄤ笂鑾峰彇鏁版嵁锛宲ost鏄悜鏈嶅姟鍣ㄤ紶閫佹暟鎹€?/p>
锛?锛夊湪瀹㈡埛绔紝Get鏂瑰紡鍦ㄩ€氳繃URL鎻愪氦鏁版嵁锛屾暟鎹湪URL涓彲浠ョ湅鍒帮紱POST鏂瑰紡锛屾暟鎹斁缃湪HTML HEADER鍐呮彁浜ゃ€?/p>
锛?锛夊浜巊et鏂瑰紡锛屾湇鍔″櫒绔敤Request.QueryString鑾峰彇鍙橀噺鐨勫€硷紝瀵逛簬post鏂瑰紡锛屾湇鍔″櫒绔敤Request.Form鑾峰彇鎻愪氦鐨勬暟鎹€?/p>
锛?锛塆ET鏂瑰紡鎻愪氦鐨勬暟鎹渶澶氬彧鑳芥湁1024瀛楄妭锛岃€孭OST鍒欐病鏈夋闄愬埗銆?/p>
锛?锛夊畨鍏ㄦ€ч棶棰樸€傛濡傚湪锛?锛変腑鎻愬埌锛屼娇鐢?Get 鐨勬椂鍊欙紝鍙傛暟浼氭樉绀哄湪鍦板潃鏍忎笂锛岃€?Post 涓嶄細銆傛墍浠ワ紝濡傛灉杩欎簺鏁版嵁鏄腑鏂囨暟鎹€屼笖鏄潪鏁忔劅鏁版嵁锛岄偅涔堜娇鐢?get锛涘鏋滅敤鎴疯緭鍏ョ殑鏁版嵁涓嶆槸涓枃瀛楃鑰屼笖鍖呭惈鏁忔劅鏁版嵁锛岄偅涔堣繕鏄娇鐢?post涓哄ソ銆?/p>
Bind鍜孍val鍑芥暟鐨勫尯鍒?/strong> 缁戝畾琛ㄨ揪寮?nbsp; Response.Redirect鍜孲erver.Transfer Server.UrlEncode銆丠ttpUtility.UrlDecode鐨勫尯鍒?nbsp; Static 鍜?闈濻tatic鐨勫尯鍒細 浜屻€丼tatic鐨勶紝灏变竴瀹氳鐢ㄥ疄渚嬪寲鐨勫璞℃潵璋冪敤锛屽嵆鐢╪ew鏉ュ疄渚嬪寲銆?/p>
涓句緥璇达細 濡傛灉鏈変竴涓被People锛屾湁涓€涓猄tatic鐨勬柟娉昅iaoShu(), 璋冪敤鏂规硶灏辨槸 People.MisoShu() 鏈変竴涓潪Static鐨勬柟娉昰etName(), 璋冪敤鏂规硶灏辨槸 People p= new People(); p.getName(); 濡備綍瀹炵幇杩炴帴姹?/strong> 纭繚浣犳瘡涓€娆$殑杩炴帴浣跨敤鐩稿悓鐨勮繛鎺ュ瓧绗︿覆锛堝拰杩炴帴姹犵浉鍚岋級锛涘彧鏈夎繛鎺ュ瓧绗︿覆鐩稿悓鏃惰繛鎺ユ睜鎵嶄細宸ヤ綔銆傚鏋滆繛鎺ュ瓧绗︿覆涓嶇浉鍚岋紝搴旂敤绋嬪簭灏变笉浼氫娇鐢ㄨ繛鎺ユ睜鑰屾槸鍒涘缓涓€涓柊鐨勮繛鎺ャ€?/p>
浼樼偣 浣跨敤杩炴帴姹犵殑鏈€涓昏鐨勪紭鐐规槸鎬ц兘銆傚垱寤轰竴涓柊鐨勬暟鎹簱杩炴帴鎵€鑰楄垂鐨勬椂闂翠富瑕佸彇鍐充簬缃戠粶鐨勯€熷害浠ュ強搴旂敤绋嬪簭鍜屾暟鎹簱鏈嶅姟鍣ㄧ殑锛堢綉缁滐級璺濈锛岃€屼笖杩欎釜杩囩▼閫氬父鏄竴涓緢鑰楁椂鐨勮繃绋嬨€傝€岄噰鐢ㄦ暟鎹簱杩炴帴姹犲悗锛屾暟鎹簱杩炴帴璇锋眰鍙互鐩存帴閫氳繃杩炴帴姹犳弧瓒宠€屼笉闇€瑕佷负璇ヨ姹傞噸鏂拌繛鎺ャ€佽璇佸埌鏁版嵁搴撴湇鍔″櫒锛岃繖鏍峰氨鑺傜渷浜嗘椂闂淬€?/p>
缂虹偣 鏁版嵁搴撹繛鎺ユ睜涓彲鑳藉瓨鍦ㄧ潃澶氫釜娌℃湁琚娇鐢ㄧ殑杩炴帴涓€鐩磋繛鎺ョ潃鏁版嵁搴擄紙杩欐剰鍛崇潃璧勬簮鐨勬氮璐癸級銆?/p>
鎶€宸у拰鎻愮ず 1锛?褰撲綘闇€瑕佹暟鎹簱杩炴帴鏃舵墠鍘诲垱寤鸿繛鎺ユ睜锛岃€屼笉鏄彁鍓嶅缓绔嬨€備竴鏃︿綘浣跨敤瀹岃繛鎺ョ珛鍗冲叧闂畠锛屼笉瑕佺瓑鍒板瀮鍦炬敹闆嗗櫒鏉ュ鐞嗗畠銆?/p>
2锛?鍦ㄥ叧闂暟鎹簱杩炴帴鍓嶇‘淇濆叧闂簡鎵€鏈夌敤鎴峰畾涔夌殑浜嬪姟銆?/p>
3锛?涓嶈鍏抽棴鏁版嵁搴撲腑鎵€鏈夌殑杩炴帴锛岃嚦灏戜繚璇佽繛鎺ユ睜涓湁涓€涓繛鎺ュ彲鐢ㄣ€傚鏋滃唴瀛樺拰鍏朵粬璧勬簮鏄綘蹇呴』棣栧厛鑰冭檻鐨勯棶棰橈紝鍙互鍏抽棴鎵€鏈夌殑杩炴帴锛岀劧鍚庡湪涓嬩竴涓姹傚埌鏉ユ椂鍒涘缓杩炴帴姹犮€?/p>
杩炴帴姹燜AQ 1锛?strong> 浣曟椂鍒涘缓杩炴帴姹狅紵 褰撶涓€涓繛鎺ヨ姹傚埌鏉ユ椂鍒涘缓杩炴帴姹狅紱杩炴帴姹犵殑寤虹珛鐢辨暟鎹簱杩炴帴鐨勮繛鎺ュ瓧绗﹀垱鏉ュ喅瀹氥€傛瘡涓€涓繛鎺ユ睜閮戒笌涓€涓笉鍚岀殑杩炴帴瀛楃涓茬浉鍏炽€傚綋涓€涓柊鐨勮繛鎺ヨ姹傚埌鏉ユ椂濡傛灉杩炴帴瀛楃涓插拰杩炴帴姹犱娇鐢ㄧ殑瀛楃涓茬浉鍚岋紝灏变粠杩炴帴姹犲彇鍑轰竴涓繛鎺ワ紱濡傛灉涓嶇浉鍚岋紝灏辨柊寤轰竴涓繛鎺ユ睜銆?/p>
2锛?nbsp;浣曟椂鍏抽棴杩炴帴姹狅紵 褰撹繛鎺ユ睜涓殑鎵€鏈夎繛鎺ラ兘宸茬粡鍏抽棴鏃跺叧闂繛鎺ユ睜銆?/p>
3锛?nbsp;褰撹繛鎺ユ睜涓殑杩炴帴閮藉凡缁忕敤瀹岋紝鑰屾湁鏂扮殑杩炴帴璇锋眰鍒版潵鏃朵細鍙戠敓浠€涔堬紵 褰撹繛鎺ユ睜宸茬粡杈惧埌瀹冪殑鏈€澶ц繛鎺ユ暟鐩椂锛屾湁鏂扮殑杩炴帴璇锋眰鍒版潵鏃讹紝鏂扮殑杩炴帴璇锋眰灏嗘斁缃埌杩炴帴闃熷垪涓€傚綋鏈夎繛鎺ラ噴鏀剧粰杩炴帴姹犳椂锛岃繛鎺ユ睜灏嗘柊閲婃斁鐨勮繛鎺ュ垎閰嶇粰鍦ㄩ槦鍒椾腑鎺掗槦鐨勮繛鎺ヨ姹傘€備綘鍙互璋冪敤close鍜宒ispose灏嗚繛鎺ュ綊杩樼粰杩炴帴姹犮€?/p>
4锛?nbsp;鎴戝簲璇ュ浣曞厑璁歌繛鎺ユ睜锛?/strong> 瀵逛簬.NET搴旂敤绋嬪簭鑰岃█锛岄粯璁や负鍏佽杩炴帴姹犮€傦紙杩欐剰鍛崇潃浣犲彲浠ヤ笉蹇呬负杩欎欢浜嬫儏鍋氫换浣曠殑浜嬫儏锛夊綋鐒讹紝濡傛灉浣犲彲浠ュ湪SQLConnection瀵硅薄鐨勮繛鎺ュ瓧绗︿覆涓姞杩汸ooling=true;纭繚浣犵殑搴旂敤绋嬪簭鍏佽杩炴帴姹犵殑浣跨敤銆?/p>
5锛?nbsp;鎴戝簲璇ュ浣曠姝㈣繛鎺ユ睜锛?/strong> ADO.NET榛樿涓哄厑璁告暟鎹簱杩炴帴姹狅紝濡傛灉浣犲笇鏈涚姝㈣繛鎺ユ睜锛屽彲浠ヤ娇鐢ㄥ涓嬬殑鏂瑰紡锛?/p>
1) 浣跨敤SQLConnection瀵硅薄鏃讹紝寰€杩炴帴瀛楃涓插姞鍏ュ涓嬪唴瀹癸細Pooling=False; 2) 浣跨敤OLEDBConnection瀵硅薄鏃讹紝寰€杩炴帴瀛楃涓插姞鍏ュ涓嬪唴瀹癸細OLE DB Services=-4; 鎻愰珮.NET鐨勬€ц兘 鍙鏈夊彲鑳藉氨瑕侀伩鍏嶅湪璇锋眰鐨勫鐞嗚繃绋嬩腑瀵筗eb鏈嶅姟鍜岃繙绋嬪璞$殑鍚屾璋冪敤锛屽洜涓哄畠鍗犵敤鐨勬槸鐨凙SP.NET 绾跨▼姹犱腑鐨勫伐浣滅嚎绋嬶紝杩欏皢鐩存帴褰卞搷Web鏈嶅姟鍣ㄥ搷搴斿叾瀹冭姹傜殑鑳藉姏銆?/p>
2 浣跨敤閫傚綋鐨凜aching绛栫暐鏉ユ彁楂樻€ц兘 3 鍒ゆ柇瀛楃涓诧紝涓嶈鐢?"姣旇緝銆?/p>
//閬垮厤 //鎺ㄨ崘 4 椤甸潰浼樺寲 5 鐢ㄥ畬椹笂鍏抽棴鏁版嵁搴撹繛鎺?nbsp; ………. .UDP杩炴帴鍜孴CP杩炴帴鐨勫紓鍚?/strong> 璇疯В閲婅浆鍙戜笌璺宠浆鐨勫尯鍒?nbsp; 绠€杩颁綘瀵筙ML Web Service鐨勫師鐞嗙殑璁よ瘑锛?/strong> 瀹屾垚瀹屾暣鐨勬弿杩癢eb鏈嶅姟锛岀劧鍚庣敤UDDI娉ㄥ唽鍚勪釜鏈嶅姟鎻愪緵鍟嗘彁渚涚殑鏈嶅姟锛屼互渚垮叡浜粬浠€?/p>
浠€涔堝彨搴旂敤绋嬪簭鍩燂紵 CTS銆丆LS銆丆LR鍒嗗埆浣滀綍瑙i噴锛?nbsp; 浠€涔堟槸鍙楃鍒剁殑浠g爜锛?/strong> 浠€涔堟槸寮虹被鍨嬬郴缁燂紵 浠€涔堟槸code-behind鎶€鏈?/strong> 鍦?net涓紝閰嶄欢鐨勬剰鎬濇槸锛?nbsp; 甯哥敤鐨勮皟鐢╓ebService鐨勬柟娉曟湁鍝簺锛?/strong> net Remoting 鐨勫伐浣滃師鐞嗘槸浠€涔堬紵 O/R Mapping 鐨勫師鐞?nbsp; remoting鍜寃ebservice涓ら」鎶€鏈殑鐞嗚В浠ュ強瀹為檯涓殑搴旂敤銆?/strong> out淇濈暀瀛楁€庝箞浣跨敤锛屼粈涔堟椂鍊欎娇鐢?/strong> PDB鏄粈涔堜笢瑗? 鍦ㄨ皟璇曚腑瀹冨簲璇ユ斁鍦ㄥ摢閲岋紵 PDB鏄敤浜庝繚瀛樿皟璇曞拰椤圭洰鐘舵€佷俊鎭殑鏂囦欢锛屽湪debug鐨勬椂鍊欏皢浜х敓pdb鏂囦欢锛岃皟璇曠殑鏃跺€欏簲璇ユ斁鍦ㄥ拰瀵瑰簲搴旂敤 绋嬪簭闆嗙浉鍚岀洰褰曘€?/p>
浣跨敤ASMX鐨刋ML Web鏈嶅姟涓庝娇鐢⊿OAP鐨?NET Remoting鐨勫尯鍒? Web鏈嶅姟浣跨敤鐨勬秷鎭満鍒讹紝鑰孯emoting閲囩敤鐨凴PC. Web Service鑳界敤浜庝笉鍚屽钩鍙帮紝涓嶅悓璇█锛孯emoting鍙€傜敤 浜?Net銆傛晥鐜囦笂Remoting楂樹簬Xml Web Service 绫诲瀷绯荤粺鏄敱XMLSchema琛ㄧず鐨勫悧锛烠LS鏄疿MLSchema琛ㄧず鐨勫悧锛?/strong> 涓嶆竻妤?/p>
浠庢蹇典笂闃愯堪鍓嶆湡缁戝畾锛坋arly-binding锛夊拰鍚庢湡缁戝畾锛坙ate-binding锛夌殑鍖哄埆? 杩欎釜灏卞儚鏄己寮辩被鍨嬬殑姣旇緝鐩镐技锛屽墠鏈熺粦瀹氭槸鍦ㄧ紪璇戠殑鏃跺€欏氨纭畾浜嗚缁戝畾鐨勬暟鎹紝鑰屽悗鏈熺粦瀹氭槸鍦ㄨ繍琛岀殑鏃跺€?/p>
鎵嶅~鍏呮暟鎹€傛墍浠ュ墠鏈熺粦瀹氬鏋滃け璐ワ紝浼氬湪缂栬瘧鏃舵姤缂栬瘧閿欒锛岃€屽悗鏈熺粦瀹氬け璐ュ彧鏈夊湪杩愯鏃剁殑鏃跺€欐墠鍙戠敓 璋冪敤Assembly.Load绠楅潤鎬佸紩鐢ㄨ繕鏄姩鎬佸紩鐢紵 鍔ㄦ€?/p>
鍒椾妇涓€涓嬩綘鎵€浜嗚В鐨刋ML鎶€鏈強鍏跺簲鐢?/strong> 姒傝堪鍙嶅皠鍜屽簭鍒楀寲 鍙嶅皠:绋嬪簭闆嗗寘鍚ā鍧楋紝鑰屾ā鍧楀寘鍚被鍨嬶紝绫诲瀷鍙堝寘鍚垚鍛樸€傚弽灏勫垯鎻愪緵浜嗗皝瑁呯▼搴忛泦銆佹ā鍧楀拰绫诲瀷鐨勫 璞°€傛偍鍙互浣跨敤鍙嶅皠鍔ㄦ€佸湴鍒涘缓绫诲瀷鐨勫疄渚嬶紝灏嗙被鍨嬬粦瀹氬埌鐜版湁瀵硅薄锛屾垨浠庣幇鏈夊璞′腑鑾峰彇绫诲瀷銆傜劧鍚庯紝 鍙互璋冪敤绫诲瀷鐨勬柟娉曟垨璁块棶鍏跺瓧娈靛拰灞炴€?/p>
搴忓垪鍖?搴忓垪鍖栨槸灏嗗璞¤浆鎹负瀹规槗浼犺緭鐨勬牸寮忕殑杩囩▼銆備緥濡傦紝鍙互搴忓垪鍖栦竴涓璞★紝鐒跺悗浣跨敤 HTTP 閫?/p>
杩?Internet 鍦ㄥ鎴风鍜屾湇鍔″櫒涔嬮棿浼犺緭璇ュ璞°€傚湪鍙︿竴绔紝鍙嶅簭鍒楀寲灏嗕粠璇ユ祦閲嶆柊鏋勯€犲璞°€?/p>
11) XmlSerializer鏄浣曞伐浣滅殑锛熶娇鐢ㄨ繖涓被鐨勮繘绋嬮渶瑕佷粈涔圓CL鏉冮檺锛?/strong> 鎴戝彧鐭ラ亾XmlSerializer鏄皢瀵硅薄鐨勫睘鎬у拰瀛楁杩涜搴忓垪鍖栧拰鍙嶅簭鍒楀寲鐨勶紝搴忓垪鍖栨垚涓簒ml鏁版嵁锛屽弽搴忓垪鍖栧啀灏唜ml 杞崲鎴愬璞°€傚簲璇ヨ嚦灏戦渶瑕丄CL鏉冮檺涓殑璇绘潈闄? 23锛塜mlSerializer浣跨敤鐨勯拡瀵瑰睘鎬х殑妯″紡鏈変粈涔堝ソ澶勶紵瑙e喅浜嗕粈涔堥棶棰橈紵 鍙簭鍒楀寲鏈夌敤鐨勬暟鎹紝鑰屼笉鏄簭鍒楀寲鏁翠釜瀵硅薄銆傚疄鐜版病蹇呰鐨勬暟鎹啑浣欙紝鍜屾彁鍗囧簭鍒楀寲鏃剁殑鎬ц兘銆?/p>
26.鏍规嵁濮旀墭(delegate)鐨勭煡璇嗭紝璇峰畬鎴愪互涓嬬敤鎴锋帶浠朵腑浠g爜鐗囨鐨勫~鍐欙細 27.鍒嗘瀽浠ヤ笅浠g爜锛屽畬鎴愬~绌?nbsp; 28.SQLSERVER鏈嶅姟鍣ㄤ腑锛岀粰瀹氳〃 table1 涓湁涓や釜瀛楁 ID銆丩astUpdateDate锛孖D琛ㄧず鏇存柊鐨勪簨鍔″彿锛?/strong> LastUpdateDate琛ㄧず鏇存柊鏃剁殑鏈嶅姟鍣ㄦ椂闂达紝璇蜂娇鐢ㄤ竴鍙QL璇彞鑾峰緱鏈€鍚庢洿鏂扮殑浜嬪姟鍙?nbsp; 29.鏍规嵁绾跨▼瀹夊叏鐨勭浉鍏崇煡璇嗭紝鍒嗘瀽浠ヤ笅浠g爜锛屽綋璋冪敤test鏂规硶鏃秈>10鏃舵槸鍚︿細寮曡捣姝婚攣?骞剁畝瑕佽鏄庣悊鐢便€?nbsp; 鎶奿nt鎹㈠仛涓€涓猳bject锛岄偅涔堟閿佷細鍙戠敓锛?/p>
3锛?浠€涔堝彨鍦堝鏉傚害锛坈yclomatic complexity锛夛紵涓轰粈涔堝畠寰堥噸瑕侊紵 涓嶇煡閬擄紝鏈涙寚鏁?锛?/p>
4锛?鍐欎竴涓爣鍑嗙殑lock()锛屽湪璁块棶鍙橀噺鐨勫墠鍚庡垱寤轰复鐣屽尯锛岃鏈?鍙岄噸妫€鏌?锛?/strong> 瑙侊細璇勮鍥炲 5锛?浠€涔堝彨FullTrust锛熸斁鍏AC鐨刟ssembly鏄惁鏄疐ullTrust鐨? FullTrust瀹屽叏淇′换銆傛斁鍏AC涓殑Assembly鏄惁FullTrust鎴戠殑鐞嗚В涓嶆槸銆傛垜鐞嗚ВFullTrust鏄彲浠ラ€氳繃浠g爜璁惧畾鐨?/p>
6锛?浠g爜鍔犱笂闇€瑕佸畨鍏ㄦ潈闄愮殑鐗规€ф湁浠€涔堝ソ澶勶紵 鍙互鏇村姞鐏垫椿鐨勮缃浠g爜鐨勮闂潈闄愶紝瀹炵幇浠g爜绾т繚鎶ゃ€傦紵杩欑偣涓嶆槸鐗规竻妤氾紝鏈夋槑鐧界殑缁欒瑙d笅 7锛?gacutil /l | find /i "Corillian" 杩欏彞鍛戒护鐨勪綔鐢ㄦ槸浠€涔堬紵 鍏ㄥ眬绋嬪簭闆嗙紦瀛樹腑濡傛灉鏈塁orillian灏辨洿鏂拌绋嬪簭闆嗭紝娌℃湁灏卞畨瑁?/p>
8锛?sn -t foo.dll 杩欏彞鍛戒护鏄共鍢涚殑锛?/strong> 鏄剧ず绋嬪簭闆唂oo.dll鐨勫叕閽ユ爣璁?/p>
9锛?DCOM闇€瑕侀槻鐏鎵撳紑鍝簺绔彛锛熺鍙?35鏄共鍢涚敤鐨勶紵 135绔彛锛屽洜涓篋COM鐨勭鍙e彿鏄殢鏈哄垎閰嶇殑锛岄粯璁ゆ儏鍐典笅锛屼細鍒嗛厤1024浠ヤ笂鐨勭鍙e彿锛屾墍浠ラ粯璁ゆ儏鍐典笅,DCOM 涓嶈兘绌胯秺闃茬伀澧欍€傚洜涓烘牴鏈笉鏅撳緱寮€鍝釜绔彛銆備絾鏈夎В鍐冲姙娉曞彲浠ヤ娇DCOM鍒嗛厤鐨勭鍙e彿鍥哄畾锛?35鏄繙绋嬭繃绋?/p>
璋冪敤(RPC)鐨勯粯璁ょ鍙?/p>
10锛夊姣擮OP鍜孲OA锛屽畠浠殑鐩殑鍒嗗埆鏄粈涔堬紵 鎴戞兂OOP鍜孲OA搴旇娌℃湁瀵规瘮鎬у惂銆侽OP鏄竴绉嶇紪绋嬫ā鍨嬶紝寮鸿皟灏嗗鏉傜殑閫昏緫鍒嗚В鍑哄皬鐨勬ā鍧楋紝鐗规€ф槸缁ф壙锛屽皝 瑁呭拰澶氭€?銆傝€孲OA鏄竴涓妧鏈鏋讹紝鎶€鏈鏋跺拰缂栫▼妯″瀷搴旇璇翠笉鏄竴鐮佷簨鍚э紵SOA鐨勬€濇兂鏄皢涓氬姟閫昏緫灏佽 鎴愭湇鍔℃垨鑰呬腑闂翠欢鎻愪緵缁欏簲鐢ㄧ▼搴忔潵璋冪敤锛屽綋鐒跺叾缁勪欢鍖栨€濇兂鏄户鎵垮拰鍙戞壃浜哋OP鐨勪紭鐐广€?/p>
13锛塂ebug.Write鍜孴race.Write鏈変粈涔堜笉鍚岋紵浣曟椂搴旇浣跨敤鍝竴涓紵 Debug.Write鏄皟璇曠殑鏃跺€欏悜璺熻釜绐楀彛杈撳嚭淇℃伅銆傚綋缂栬瘧妯″紡涓篸ebug鐨勬椂鍊欐墠鏈夋晥锛屼负release鐨勬椂 鍊橠ebug.Write鍦ㄧ紪璇戠殑鏃跺€欎細蹇界暐,鑰孴race鍒欐槸鍦╠ebug鍜宺elease涓ょ妯″紡涓嬪潎鍙互鍚戣窡韪獥鍙h緭鍑轰俊鎭€?/p>
14锛塂ebug Build鍜孯elease Build鐨勫尯鍒紝鏄惁浼氭湁鏄庢樉鐨勯€熷害鍙樺寲锛熻璇存槑鐞嗙敱銆?/strong> Debug浼氫骇鐢焢db鏂囦欢锛宺elease涓嶄細銆侱ebug鐢ㄤ簬寮€鍙戞椂鐨勮皟璇曪紝涓嶈兘瑕佷簬閮ㄧ讲锛岃€宺elease鐢ㄤ簬閮ㄧ讲.debug缂?/p>
璇戜竴浜涚壒娈婁唬鐮侊紝姣斿#IFDEBUG Debug.Write绛夛紝鑰孯elease鍒欎細灏嗛偅浜涚壒娈婃爣璁扮渷鐣?/p>
15锛塉IT鏄互assembly涓哄崟浣嶅彂鐢熻繕鏄互鏂规硶涓哄崟浣嶅彂鐢燂紵杩欏浜庡伐浣滃尯鏈変綍褰卞搷? 鏂规硶锛岄亾鐞嗗緢绠€鍗曪紝鍥犱负瀵逛簬涓€娆¤繍琛岋紝寰堝彲鑳藉彧鐢ㄥ埌涓€涓▼搴忛泦涓瀬灏戞暟绫诲瀷鍜屽璞★紝鑰屽ぇ閮ㄥ垎鍙兘骞朵笉浼氳 浣跨敤锛屾鏃禖LR鍌讳箮涔庣殑缁欐暣涓▼搴忛泦閮界粰Compile浜嗭紝CLR涓嶆槸鍌荤柉浜嗕箞 17锛塧.Equals(b)鍜宎 == b涓€鏍峰悧锛?/strong> 涓嶄竴鏍枫€俛.Equals(b)琛ㄧずa涓巄涓€鑷达紝 a==b琛ㄧずa涓巄鐨勫€肩浉绛?/p>
18锛夊湪瀵硅薄姣旇緝涓紝瀵硅薄涓€鑷村拰瀵硅薄鐩哥瓑鍒嗗埆鏄寚浠€涔堬紵 瀵硅薄涓€鑷存槸鎸囦袱涓璞℃槸鍚屼竴涓璞★紝寮曠敤鐩稿悓銆傝€屽璞$浉绛夋槸鎸囦袱涓璞$殑鍊肩浉鍚岋紝浣嗗紩鐢ㄤ笉涓€瀹氱浉鍚?/p>
19锛夊湪.NET涓浣曞疄鐜版繁鎷疯礉锛坉eep copy锛夛紵 瀹炵幇IClonable鎺ュ彛 20锛夎瑙i噴涓€涓婭Clonable IClonable鏂规硶鏄疄鐜版繁搴﹀鍒剁殑鎺ュ彛锛屽疄鐜板畠搴旇鑳芥繁搴﹀鍒朵竴涓璞″嚭鏉ャ€傛繁搴﹀鍒剁殑鐗瑰緛鐨勮皟鐢ㄥ璞$殑鏋勯€?/p>
鏂规硶锛屽垱寤烘柊鐨勫璞★紝鍖呮嫭鍒涘缓瀵硅薄涓祵濂楃殑寮曠敤瀵硅薄鐨勬柊瀹炰緥銆傝€孲hadow澶嶅埗鍒欎笉鍚岋紝鏄祬琛ㄥ鍒讹紝涓嶉噸鏂?/p>
鍒涘缓鏂板疄渚嬨€傛祬琛ㄥ鍒剁殑瀹炵幇鏄疧bject.MemberWiseClone(). 娣卞害澶嶅埗(Deep Copy)涓庢祬琛ㄥ鍒?Shadow Copy)鐨勬瘮杈?nbsp; public void ChangLastName(string lastName) Person samePerson = p.MemberwiseClone() as Person; Console.WriteLine(p.PersonName.LastName); 24锛変负浠€涔堜笉搴旇鍦?NET涓娇鐢╫ut鍙傛暟锛熷畠绌剁珶濂戒笉濂? 鎴戞尯鍠滄鐢╫ut鍙傛暟鐨勶紝鐗瑰埆鏄綋鍑芥暟闇€瑕佹湁澶氫簬1涓繑鍥炵殑鏃跺€欙紝鎴戞瘮杈冩効鎰忕敤out锛岃嚦浜庡畠濂戒笉濂芥病鐮旂┒杩?锛?/p>
25锛夌壒鎬ц兘澶熸斁鍒版煇涓柟娉曠殑鍙傛暟涓婏紵濡傛灉鍙互锛岃繖鏈変粈涔堢敤锛?/strong> 鍙互锛屼綔鐢ㄥ彲浠ュ鍙傛暟鏈夎繘涓€姝ラ檺瀹氾紝姣斿杈撳叆鍙傛暟涓篿nt绫诲瀷锛屽彲浠ラ€氳繃鍏佽AttributeTargets=ParameterInfo 鐨凙ttribute鑷畾涔夊疄鐜版潵闄愬畾杈撳叆鍙傛暟鐨勫ぇ灏忥紝姣斿褰撹緭鍏ュ弬鏁板皬浜?00鐨勬椂鍊欎究鎶遍敊銆?/p>
瀵规柟娉曠殑鍙傛暟璁剧疆Attribute鐨勪緥瀛?nbsp; public class AttributeTest ParameterAtt; 9.鎵ц涓嬮潰浠g爜鍚庯細 String strTemp ="abcdefg 鏌愭煇鏌?锛?/p>
Int i System.Text.Encoding.Default.GetBytes(strTemp).Length; Int j = strTemp.Length; 闂細i=(14 ) 锛沯=(11 ) i=(14 ) 锛沯=(11 ) 涓枃涓や釜瀛楄妭 12.姒傝堪.NET閲屽 remoting 鍜?webservice 涓ら」鎶€鏈殑鐞嗚В鍜屽疄闄呬腑鐨勫簲鐢ㄣ€?/strong> 杩滅▼閫昏緫璋冪敤锛宺emoing鎺ュ彛鍙兘鐢ㄥ湪.net涓?/p>
9. 濡備綍缁欐湇鍔″櫒绔帶浠跺鍔犲鎴风鑴氭湰銆?nbsp; 6锛?绉佹湁绋嬪簭闆嗕笌鍏变韩绋嬪簭闆嗘湁浠€涔堝尯鍒紵 鐩綍涓€傚叡浜▼搴忛泦閫氬父瀛樺偍鍦ㄥ叏灞€绋嬪簭闆嗙紦瀛橈紙Global Assembly Cache锛変箣涓紝杩欐槸涓€涓敱.NET杩愯鏃舵墍缁?/p>
鎶ょ殑绋嬪簭闆嗕粨搴撱€傚叡浜▼搴忛泦閫氬父鏄璁稿搴旂敤绋嬪簭閮芥湁鐢ㄧ殑浠g爜搴擄紝姣斿.NET Framework绫汇€?/p>
10 .璇疯В閲夾SP.NET涓互浠€涔堟柟寮忚繘琛屾暟鎹獙璇?nbsp; 涓獙璇佷俊鎭鐞嗘帶浠?/p>
11锛嶹EB鎺т欢鍙互婵€鍙戞湇鍔$浜嬩欢锛岃璋堣皥鏈嶅姟绔簨浠舵槸鎬庝箞鍙戠敓骞惰В閲婂叾鍘熺悊锛熻嚜鍔ㄤ紶鍥炴槸浠€涔堬紵涓轰粈涔堣 浣跨敤鑷姩浼犲洖銆?/strong> 鍥炵殑鐘舵€佷俊鎭嚜鍔ㄨ皟鐢ㄦ湇鍔$浜嬩欢鑷姩浼犲洖鏄綋鎴戜滑鍦ㄧ偣鍑诲鎴风鎺т欢鏃讹紝閲囩敤鎻愪氦琛ㄥ崟鐨勫舰寮忓皢鏁版嵁鐩存帴浼犲洖 鍒板姟绔?nbsp; 绔簨浠?/p>
13锛?nbsp; 璇疯В閲妛eb.config鏂囦欢涓殑閲嶈鑺傜偣 14锛?nbsp; 璇疯В閲夾SP銆侼ET涓殑web椤甸潰涓庡叾闅愯棌绫讳箣闂寸殑鍏崇郴锛?/strong> 鐨勯〉闈㈠0鏄庡涓?nbsp; 15锛?nbsp; 浠€涔堟槸viewstate锛岃兘鍚︾鐢紵鏄惁鎵€鐢ㄦ帶浠堕兘鍙互绂佺敤? 16锛?nbsp; 褰撳彂鐜颁笉鑳借鍙栭〉闈笂鐨勮緭鍏ョ殑鏁版嵁鏃跺緢鏈夊彲鑳芥槸浠€涔堝師鍥犻€犳垚鐨勶紵鎬庝箞瑙e喅锛?/strong> 17锛?nbsp; 璇疯В閲婁粈涔堟槸涓婁笅鏂囧璞★紝鍦ㄤ粈涔堟儏鍐典笅瑕佷娇鐢ㄤ笂涓嬫枃瀵硅薄 璞?Response,Request,Session,Server,Appliction绛?鏃跺氨瑕佷互浣跨敤姝ゅ璞?/p>
16銆佽В閲婁竴涓媋jax鍙婂疄鐜板師鐞?/strong> 1銆乨elegate鏄紩鐢ㄧ被鍨嬭繕鏄€肩被鍨嬶紵enum銆乮nt[]鍜宻tring鍛紙闅惧害绯绘暟40%锛夛紵 绛旀锛歞elegate寮曠敤绫诲瀷锛宔num鍊肩被鍨嬶紝int[]寮曠敤绫诲瀷锛宻tring寮曠敤绫诲瀷銆?/p>
3銆乥ase杩欎釜鍏抽敭瀛楁湁鍝嚑绉嶈娉曪紵override鍛紵 绛旀锛歜ase涓や釜璇硶锛屽垎鍒槸璋冪敤鍩虹被鏋勯€犲嚱鏁板拰璋冪敤鍩虹被鏂规硶锛宱verride鐢ㄤ簬閲嶅啓鍩虹被鏂规硶銆?/p>
4銆佽鎸囧嚭C#涓槸鍚︽湁涓嬪垪鍏抽敭瀛楋紵virtual銆乻ealed銆乤bstract銆乮mport銆乤s銆乮n銆乬oto銆乫inal銆丆onst銆乻igned銆?/p>
String锛堟彁绀猴紝浠呮寚鍑篊#涓病鏈夌殑鍗冲彲锛夛紙闅惧害绯绘暟50%锛夈€?/p>
绛旀锛氭病鏈夌殑鍏抽敭瀛楋細import銆乫inal銆丆onst銆乻igned銆丼tring 5銆佸湪寰幆锛歠or( int i = 0; i < 100; i++ ) Console.WriteLine( i );涓紝璇锋寚鍑篿++鐨勬墽琛屾椂鏈恒€?/strong> 绛旀锛氬湪Console.WriterLine( i );鎵ц涔嬪悗 6銆佽瘯璇存槑continue鍏抽敭瀛楃殑鐢ㄥ銆?/strong> 绛旀锛氶┈涓婂紑濮嬩笅涓€娆″惊鐜紝蹇界暐寰幆浣撲綑涓嬬殑璇彞 7銆乷bject鏄疌#鐨勫叧閿瓧鍚楋紵璇锋寚鍑篊#涓湁鍝簺绫诲瀷鍏抽敭瀛楋紝濡俰nt銆乫loat銆傦紙鎻愮ず锛屽啓寰楄秺澶氳秺濂斤級銆?/strong> 绛旀锛氭槸锛宱bject銆乮nt銆乽int銆乴ong銆乽long銆乻hort銆乽short銆乥yte銆乻byte銆乧har銆乫loat銆乨ouble銆乨ecimal銆乥oo l锛屽鍥炵瓟锛歟num銆乻truct銆乧lass銆乨elegate涔熺畻瀵广€?/p>
8銆丆#鐨刋ML鏂囨。娉ㄩ噴涓紙浠?//寮€澶寸殑娉ㄩ噴锛夛紝<summary>鏍囩鐢ㄤ簬鎻忚堪浠€涔堬紵<param>鏍囩鍛紵 绛旀锛?lt;summary>鐢ㄤ簬鏌愪釜鍏冪礌鐨勬瑕佽鏄庯紝<param>鐢ㄤ簬鏌愪釜鏂规硶鐨勫弬鏁版瑕佽鏄庛€?/p>
9銆佹垜浠煡閬揫]鏄暟缁勫拰绱㈠紩鍣ㄧ殑璁块棶鎿嶄綔绗︼紝浣嗗畠杩樻湁涓€涓娉曪紝鏄粈涔堬紵 绛旀锛氱壒鎬э紙Attribute锛?/p>
18.璇峰彊杩板睘鎬т笌绱㈠紩鍣ㄧ殑鍖哄埆銆?nbsp; 鍣ㄧ浉鍚岀殑褰㈠弬琛ㄣ€?/p>
1) 鎻忚堪绾跨▼涓庤繘绋嬬殑鍖哄埆锛?/strong> 绾跨▼(Thread)涓庤繘绋嬶紙Process锛変簩鑰呴兘瀹氫箟浜嗘煇绉嶈竟鐣岋紝涓嶅悓鐨勬槸杩涚▼瀹氫箟鐨勬槸搴旂敤绋嬪簭涓庡簲鐢ㄧ▼搴忎箣闂寸殑杈?/p>
鐣岋紝涓嶅悓鐨勮繘绋嬩箣闂翠笉鑳藉叡浜唬鐮佸拰鏁版嵁绌洪棿锛岃€岀嚎绋嬪畾涔夌殑鏄唬鐮佹墽琛屽爢鏍堝拰鎵ц涓婁笅鏂囩殑杈圭晫銆備竴涓繘绋嬪彲 浠ュ寘鎷嫢骞蹭釜绾跨▼锛屽悓鏃跺垱寤哄涓嚎绋嬫潵瀹屾垚鏌愰」浠诲姟锛屼究鏄绾跨▼銆傝€屽悓涓€杩涚▼涓殑涓嶅悓绾跨▼鍏变韩浠g爜鍜屾暟鎹?/p>
绌洪棿銆傜敤涓€涓瘮鍠绘潵璇达紝濡傛灉涓€涓搴唬琛ㄤ竴涓繘绋嬶紝鍦ㄥ搴唴閮紝鍚勪釜鎴愬憳灏辨槸绾跨▼锛屽搴腑鐨勬瘡涓垚鍛橀兘鏈?/p>
涔夊姟瀵瑰搴殑璐㈠瘜杩涜绉疮锛屽悓鏃朵篃鏈夋潈鍒╁瀹跺涵璐㈠瘜杩涜娑堣垂锛屽綋闈㈠涓€涓换鍔$殑鏃跺€欙紝瀹跺涵涔熷彲浠ユ淳鍑哄嚑涓?/p>
鎴愬憳鏉ュ崗鍚屽畬鎴愶紝鑰屽搴箣澶栫殑浜哄垯娌℃湁鍔炴硶鐩存帴娑堣垂涓嶅睘浜庤嚜宸卞搴殑璐骇銆?/p>
2) 浠€涔堟槸Windows鏈嶅姟锛屽畠鐨勭敓鍛藉懆鏈熶笌鏍囧噯鐨凟XE绋嬪簭鏈変粈涔堜笉鍚?/strong> Windows鏈嶅姟鏄繍琛屽湪windows鍚庡彴鎸囧畾鐢ㄦ埛涓嬶紙榛樿System锛夌殑搴旂敤绋嬪簭锛屽畠娌℃湁鏍囧噯鐨刄I鐣岄潰锛屾兂姣旀爣鍑?/p>
鐨凟XE绋嬪簭锛學indows鏈嶅姟鏄湪鏈嶅姟寮€濮嬬殑鏃跺€欏垱寤猴紝鑰屽湪鏈嶅姟缁撴潫鐨勬椂鍊欓攢姣侊紝鑰屼笖鍙互璁剧疆鏈嶅姟鏄惁涓庢搷浣?/p>
绯荤粺涓€璧峰惎鍔紝涓€璧峰叧闂€傚畠鏀寔涓夌鏂瑰紡锛氾紤锛夎嚜鍔ㄦ柟寮?2锛夋墜鍔ㄦ柟寮?锛擄級绂佺敤 銆傝嚜鍔ㄦ柟寮忕殑鏃?/p>
鍊欙紝windows鏈嶅姟灏嗗湪OS鍚姩鍚庤嚜鍔ㄥ惎鍔ㄨ繍琛岋紝鑰屾墜鍔ㄦ柟寮忓垯蹇呴』鎵嬪伐鍚姩鏈嶅姟锛岀鐢ㄧ殑鎯呭喌涓嬫湇鍔″皢涓嶈兘琚?/p>
鍚姩銆傚彟澶栨爣鍑嗙殑EXE榛樿浣跨敤鐨勫綋鍓嶇櫥褰曠殑鐢ㄦ埛锛岃€寃indows鏈嶅姟鍒欓粯璁や娇鐢⊿ystem鐢ㄦ埛锛岃繖鍦ㄥ绯荤粺璧勬簮璁?/p>
闂殑鏃跺€欑壒鍒渶瑕佹敞鎰忋€?/p>
3) Windows鍗曚釜杩涚▼鎵€鑳借闂殑鏈€澶у唴瀛橀噺鏄灏戯紵瀹冧笌绯荤粺鐨勬渶澶ц櫄鎷熷唴瀛樹竴鏍峰悧锛熻繖瀵逛簬绯荤粺璁捐鏈変粈涔?/strong> 褰卞搷锛?/strong> 杩欎釜闇€瑕侀拡瀵圭‖浠跺钩鍙帮紝鍏紡涓哄崟涓繘绋嬭兘璁块棶鐨勬渶澶у唴瀛橀噺=2鐨勫鐞嗗櫒浣嶆暟娆℃柟/2锛屾瘮濡傞€氬父鎯呭喌涓嬶紝32浣?/p>
澶勭悊鍣ㄤ笅锛屽崟涓繘绋嬫墍鑳借闂殑鏈€澶у唴瀛橀噺涓?232 /2 = 2G 銆傚崟涓繘绋嬭兘璁块棶鐨勬渶澶у唴瀛橀噺鏄渶澶ц櫄鎷熷唴瀛?/p>
鐨?/2锛屽洜涓鸿鍒嗛厤缁欐搷浣滅郴缁熶竴鍗婅櫄鎷熷唴瀛樸€?/p>
4) 浠€涔堟槸寮虹被鍨嬶紝浠€涔堟槸寮辩被鍨嬶紵鍝鏇村ソ浜涳紵涓轰粈涔? 寮虹被鍨嬫槸鍦ㄧ紪璇戠殑鏃跺€欏氨纭畾绫诲瀷鐨勬暟鎹紝鍦ㄦ墽琛屾椂绫诲瀷涓嶈兘鏇存敼锛岃€屽急绫诲瀷鍦ㄦ墽琛岀殑鏃跺€欐墠浼氱‘瀹氱被鍨嬨€傛病鏈?/p>
濂戒笉濂斤紝浜岃€呭悇鏈夊ソ澶勶紝寮虹被鍨嬪畨鍏紝鍥犱负瀹冧簨鍏堝凡缁忕‘瀹氬ソ浜嗭紝鑰屼笖鏁堢巼楂樸€備竴鑸敤浜庣紪璇戝瀷缂栫▼璇?/p>
瑷€锛屽c++,java,c#,pascal绛?寮辩被鍨嬬浉姣旇€岃█涓嶅畨鍏紝鍦ㄨ繍琛岀殑鏃跺€欏鏄撳嚭鐜伴敊璇紝浣嗗畠鐏垫椿锛屽鐢ㄤ簬瑙i噴鍨嬬紪 绋嬭瑷€锛屽javascript,vb绛?/p>
5) PID鏄粈涔堬紵鍦ㄥ仛绯荤粺鐨勬晠闅滄帓闄ゆ椂濡備綍浣跨敤瀹冿紵 PID鏄繘绋嬬紪鍙凤紝鍦ㄧ郴缁熷彂鐜版晠闅滅殑鏃跺€欙紝鍙互鏍规嵁瀹冨鎵炬晠闅滄墍鍙戠敓鐨勫叿浣撹繘绋嬶紝骞朵笖鍙€氳繃visual studio.net 绛塱de灏嗘晠闅滆繘绋嬮檮鍔犲埌杩涚▼涓繘琛岃皟璇?debug) 6) 鍗曚釜TCP/IP绔彛涓婅兘澶熻澶氬皯涓繘绋嬩睛鍚紵 锛戜釜 7) 浠€涔堟槸GAC锛熷畠瑙e喅浜嗕粈涔堥棶棰? Gloal Assembly Cache锛屽叏灞€搴旂敤绋嬪簭闆嗙紦瀛樸€傚畠瑙e喅浜嗗嚑涓▼搴忓叡浜煇涓€涓▼搴忛泦鐨勯棶棰樸€備笉蹇呭啀灏嗛偅涓鍏?/p>
浜殑绋嬪簭闆嗘嫹璐濆埌搴旂敤绋嬪簭鐩綍浜嗭紝鍏跺疄杩欓亾鐞嗗緢绠€鍗曪紝.net搴旂敤绋嬪簭鍦ㄥ姞杞界殑鏃跺€欙紝浼氶鍏堟煡鐪嬪叏灞€搴旂敤绋嬪簭 闆嗙紦瀛橈紝濡傛灉鏈夊氨鍙互鐩存帴浣跨敤锛屾病鏈夊啀鍒板簲鐢ㄧ▼搴忕洰褰曡繘琛屾煡鎵俱€?/p>
1.鐧界洅娴嬭瘯鍜岄粦鐩掓祴璇?/strong> 鐧界洅娴嬭瘯锛氬凡鐭ヤ骇鍝佺殑鍐呴儴宸ヤ綔杩囩▼锛屽彲浠ラ€氳繃娴嬭瘯璇佹槑姣忕鍐呴儴鎿嶄綔鏄惁绗﹀悎璁捐瑙勬牸瑕佹眰锛屾墍鏈夊唴閮ㄦ垚 鍒嗘槸鍚︿互缁忚繃妫€鏌ャ€?/p>
杞欢鐨勯粦鐩掓祴璇曟剰鍛崇潃娴嬭瘯瑕佸湪杞欢鐨勬帴鍙e杩涜銆傝繖绉嶆柟娉曟槸鎶婃祴璇曞璞$湅鍋氫竴涓粦鐩掑瓙锛屾祴璇曚汉鍛樺畬鍏?/p>
涓嶈€冭檻绋嬪簭鍐呴儴鐨勯€昏緫缁撴瀯鍜屽唴閮ㄧ壒鎬э紝鍙緷鎹▼搴忕殑闇€姹傝鏍艰鏄庝功锛屾鏌ョ▼搴忕殑鍔熻兘鏄惁绗﹀悎瀹冪殑鍔熻兘璇存槑 銆傚洜姝ら粦鐩掓祴璇曞張鍙姛鑳芥祴璇曟垨鏁版嵁椹卞姩娴嬭瘯銆傞粦鐩掓祴璇曚富瑕佹槸涓轰簡鍙戠幇浠ヤ笅鍑犵被閿欒锛?/p>
1銆佹槸鍚︽湁涓嶆纭垨閬楁紡鐨勫姛鑳斤紵 2銆佸湪鎺ュ彛涓婏紝杈撳叆鏄惁鑳芥纭殑鎺ュ彈锛熻兘鍚﹁緭鍑烘纭殑缁撴灉锛?/p>
3銆佹槸鍚︽湁鏁版嵁缁撴瀯閿欒鎴栧閮ㄤ俊鎭紙渚嬪鏁版嵁鏂囦欢锛夎闂敊璇紵 4銆佹€ц兘涓婃槸鍚﹁兘澶熸弧瓒宠姹傦紵 5銆佹槸鍚︽湁鍒濆鍖栨垨缁堟鎬ч敊璇紵 杞欢鐨勭櫧鐩掓祴璇曟槸瀵硅蒋浠剁殑杩囩▼鎬х粏鑺傚仛缁嗚嚧鐨勬鏌ャ€傝繖绉嶆柟娉曟槸鎶婃祴璇曞璞$湅鍋氫竴涓墦寮€鐨勭洅瀛愶紝瀹冨厑璁?/p>
娴嬭瘯浜哄憳鍒╃敤绋嬪簭鍐呴儴鐨勯€昏緫缁撴瀯鍙婃湁鍏充俊鎭紝璁捐鎴栭€夋嫨娴嬭瘯鐢ㄤ緥锛屽绋嬪簭鎵€鏈夐€昏緫璺緞杩涜娴嬭瘯銆傞€氳繃鍦ㄤ笉 鍚岀偣妫€鏌ョ▼搴忕姸鎬侊紝纭畾瀹為檯鐘舵€佹槸鍚︿笌棰勬湡鐨勭姸鎬佷竴鑷淬€傚洜姝ょ櫧鐩掓祴璇曞張绉颁负缁撴瀯娴嬭瘯鎴栭€昏緫椹卞姩娴嬭瘯銆傜櫧鐩?/p>
娴嬭瘯涓昏鏄兂瀵圭▼搴忔ā鍧楄繘琛屽涓嬫鏌ワ細 1銆佸绋嬪簭妯″潡鐨勬墍鏈夌嫭绔嬬殑鎵ц璺緞鑷冲皯娴嬭瘯涓€閬嶃€?/p>
2銆佸鎵€鏈夌殑閫昏緫鍒ゅ畾锛屽彇“鐪?rdquo;涓庡彇“鍋?rdquo;鐨勪袱绉嶆儏鍐甸兘鑳借嚦灏戞祴涓€閬嶃€?/p>
3銆佸湪寰幆鐨勮竟鐣屽拰杩愯鐨勭晫闄愬唴鎵ц寰幆浣撱€?/p>
4銆佹祴璇曞唴閮ㄦ暟鎹粨鏋勭殑鏈夋晥鎬э紝绛夌瓑銆?/p>
璇风畝杩颁竴涓嬬敤Socket杩涜鍚屾閫氳缂栫▼鐨勮缁嗘楠?nbsp; OSI缃戠粶缁撴瀯鐨勪竷灞傛ā鍨嬪強鍏舵牳蹇冩€濇兂鏄粈涔?nbsp; 2 鍑犲崄涓婄櫨涓囪锛屽浣曞揩閫熸煡璇㈠嚭琛ㄦ暟鎹?nbsp; 涓夈€佹暟鎹簱鏌ヨ浼樺寲锛?nbsp; 1.涓や釜琛紝鍐欐煡璇㈣鍙ワ紝鏍规嵁涓や釜瀛楁涓€涓槸鍗囧簭锛屼竴涓皢搴忋€?nbsp; declare @strSQL varchar(6000) -- 涓昏鍙?nbsp; if @OrderType != 0 set @strSQL = 鈥榮elect top 鈥?+ str(@PageSize) + 鈥?* from [鈥?nbsp; if @strWhere != 鈥樷€?nbsp; if @PageIndex = 1 set @strSQL = 鈥榮elect top 鈥?+ str(@PageSize) + 鈥?* from [鈥?nbsp; exec (@strSQL) GO 2.鍐欏嚭涓€鏉ql璇彞锛?鍙栧嚭琛ˋ涓31鍒扮40璁板綍锛圫QLServer, 浠ヨ嚜鍔ㄥ闀跨殑ID浣滀负涓婚敭, 娉ㄦ剰锛欼D鍙兘涓嶆槸杩炵画鐨勩€傦級 3.public class c{ public c(string a) : this() {;}; public c() {;} } 瑙i噴绗竴涓瀯閫犲嚱鏁颁腑鍙戠敓浜嗕粈涔堬紵杩欎釜鏋勯€犲嚱鏁版湁浠€涔堢敤? 4.涓€涓暱搴︿负10000鐨勫瓧绗︿覆锛岄€氳繃闅忔満浠巃-z涓娊鍙?0000涓瓧绗︾粍鎴愩€傝鐢╟锛冭瑷€缂栧啓涓昏绋嬪簭鏉ュ疄鐜般€?nbsp; 5.浜х敓涓€涓猧nt鏁扮粍锛岄暱搴︿负100锛屽苟鍚戝叾涓殢鏈烘彃鍏?-100锛屽苟涓斾笉鑳介噸澶嶃€?nbsp; 2.濡備綍鎶婁竴涓狝rray澶嶅埗鍒癆rrayList閲?nbsp; 8.鐢–#鍐欎竴娈甸€夋嫨鎺掑簭绠楁硶锛岃姹傜敤鑷繁鐨勭紪绋嬮鏍笺€?nbsp; for (int j = i + 1; j < list.Length; j++) min = j; } int t = list[min]; list[min] = list[i]; list[i] = t; } 4.鍐欎竴涓嚱鏁拌绠楀綋鍙傛暟涓篘鐨勫€?1-2+3-4+5-6+7……+N public int returnSum1(int n) 7. 鏌愪竴瀵嗙爜浠呬娇鐢↘銆丩銆丮銆丯銆丱鍏?涓瓧姣嶏紝瀵嗙爜涓殑鍗曡瘝浠庡乏鍚戝彸鎺掑垪锛屽瘑鐮佸崟璇嶅繀椤婚伒寰涓嬭鍒?锛?nbsp; 62-63=1 绛夊紡涓嶆垚绔嬶紝璇风Щ鍔ㄤ竴涓暟瀛楋紙涓嶅彲浠ョЩ鍔ㄥ噺鍙峰拰绛変簬鍙凤級锛屼娇寰楃瓑寮忔垚绔嬶紝濡備綍绉诲姩锛?nbsp; 17銆佸垪鍑哄父鐢ㄧ殑浣跨敤javascript鎿嶄綔xml鐨勭被鍖?/strong> 缁欏畾浠ヤ笅XML鏂囦欢锛屽畬鎴愮畻娉曟祦绋嬪浘<FileSystem>
QueryString 浼犻€掍竴涓垨澶氫釜瀹夊叏鎬ц姹備笉楂樻垨鏄粨鏋勭畝鍗曠殑鏁板€笺€備絾鏄浜庝紶閫掓暟缁勬垨瀵硅薄鐨勮瘽锛屽氨涓嶈兘鐢ㄨ繖涓柟娉曚簡
session(viewstate) 绠€鍗曪紝浣嗘槗涓㈠け 浣滅敤浜庣敤鎴蜂釜浜?杩囬噺鐨勫瓨鍌ㄤ細瀵艰嚧鏈嶅姟鍣ㄥ唴瀛樿祫婧愮殑鑰楀敖銆?nbsp;
application 瀵硅薄鐨勪綔鐢ㄨ寖鍥存槸鏁翠釜鍏ㄥ眬锛屼篃灏辨槸璇村鎵€鏈夌敤鎴烽兘鏈夋晥銆傚叾甯哥敤鐨勬柟娉曠敤Lock鍜孶nLock
cookie 绠€鍗曪紝浣嗗彲鑳戒笉鏀寔锛屽彲鑳借浼€?Cookie鏄瓨鏀惧湪瀹㈡埛绔殑锛岃€宻ession鏄瓨鏀惧湪鏈嶅姟鍣ㄧ鐨勩€傝€屼笖Cookie鐨勪娇鐢ㄨ閰嶅悎ASP.NET鍐呯疆瀵硅薄Request鏉ヤ娇鐢?nbsp;
input ttype="hidden" 绠€鍗曪紝鍙兘琚吉閫?nbsp;
url鍙傛暟绠€鍗曪紝鏄剧ず浜庡湴鍧€鏍忥紝闀垮害鏈夐檺
Server.Transfer 鎶婃祦绋嬩粠褰撳墠椤甸潰寮曞鍒板彟涓€涓〉闈腑锛屾柊鐨勯〉闈娇鐢ㄥ墠涓€涓〉闈㈢殑搴旂瓟娴?nbsp;
鏁版嵁搴撶ǔ瀹氾紝瀹夊叏锛屼絾鎬ц兘鐩稿寮?/p>
浠€涔堟槸Viewstate锛熷畠鏈変粈涔堜綔鐢紵
ViewState鍙淮鎶ゅ綋鍓嶉〉闈㈢殑鐘舵€侊紝涓嶅悓椤甸潰涔嬮棿涓嶈兘鍏变韩锛孲ession鍙互銆?nbsp;
ViewState浣犲彲浠ョ悊瑙d负涓€涓殣钘忔帶浠躲€?/p>
姣忎釜椤甸潰鐨勭敓鍛藉懆鏈熶负鐢ㄦ埛鐨勬瘡涓€娆¤闂紝涔熷氨鏄姣忎竴娆″鎴风涓庢湇鍔″櫒涔嬮棿鐨勪竴涓線杩旇繃绋?鍏ㄥ眬鍙橀噺鐨勭敓鍛藉懆鏈熷湪姝や箣闂?
2. Load ViewState and Postback data;
3. Page_Load();
4. Handle control events;
5. Page_PreRender();
6. Page_Render();
7. Unload event;
8. Dispose method called;
绛旓細
Connection 鎵撳紑鏁版嵁搴撹繛鎺?nbsp;
Command 鎵ц鏁版嵁搴撳懡浠?nbsp;
DataAdapter 杩炴帴鏁版嵁锛屾墽琛屾暟鎹簱鍛戒护锛屽~鍏匘ataSet
DataSet 鏁版嵁鍦ㄥ唴瀛樹腑鐨勭紦瀛橈紝鏁版嵁缁撴瀯
DataReader 鍙鍚戝墠鐨勮鍙栨暟鎹簱
DataReader浣跨敤鏃跺缁堝崰鐢⊿qlConnection,鍦ㄧ嚎鎿嶄綔鏁版嵁搴?.浠讳綍瀵筍qlConnection鐨勬搷浣滈兘浼氬紩鍙慏ataReader鐨勫紓甯?.鍥犱负DataReader姣忔鍙湪鍐呭瓨涓姞杞戒竴鏉℃暟鎹?鎵€浠ュ崰鐢ㄧ殑鍐呭瓨鏄緢灏忕殑..鍥犱负DataReader鐨勭壒娈婃€у拰楂樻€ц兘.鎵€浠ataReader鏄彧杩涚殑..浣犺浜嗙涓€鏉″悗灏变笉鑳藉啀鍘昏鍙栫涓€鏉′簡..
DataSet鍒欐槸灏嗘暟鎹竴娆℃€у姞杞藉湪鍐呭瓨涓?鎶涘純鏁版嵁搴撹繛鎺?.璇诲彇瀹屾瘯鍗虫斁寮冩暟鎹簱杩炴帴..鍥犱负DataSet灏嗘暟鎹叏閮ㄥ姞杞藉湪鍐呭瓨涓?鎵€浠ユ瘮杈冩秷鑰楀唴瀛?..浣嗘槸纭瘮DataReader瑕佺伒娲?.鍙互鍔ㄦ€佺殑娣诲姞琛?鍒?鏁版嵁.瀵规暟鎹簱杩涜鍥炰紶鏇存柊鎿嶄綔...
1.鎻愰珮鎬ц兘锛屽噺灏戠綉缁滀紶杈擄紝鑺傜害鏃堕棿 銆?/p>
绛旓細ADO锛孉DO.Net锛孧DAC(Microsoft Data Access Components)锛孧icrosoft SQL Server OLE DB Provider锛?/p>
涓囩墿閮芥槸瀵硅薄锛屽叾涓昏鐗瑰緛锛氬皝瑁呫€佺户鎵裤€佸鎬?nbsp;
绛旓細浠讳綍浜嬬墿閮藉彲浠ョ悊瑙d负瀵硅薄锛屽叾涓昏鐗瑰緛锛?缁ф壙銆傚皝瑁呫€傚鎬併€傜壒鐐癸細浠g爜濂界淮鎶わ紝瀹夊叏锛岄殣钘忎俊鎭?nbsp;
绛旓細浠庡€肩被鍨嬫帴鍙h浆鎹㈠埌寮曠敤绫诲瀷瑁呯銆備粠寮曠敤绫诲瀷杞崲鍒板€肩被鍨嬫媶绠便€傝绠憋紙boxing锛夋槸灏嗗€肩被鍨嬬殑鏁版嵁杞寲鎴愬紩鐢ㄧ被鍨嬶紝int i=3; object o = i ;渚挎槸瑁呯杩囩▼锛岃€屾媶绠?unboxing)鏄皢楗敤绫诲瀷鏁版嵁杞崲鍊肩被鍨?姣斿int j = (int)o锛涘睘浜庢媶绠?/p>
鎺ュ彛鐢ㄤ簬瑙勮寖锛屾娊璞$被鐢ㄤ簬鍏辨€с€傛帴鍙d腑鍙兘澹版槑鏂规硶锛屽睘鎬э紝浜嬩欢锛岀储寮曞櫒銆傝€屾娊璞$被涓彲浠ユ湁鏂规硶鐨勫疄
涓€绉嶄笉鍙互琚疄渚嬪寲鐨勭被銆傛娊璞$被涓竴鑸惈鏈夋娊璞℃柟娉曪紝褰撶劧涔熷彲鏈夊叿浣撳疄鐜般€傜户鎵跨被鍙湁瀹炵幇杩囨墍鏈夋娊
褰撹繖涓被涓寘鍚娊璞℃柟娉曟椂锛屾垨鏄绫诲苟娌℃湁瀹屽叏瀹炵幇鐖剁被鐨勬娊璞℃柟娉曟椂銆?/p>
鍙惈鏈夊叡鏈夋娊璞℃柟娉曪紙public abstract method锛夌殑绫汇€傝繖浜涙柟娉曞繀椤诲湪瀛愮被涓瀹炵幇銆?/p>
鎺ュ彛涓殑鏂规硶鐢ㄦ潵瀹氫箟瀵硅薄涔嬮棿閫氫俊鐨勫绾︼紝鎸囧畾鎺ュ彛涓殑鏂规硶涓虹鏈夋垨淇濇姢娌℃湁鎰忎箟銆備粬浠粯璁や负鍏湁鏂规硶銆?/p>
褰撶劧銆?/p>
杩欑鎯呭喌涓綘鍙互鍐冲畾濡備綍瀹炵幇銆傚綋鐒堕渶瑕佺壒鍒緱灏忓績銆備絾鏄湪缂栬瘧鐜妭鏄病鏈夐棶棰樼殑銆?/p>
鎺ュ彛涓墍鏈夋柟娉曞繀椤绘槸鎶借薄鐨勶紝骞朵笖涓嶈兘鎸囧畾鏂规硶鐨勮闂慨楗扮銆傛娊璞$被涓彲浠ユ湁鏂规硶鐨勫疄鐜帮紝涔熷彲浠ユ寚
缁撴瀯鏄€肩被鍨嬶紝鍙兘缁ф壙鎺ュ彛锛屼笉鑳借缁ф壙锛屾病鏈夐粯璁ょ殑鏋勯€犲嚱鏁帮紝鍙互鍒涘缓锛屾病鏈夋瀽鏋勫嚱鏁帮紝涓嶅彲浠ョ敤abstract鍜宻ealed锛屾病鏈塸rotected淇グ绗︼紝鍙互涓嶇敤new鍒濆鍖栥€?nbsp;
1锛?鍫嗘爤鐨勭┖闂存湁闄愶紝瀵逛簬澶ч噺鐨勯€昏緫鐨勫璞★紝鍒涘缓绫昏姣斿垱寤虹粨鏋勫ソ涓€浜?nbsp;
2锛?缁撴瀯琛ㄧず濡傜偣銆佺煩褰㈠拰棰滆壊杩欐牱鐨勮交閲忓璞?nbsp;
渚嬪锛屽鏋滃0鏄庝竴涓惈鏈?1000 涓偣瀵硅薄鐨勬暟缁勶紝鍒欏皢涓哄紩鐢ㄦ瘡涓璞″垎閰嶉檮鍔犵殑鍐呭瓨銆?nbsp;
鍦ㄦ鎯呭喌涓嬶紝缁撴瀯鐨勬垚鏈緝浣庛€?nbsp;
3锛?鍦ㄨ〃鐜版娊璞″拰澶氱骇鍒殑瀵硅薄灞傛鏃讹紝绫绘槸鏈€濂界殑閫夋嫨
4锛?澶у鏁版儏鍐典笅璇ョ被鍨嬪彧鏄竴浜涙暟鎹椂锛岀粨鏋勬椂鏈€浣崇殑閫夋嫨
寮傦細
涓嶈兘鐩存帴瀹炰緥鍖栨帴鍙c€?nbsp;
鎺ュ彛涓嶅寘鍚柟娉曠殑瀹炵幇銆?nbsp;
鎺ュ彛銆佺被鍜岀粨鏋勫彲浠庡涓帴鍙g户鎵裤€備絾鏄疌# 鍙敮鎸佸崟缁ф壙锛氱被鍙兘浠庝竴涓熀绫荤户鎵垮疄鐜般€?nbsp;
绫诲畾涔夊彲鍦ㄤ笉鍚岀殑婧愭枃浠朵箣闂磋繘琛屾媶鍒嗐€?nbsp;
鍚岋細
鎺ュ彛銆佺被鍜岀粨鏋勫彲浠庡涓帴鍙g户鎵裤€?nbsp;
鎺ュ彛绫讳技浜庢娊璞″熀绫伙細缁ф壙鎺ュ彛鐨勪换浣曢潪鎶借薄绫诲瀷閮藉繀椤诲疄鐜版帴鍙g殑鎵€鏈夋垚鍛樸€?nbsp;
鎺ュ彛鍙互鍖呭惈浜嬩欢銆佺储寮曞櫒銆佹柟娉曞拰灞炴€с€?nbsp;
涓€涓被鍙互瀹炵幇澶氫釜鎺ュ彛銆?/p>
const鍏抽敭瀛楃敤鏉ュ0鏄庣紪璇戞椂甯搁噺锛宺eadonly鐢ㄦ潵澹版槑杩愯鏃跺父閲忋€?/p>
sealed 淇グ绗︾敤浜庨槻姝粠鎵€淇グ鐨勭被娲剧敓鍑哄叾瀹冪被銆傚鏋滀竴涓瘑灏佺被琚寚瀹氫负鍏朵粬绫荤殑鍩虹被锛屽垯浼氬彂鐢熺紪璇戞椂閿欒銆?nbsp;
瀵嗗皝绫讳笉鑳藉悓鏃朵负鎶借薄绫汇€?nbsp;
sealed 淇グ绗︿富瑕佺敤浜庨槻姝㈤潪鏈夋剰鐨勬淳鐢燂紝浣嗘槸瀹冭繕鑳戒績浣挎煇浜涜繍琛屾椂浼樺寲銆傚叿浣撹鏉ワ紝鐢变簬瀵嗗皝绫绘案
绛旓細
1)virtual鎸囨槑涓€鎴愬憳鍑芥暟涓鸿櫄鍑芥暟,鑰寁irtual浠呯敤浜庣被鐨勫畾涔夐噷,鍦ㄧ被澶栧彲涓嶅姞姝ゅ叧閿瓧.
2)涓€涓被鐨勬垚鍛樺嚱鏁拌瀹氫箟涓鸿櫄鍑芥暟鏃?瀛愮被璇ュ嚱鏁颁粛淇濇寔铏氬嚱鏁扮壒寰?
3)瀛愮被瑕嗙洊姝ゅ嚱鏁版椂,瀹氫箟閲屽彲涓嶅姞virtual鍏抽敭瀛?浣嗗嚱鏁板0鏄庤鍜屽熀绫荤殑瀹屽叏涓€鑷?涓旀澹版槑鏄繀椤荤殑.
4)涓嶆槸绾櫄鍑芥暟鏃?鐖剁被鐨勮櫄鍑芥暟蹇呴』瑕佸疄鐜? 鑰岃嫢灏嗙埗绫荤殑铏氬嚱鏁拌瀹氫负绾櫄鍑芥暟鏃?瀛愮被蹇呴渶瑕佽鐩栦箣鑰屼笖蹇呴』瑕佸疄鐜颁箣!
virtual鐢虫槑铏氭柟娉曠殑鍏抽敭瀛楋紝璇存槑璇ユ柟娉曞彲浠ヨ閲嶅啓
sealed璇存槑璇ョ被涓嶅彲琚户鎵?nbsp;
override閲嶅啓鍩虹被鐨勬柟娉?nbsp;
abstract鐢虫槑鎶借薄绫诲拰鎶借薄鏂规硶鐨勫叧閿瓧锛屾娊璞℃柟娉曚笉鎻愪緵瀹炵幇锛岀敱瀛愮被瀹炵幇锛屾娊璞$被涓嶅彲瀹炰緥鍖栥€?nbsp;
绛旓細閲嶈浇鏄柟娉曠殑鍚嶇О鐩稿悓,涓嶅悓鐨勫弬鏁扮被鍨嬶紝涓嶅悓鐨勫弬鏁颁釜鏁帮紝涓嶅悓鐨勫弬鏁伴『搴忋€傝鍐欐彁渚涗簡瀛愮被涓敼鍙樼埗绫绘柟娉曡涓虹殑瀹炵幇(鏄繘琛屽熀绫讳腑鍑芥暟鐨勯噸鍐?銆?nbsp;
绛旓細琚玽irtual淇グ鐨勬柟娉曞彲浠ヨ瀛愮被瑕嗗啓
绛旓細涓嶈兘锛岃鍐欐柟娉曠殑绛惧悕蹇呴』涓庤瑕嗗啓鏂规硶鐨勭鍚嶄繚鎸佷竴鑷达紝闄や簡灏唙irtual鏀逛负override銆?nbsp;
绛旓細涓嶅彲浠ワ紝鐢氳嚦瀛愮被涓棤娉曡闂埗绫讳腑鐨勭鏈夋柟娉?nbsp;
绛旓細鍙互锛屼娇鐢ㄥ叧閿瓧sealed
绛旓細鍙互锛屾爣璁拌繖涓被涓簆ublic锛屽苟鏍囪杩欎釜鏂规硶涓簊ealed銆?nbsp;
涓嶅悓鐨勫弬鏁扮被鍨嬶紝涓嶅悓鐨勫弬鏁颁釜鏁帮紝涓嶅悓鐨勫弬鏁伴『搴?/p>
濮旀墭鍙互鎶婁竴涓柟娉曚綔涓哄弬鏁颁唬鍏ュ彟涓€涓柟娉曘€傚鎵樺彲浠ョ悊瑙d负鎸囧悜涓€涓嚱鏁扮殑寮曠敤銆傛槸锛屾槸涓€绉嶇壒娈婄殑濮旀墭
鍫嗭紙Heap锛変腑淇濆瓨鍊煎拰瀵硅薄锛岃皟鐢ㄥ畬姣曚箣鍚庝緷鐒跺瓨鍦紝鐢卞瀮鍦惧洖鏀跺櫒鏌ユ壘鏍堜腑鏈夋棤鎸囧悜璇ュ€兼垨瀵硅薄鐨勫紩鐢紝鏃犲垯浠庡爢涓垹闄?/p>
C# ref涓巓ut鍖哄埆:
濂藉鏄?mdash;—绫诲瀷瀹夊叏鍜屽噺灏戣绠便€佹媶绠便€傛彁楂樻€ц兘銆佺被鍨嬪畨鍏ㄥ拰璐ㄩ噺锛屽噺灏戦噸澶嶆€х殑缂栫▼浠诲姟
System.Object.
鍦ㄧ被鍚嶅悗鍔犱笂涓€涓啋鍙凤紝鍐嶅姞涓婂熀绫荤殑鍚嶇О銆?nbsp;
涓嶆敮鎸併€傚彲浠ョ敤鎺ュ彛鏉ュ疄鐜般€?nbsp;
鍦ㄧ户鎵挎垨闂存帴缁ф壙涓庤繖涓被鐨勫瓙绫讳腑鍙互璁块棶銆?nbsp;
浼氾紝浣嗘槸涓嶈兘琚闂€傛墍浠ョ湅涓婂幓浠栦滑浼间箮鏄笉鑳借缁ф壙鐨勶紝浣嗗疄闄呬笂纭疄琚户鎵夸簡銆?nbsp;
绛旓細涓や釜锛屼竴鏃︿綘瀹炵幇浜嗕竴涓瀯閫犲嚱鏁帮紝C#灏变笉浼氬啀鎻愪緵榛樿鐨勬瀯閫犲嚱鏁颁簡锛屾墍浠ラ渶瑕佹墜鍔ㄥ疄鐜伴偅涓棤鍙傛瀯閫?/p>
private : 绉佹湁鎴愬憳, 鍦ㄧ被鐨勫唴閮ㄦ墠鍙互璁块棶銆?nbsp;
protected : 淇濇姢鎴愬憳锛岃绫诲唴閮ㄥ拰缁ф壙绫讳腑鍙互璁块棶銆?nbsp;
public : 鍏叡鎴愬憳锛屽畬鍏ㄥ叕寮€锛屾病鏈夎闂檺鍒躲€?nbsp;
internal: 鍦ㄥ悓涓€鍛藉悕绌洪棿鍐呭彲浠ヨ闂€?nbsp;
绛旓細瀹炰緥璇濆璞★紝闅愯棌鍩虹被鏂规硶銆?/p>
绗竴绉?new Class();
绛旓細public delegate void handels();//杩斿洖鍊兼槸void锛屾病鏈夊弬鏁?nbsp;
public event handels eventHandels;
his.eventHandels = new handels(fun);
public void fun()
{ }
绛旓細value锛屽畠鐨勭被鍨嬪拰灞炴€ф墍澹版槑鐨勭被鍨嬬浉鍚屻€?nbsp;
绛旓細string str = null 鏄笉缁欎粬鍒嗛厤鍐呭瓨绌洪棿,鑰宻tring str = "" 缁欏畠鍒嗛厤闀垮害涓虹┖瀛楃涓茬殑鍐呭瓨绌洪棿銆?nbsp;
绛旓細Windwos(榛樿) 鐢↖IS...From(绐椾綋) 鐢ㄥ笎鎴?...Passport(瀵嗛挜)
Session鏈変粈涔堥噸澶UG锛屽井杞彁鍑轰簡浠€涔堟柟娉曞姞浠ヨВ鍐筹紵
绛旓細鏄痠is涓敱浜庢湁杩涚▼鍥炴敹鏈哄埗锛岀郴缁熺箒蹇欑殑璇漇ession浼氫涪澶憋紝鍙互鐢⊿ate server鎴朣QL Server鏁版嵁搴撶殑鏂瑰紡瀛樺偍Session涓嶈繃杩欑鏂瑰紡姣旇緝鎱紝鑰屼笖鏃犳硶鎹曡幏Session鐨凟ND浜嬩欢
try..catch鍦ㄥ嚭鐜板紓甯哥殑鏃跺€欏奖鍝嶆€ц兘; 搴旇鎹曡幏鏇村叿浣撳緱寮傚父锛屾瘮濡侷OExeception,OutOfMemoryException绛?nbsp;
鍦‵ORM鎻愪氦鐨勬椂鍊欙紝濡傛灉涓嶆寚瀹歁ethod锛屽垯榛樿涓篏ET璇锋眰锛孎orm涓彁浜ょ殑鏁版嵁灏嗕細闄勫姞鍦╱rl涔嬪悗锛屼互?鍒嗗紑涓巙rl鍒嗗紑銆傚瓧姣嶆暟瀛楀瓧绗﹀師鏍峰彂閫侊紝浣嗙┖鏍艰浆鎹负“+“鍙凤紝鍏跺畠绗﹀彿杞崲涓?XX,鍏朵腑XX涓鸿绗﹀彿浠?6杩涘埗琛ㄧず鐨凙SCII锛堟垨ISO Latin-1锛夊€笺€侴ET璇锋眰璇锋彁浜ょ殑鏁版嵁鏀剧疆鍦℉TTP璇锋眰鍗忚澶翠腑锛岃€孭OST鎻愪氦鐨勬暟鎹垯鏀惧湪瀹炰綋鏁版嵁涓紱
<%# Eval("瀛楁鍚?) %>
<%# Bind("瀛楁鍚?) %>
1 Eval 鍗曞悜缁戝畾:鏁版嵁鏄彧璇荤殑
Bind 鍙屽悜缁戝畾:鏁版嵁鍙互鏇存敼,骞惰繑鍥炴湇鍔″櫒绔?鏈嶅姟鍣ㄥ彲浠ュ鐞嗘洿鏀瑰悗鐨勬暟鎹?濡傚瓨鍏ユ暟鎹簱.
2.褰撳娆¤〃杈惧紡鎿嶄綔鏃跺€欙紝蹇呴』鐢‥val 濡?lt;%# Eval("瀛楁鍚?).ToString().Trim() %>
3 缁戝畾鎺т欢鐨勫睘鎬ф椂瑕佺敤Bind锛岃€孍val鍒欐槸鍏跺畠涓€浜涖€?nbsp;
渚嬪锛?lt;asp:TextBox ID="First" RunAt="Server" Text=鈥?lt;%# Bind("FirstName") %>鈥?/>
渚嬪锛?lt;td><%# Eval("ProductID") %></td>
璇锋眰鐨勮繃绋?
1)娴忚鍣╝spx鏂囦欢璇锋眰--->鏈嶅姟鍣ㄦ墽琛?-->閬囧埌Response.Redirect璇彞->鏈嶅姟鍣ㄥ彂閫丷esponse.Redirect鍚庨潰鐨勫湴鍧€缁欏鎴锋満绔殑娴忚鍣?-->娴忚鍣ㄨ姹傛墽琛屾柊鐨勫湴鍧€
2)娴忚鍣╝spx鏂囦欢璇锋眰->鏈嶅姟鍣ㄦ墽琛?>閬囧埌Server.Transfer璇彞->鏈嶅姟鍣ㄨ浆鍚戞柊鐨勬枃浠?nbsp;
鍙互瑙丼erver.Transfer姣擱esponse.Redirect灏戜簡涓€娆℃湇鍔″櫒鍙戦€佸洖鏉ュ拰瀹㈡埛绔啀璇锋眰鐨勮繃绋?
璺宠浆瀵硅薄:
1)Response.Redirect鍙互鍒囨崲鍒颁换浣曞瓨鍦ㄧ殑缃戦〉銆?nbsp;
2)Server.Transfer鍙兘鍒囨崲鍒板悓鐩綍鎴栬€呭瓙鐩綍鐨勭綉椤?
鏁版嵁淇濆瘑:
1銆丷esponse.Redirect鍚庡湴鍧€浼氬彉鎴愯烦杞悗鐨勯〉闈㈠湴鍧€銆?nbsp;
2銆丼erver.Transfer鍚庡湴鍧€涓嶅彉锛岄殣钘忎簡鏂扮綉椤电殑鍦板潃鍙婇檮甯﹀湪鍦板潃鍚庤竟鐨勫弬鏁板€笺€傚叿鏈夋暟鎹繚瀵嗗姛鑳姐€?nbsp;
浼犻€掔殑鏁版嵁閲忥紙缃戝潃鍚庨檮甯︾殑鍙傛暟锛夛細
1銆丷esponse.Redirect鑳藉浼犻€掔殑鏁版嵁浠?KB(涔熷氨鏄湴鍧€鏍忎腑鍦板潃鐨勬渶澶х殑闀垮害)涓洪檺銆?nbsp;
2銆佷紶閫掔殑鏁版嵁瓒呰繃2KB鏃讹紝鍔″繀浣跨敤Server.Transfer銆?/p>
Server.UrlEncode鐨勭紪鐮佹柟寮忔槸鎸夌収鏈湴绋嬪簭璁剧疆鐨勭紪鐮佹柟寮忚繘琛岀紪鐮佺殑锛岃€孒ttpUtility.UrlEncode鏄粯璁ょ殑鎸夌収.net鐨剈tf-8鏍煎紡杩涜缂栫爜鐨勩€?/p>
涓€銆佺敤Static澹版槑鐨勬柟娉曞拰鍙橀噺锛屼笉闇€瑕佸疄渚嬪寲璇ョ被灏辫皟鐢紱
1 浣跨敤寮傛鏂瑰紡璋冪敤Web鏈嶅姟鍜岃繙绋嬪璞?/p>
if(strABC!=null && strABC!="")
{}
if(!strABC.IsNullOrEmpty)
{}
6 灏介噺浣跨敤瀛樺偍杩囩▼锛屽苟浼樺寲鏌ヨ璇彞
7 鍙鏁版嵁璁块棶鐢⊿qlDataReader锛屼笉瑕佷娇鐢―ataSet
绛?鍓嶈€呭彧绠′紶,涓嶇鏁版嵁鍒颁笉鍒?鏃犻』寤虹珛杩炴帴.鍚庤€呬繚璇佷紶杈撶殑鏁版嵁鍑嗙‘,椤昏杩炵粨.
杞彂灏辨槸鏈嶅姟绔殑璺宠浆A椤甸潰鎻愪氦鏁版嵁鍒癇椤甸潰,B椤甸潰杩涜澶勭悊鐒跺悗浠庢湇鍔$璺宠浆鍒板叾瀹冮〉闈?nbsp;
璺宠浆灏辨槸鎸囧鎴风鐨勮烦杞?/p>
绛旓細鍒╃敤SOAP(绠€鍗曞璞¤闂崗璁?鍦╤ttp涓婃墽琛岃繙绋嬫柟娉曠殑璋冪敤锛屼篃鍙互浣跨敤WSDL锛圵eb鏈嶅姟鎻忚堪璇█锛夋潵
绛旓細搴旂敤绋嬪簭鍩熷彲浠ョ悊瑙d负涓€绉嶈交閲忕骇杩涚▼銆傝捣鍒板畨鍏ㄧ殑浣滅敤銆傚崰鐢ㄨ祫婧愬皬銆?/p>
绛旓細CTS锛氶€氱敤璇█绯荤粺銆侰LS锛氶€氱敤璇█瑙勮寖銆侰LR锛氬叕鍏辫瑷€杩愯搴撱€?/p>
绛旓細unsafe锛氶潪鎵樼浠g爜銆備笉缁忚繃CLR杩愯銆?/p>
绛旓細RTTI锛氱被鍨嬭瘑鍒郴缁熴€?/p>
codebehind鏄寚浠g爜鍜岀敤鎴风晫闈㈠垎寮€
aspx and cs
绛旓細绋嬪簭闆嗐€傦紙涓棿璇█锛屾簮鏁版嵁锛岃祫婧愶紝瑁呴厤娓呭崟锛?/p>
绛旓細1.浣跨敤WSDL.exe鍛戒护琛屽伐鍏枫€?nbsp;
2.浣跨敤VS.NET涓殑Add Web Reference鑿滃崟閫夐」
绛旓細鏈嶅姟鍣ㄧ鍚戝鎴风鍙戦€佷竴涓繘绋嬬紪鍙凤紝涓€涓▼搴忓煙缂栧彿锛屼互纭畾瀵硅薄鐨勪綅缃€?/p>
绛旓細鍒╃敤鍙嶅皠锛岄厤缃皢瀵硅薄鍜屾暟鎹簱琛ㄦ槧灏?/p>
绛旓細WS涓昏鏄彲鍒╃敤HTTP锛岀┛閫忛槻鐏銆傝€孯emoting鍙互鍒╃敤TCP/IP锛屼簩杩涘埗浼犻€佹彁楂樻晥鐜囥€?/p>
绛旓細鏈夋椂涓轰簡浠庝竴涓嚱鏁颁腑杩斿洖澶氫釜鍊硷紝鎴戜滑闇€瑕佷娇鐢╫ut鍏抽敭瀛楋紝鎶婅緭鍑哄€艰祴缁欓€氳繃寮曠敤浼犻€掔粰鏂规硶鐨勫彉閲忥紙涔熷氨鏄弬鏁帮級銆備絾C#瑕佹眰鍙橀噺鍐嶈寮曠敤鐨勫墠蹇呴』鍒濆鍖栥€傚湪璋冪敤璇ユ柟娉曟椂锛岃繕闇€瑕佹坊鍔爋ut鍏抽敭瀛?/p>
绛旓細淇濆瓨閰嶇疆,绔欎笌绔欎箣闂寸殑浜ゆ祦,WEB SERVICE銆備互鍙婁笌鏁版嵁搴撶殑鏁版嵁浜や簰绛夊湴鏂归兘瑕佺敤瀹?
7.濡備綍鐞嗚В濮旀墭锛?nbsp;
绛旓細
鐩稿綋浜庡嚱鏁版寚閽?瀹氫箟浜嗗鎵樺氨鍙互鍦ㄤ笉璋冪敤鍘熸柟娉曞悕绉扮殑鎯呭喌涓嬭皟鐢ㄩ偅涓柟娉?
濮旀墭鍏锋湁浠ヤ笅鐗圭偣锛?nbsp;
濮旀墭绫讳技浜?C++ 鍑芥暟鎸囬拡锛屼絾瀹冩槸绫诲瀷瀹夊叏鐨勩€?nbsp;
濮旀墭鍏佽灏嗘柟娉曚綔涓哄弬鏁拌繘琛屼紶閫掋€?nbsp;
濮旀墭鍙敤浜庡畾涔夊洖璋冩柟娉曘€?nbsp;
濮旀墭鍙互閾炬帴鍦ㄤ竴璧凤紱渚嬪锛屽彲浠ュ涓€涓簨浠惰皟鐢ㄥ涓柟娉曘€?nbsp;
鏂规硶涓嶉渶瑕佷笌濮旀墭绛惧悕绮剧‘鍖归厤銆傛湁鍏虫洿澶氫俊鎭紝璇峰弬瑙佸崗鍙樺拰閫嗗彉銆?nbsp;
C# 2.0 鐗堝紩鍏ヤ簡鍖垮悕鏂规硶鐨勬蹇碉紝姝ょ被鏂规硶鍏佽灏嗕唬鐮佸潡浣滀负鍙傛暟浼犻€掞紝浠ヤ唬鏇垮崟鐙畾涔夌殑鏂规硶銆?/p>
namespace test
{
public delegate void OnDBOperate();
public class UserControlBase : System.Windows.Forms.UserControl
{
public event OnDBOperate OnNew;
privatevoidtoolBar_ButtonClick(objectsender,System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
if(e.Button.Equals(BtnNew))
{
//璇峰湪浠ヤ笅琛ラ綈浠g爜鐢ㄦ潵璋冪敤OnDBOperate濮旀墭绛惧悕鐨凮nNew浜嬩欢銆?nbsp;
}
}
}
绛旓細if( OnNew != null )
OnNew( this, e );
string strTmp = "abcdefg鏌愭煇鏌?;
int i= System.Text.Encoding.Default.GetBytes(strTmp).Length;
int j= strTmp.Length;
浠ヤ笂浠g爜鎵ц瀹屽悗锛宨= j=
绛旓細i=13,j=10
绛旓細Select ID FROM table1 Where LastUpdateDate = (Select MAX(LastUpdateDate) FROM table1)
public void test(int i)
{
lock(this)
{
if (i>10)
{
i--;
test(i);
}
}
}
绛旓細涓嶄細鍙戠敓姝婚攣锛岋紙浣嗘湁涓€鐐筰nt鏄寜鍊间紶閫掔殑锛屾墍浠ユ瘡娆℃敼鍙樼殑閮藉彧鏄竴涓壇鏈紝鍥犳涓嶄細鍑虹幇姝婚攣銆備絾濡傛灉
public class Name
{
public string FirstName;
public string LastName;
}
public class Person:ICloneable
{
public Name PersonName;
public string Email;
/**//// <summary>
/// Deep Copy鐨勪緥瀛?nbsp;
/// </summary>
/// <returns></returns>
public Object Clone()
{
Person p = new Person();
p.Email = this.Email;
p.PersonName = new Name();
p.PersonName.FirstName = this.PersonName.FirstName;
p.PersonName.LastName = this.PersonName.LastName;
return p;
}
{
this.PersonName.LastName = lastName;
}
public static void Main()
{
Person p = new Person();
p.PersonName = new Name();
p.PersonName.LastName = "jill";
p.PersonName.FirstName = "zhang";
p.Email = "jillzhang@126.com";
Person sameNamePerson = p.Clone() as Person;
sameNamePerson.ChangLastName("clr_");
Console.WriteLine(p.PersonName.LastName);
Console.WriteLine(sameNamePerson.PersonName.LastName);
samePerson.ChangLastName("Shadow");
Console.WriteLine(sameNamePerson.PersonName.LastName);
Console.Read();
}
}
[AttributeUsage(AttributeTargets.Parameter)]
public class ParameterAtt : Attribute
{
public int Min = 100;
}
{
public void TestMethod([ParameterAtt(Min = 100)] int par1)
{
ParameterInfo para = MethodInfo.GetCurrentMethod().GetParameters()[0];
ParameterAtt att = ParameterAtt.GetCustomAttribute(para, typeof(ParameterAtt)) as
if (att.Min > par1)
{
throw new Exception("瑕佹眰para1鏈€灏忎负" + att.Min);
}
}
}
绛旓細鎺т欢鐨凙ttributes
涓€涓鏈夌▼搴忛泦閫氬父涓哄崟涓簲鐢ㄧ▼搴忔墍浣跨敤锛屽苟涓斿瓨鍌ㄤ簬杩欎釜搴旂敤绋嬪簭鎵€鍦ㄧ殑鐩綍涔嬩腑锛屾垨姝ょ洰褰曚笅闈㈢殑涓€涓瓙
Aps.net 涓湁闈炵┖楠岃瘉锛屾瘮杈冮獙璇侊紝鍙栧€艰寖鍥撮獙璇侊紝姝e垯琛ㄨ揪寮忛獙璇佸強瀹㈡埛鑷畾涔夐獙璇佷簲澶ф帶浠讹紝鍙﹁繕鏈変竴涓泦
鍦╳eb鎺т欢鍙戠敓浜嬩欢鏃讹紝瀹㈡埛绔噰鐢ㄦ彁浜ょ殑褰㈠紡灏嗘暟鎹氦鍥炴湇鍔$锛屾湇鍔$鍏堣皟鐢≒age_Load浜嬩欢,鐒跺悗鏍规嵁浼?/p>
鍙湁閫氳繃鑷姩浼犲洖鎵嶈兘瀹炵幇鏈嶅姟绔簨浠剁殑鏈哄埗锛屽鏋滄病鏈夎嚜鍔ㄥ洖浼犳満鍒跺氨鍙兘璋冪敤瀹㈡埛绔簨浠讹紝鑰屼笉鑳借皟鐢ㄦ湇鍔?/p>
appSettings鍖呭惈鑷畾涔夊簲鐢ㄧ▼搴忚缃€?nbsp;
system.web 绯荤粺閰嶇疆
compilation鍔ㄦ€佽皟璇曠紪璇戣缃?nbsp;
customErrors鑷畾涔夐敊璇俊鎭缃?nbsp;
authentication韬唤楠岃瘉,姝よ妭璁剧疆搴旂敤绋嬪簭鐨勮韩浠介獙璇佺瓥鐣ャ€?nbsp;
authorization鎺堟潈, 姝よ妭璁剧疆搴旂敤绋嬪簭鐨勬巿鏉冪瓥鐣?
涓€涓狝SP.NET椤甸潰涓€鑸兘瀵瑰簲涓€涓殣钘忕被,涓€鑸兘鍦ˋSP.NET椤甸潰鐨勫0鏄庝腑鎸囧畾浜嗛殣钘忕被渚嬪涓€涓〉闈st1.aspx
<%@ Page language="c#" Codebehind="Tst1.aspx.cs" AutoEventWireup="false" Inherits="T1.Tst1" %>
Codebehind="Tst1.aspx.cs" 琛ㄦ槑缁忕紪璇戞椤甸潰鏃朵娇鐢ㄥ摢涓€涓唬鐮佹枃浠?nbsp;
Inherits="T1.Tst1" 琛ㄧ敤杩愯鏃朵娇鐢ㄥ摢涓€涓殣钘忕被
Viewstate鏄繚瀛樼姸鎬佺殑涓€绉嶆満鍒讹紝EnableViewState灞炴€ц缃负false鍗冲彲绂佺敤
寰堟湁鍙兘鏄湪Page_Load涓暟鎹鐞嗘椂娌℃湁杩涜Page鐨処sPostBack灞炴€у垽鏂?/p>
涓婁笅鏂囧璞℃槸鎸嘓ttpContext绫荤殑Current 灞炴€э紝褰撴垜浠湪涓€涓櫘閫氱被涓璁块棶鍐呯疆瀵?/p>
绛旓細Ajax鐨勬牳蹇冩槸JavaScript瀵硅薄XmlHttpRequest锛屽畠浣挎偍鍙互浣跨敤JavaScript鍚戞湇鍔″櫒鎻愬嚭璇锋眰骞跺鐞嗗搷搴旓紝 鑰屼笉闃诲鐢ㄦ埛锛屽紓姝ヨ姹傘€?/p>
灞炴€?绱㈠紩鍣?nbsp;
閫氳繃鍚嶇О鏍囪瘑銆?閫氳繃绛惧悕鏍囪瘑銆?nbsp;
閫氳繃绠€鍗曞悕绉版垨鎴愬憳璁块棶鏉ヨ闂€?閫氳繃鍏冪礌璁块棶鏉ヨ闂€?nbsp;
鍙互涓洪潤鎬佹垚鍛樻垨瀹炰緥鎴愬憳銆?蹇呴』涓哄疄渚嬫垚鍛樸€?nbsp;
灞炴€х殑 get 璁块棶鍣ㄦ病鏈夊弬鏁般€?绱㈠紩鍣ㄧ殑 get 璁块棶鍣ㄥ叿鏈変笌绱㈠紩鍣ㄧ浉鍚岀殑褰㈠弬琛ㄣ€?nbsp;
灞炴€х殑 set 璁块棶鍣ㄥ寘鍚殣寮?nbsp; value 鍙傛暟銆?闄や簡 value 鍙傛暟澶栵紝绱㈠紩鍣ㄧ殑 set 璁块棶鍣ㄨ繕鍏锋湁涓庣储寮?/p>
绛旓細榛戠洅娴嬭瘯锛氬凡鐭ヤ骇鍝佺殑鍔熻兘璁捐瑙勬牸锛屽彲浠ヨ繘琛屾祴璇曡瘉鏄庢瘡涓疄鐜颁簡鐨勫姛鑳芥槸鍚︾鍚堣姹傘€?/p>
1銆佸湪搴旂敤绋嬪簭鍜岃繙绋嬭澶囦腑浣跨敤鍗忚鍜岀綉缁滃湴鍧€鍒濆鍖栧鎺ュ瓧
2銆佸湪搴旂敤绋嬪簭涓€氳繃鎸囧畾绔彛鍜屽湴鍧€寤虹珛鐩戝惉
3銆佽繙绋嬭澶囧彂鍑鸿繛鎺ヨ姹?nbsp;
4銆佸簲鐢ㄧ▼搴忔帴鍙楄繛鎺ヤ骇鐢熼€氫俊scoket
5銆佸簲鐢ㄧ▼搴忓拰杩滅▼璁惧寮€濮嬮€氳锛堝湪閫氳涓簲鐢ㄧ▼搴忓皢鎸傝捣鐩村埌閫氳缁撴潫锛?nbsp;
6銆侀€氳缁撴潫锛屽叧闂簲鐢ㄧ▼搴忓拰杩滅▼璁惧鐨凷ocket鍥炴敹璧勬簮
绗竷灞傦細搴旂敤灞?nbsp;
瀹氫箟浜嗙敤浜庡湪缃戠粶涓繘琛岄€氫俊鍜屾暟鎹紶杈撶殑鎺ュ彛 - 鐢ㄦ埛绋嬪紡锛?nbsp;
鎻愪緵鏍囧噯鏈嶅姟锛屾瘮濡傝櫄鎷熺粓绔€佹枃浠朵互鍙婁换鍔$殑浼犺緭鍜屽鐞嗭紱
绗叚灞傦細琛ㄧず灞?nbsp;
鎺╃洊涓嶅悓绯荤粺闂寸殑鏁版嵁鏍煎紡鐨勪笉鍚屾€э紱
鎸囧畾鐙珛缁撴瀯鐨勬暟鎹紶杈撴牸寮忥紱
鏁版嵁鐨勭紪鐮佸拰瑙g爜锛涘姞瀵嗗拰瑙e瘑锛涘帇缂╁拰瑙e帇缂?nbsp;
绗簲灞傦細浼氳瘽灞?nbsp;
绠$悊鐢ㄦ埛浼氳瘽鍜屽璇濓紱
鎺у埗鐢ㄦ埛闂撮€昏緫杩炴帴鐨勫缓绔嬪拰鎸傛柇锛?nbsp;
鎶ュ憡涓婁竴灞傚彂鐢熺殑閿欒
绗洓灞傦細浼犺緭灞?nbsp;
绠$悊缃戠粶涓鍒扮鐨勪俊鎭紶閫侊紱
閫氳繃閿欒绾犳鍜屾祦鎺у埗鏈哄埗鎻愪緵鍙潬涓旀湁搴忕殑鏁版嵁鍖呬紶閫侊紱
鎻愪緵闈㈠悜鏃犺繛鎺ョ殑鏁版嵁鍖呯殑浼犻€侊紱
绗笁灞傦細缃戠粶灞?nbsp;
瀹氫箟缃戠粶璁惧闂村浣曚紶杈撴暟鎹紱
鏍规嵁鍞竴鐨勭綉缁滆澶囧湴鍧€璺敱鏁版嵁鍖咃紱
鎻愪緵娴佸拰鎷ュ鎺у埗浠ラ槻姝㈢綉缁滆祫婧愮殑鎹熻€?nbsp;
绗簩灞傦細鏁版嵁閾捐矾灞?nbsp;
瀹氫箟鎿嶄綔閫氫俊杩炴帴鐨勭▼搴忥紱
灏佽鏁版嵁鍖呬负鏁版嵁甯э紱
鐩戞祴鍜岀籂姝f暟鎹寘浼犺緭閿欒
绗竴灞傦細鐗╃悊灞?nbsp;
瀹氫箟閫氳繃缃戠粶璁惧鍙戦€佹暟鎹殑鐗╃悊鏂瑰紡锛?nbsp;
浣滀负缃戠粶濯掍粙鍜岃澶囬棿鐨勬帴鍙o紱
瀹氫箟鍏夊銆佺數姘斾互鍙婃満姊扮壒鎬с€?/p>
绛旓細鐢ㄥ垎椤靛瓨鍌ㄨ繃绋?nbsp;
/*
鍑芥暟鍚嶇О: GetRecordFromPage
鍑芥暟鍔熻兘: 鑾峰彇鎸囧畾椤电殑鏁版嵁
鍙傛暟璇存槑: @tblName 鍖呭惈鏁版嵁鐨勮〃鍚?nbsp;
@fldName 鍏抽敭瀛楁鍚?nbsp;
@PageSize 姣忛〉璁板綍鏁?nbsp;
@PageIndex 瑕佽幏鍙栫殑椤电爜
@OrderType 鎺掑簭绫诲瀷, 0 - 鍗囧簭, 1 - 闄嶅簭
@strWhere 鏌ヨ鏉′欢 (娉ㄦ剰: 涓嶈鍔?nbsp;
where
)
*/
CREATE
PROCEDURE
GetRecordFromPage
@tblName
varchar
(255),
-- 琛ㄥ悕
@fldName
varchar
(255),
-- 瀛楁鍚?nbsp;
@PageSize
int
= 10,
-- 椤靛昂瀵?nbsp;
@PageIndex
int
= 1,
-- 椤电爜
@OrderType
bit
= 0,
-- 璁剧疆鎺掑簭绫诲瀷, 闈?nbsp;0 鍊煎垯闄嶅簭
@strWhere
varchar
(2000) =
鈥樷€?/code>
-- 鏌ヨ鏉′欢 (娉ㄦ剰: 涓嶈鍔?nbsp;where)
AS
declare
@strSQL
varchar
(6000)
-- 涓昏鍙?nbsp;
declare
@strTmp
varchar
(1000)
-- 涓存椂鍙橀噺
declare
@strOrder
varchar
(500)
-- 鎺掑簭绫诲瀷
if @OrderType != 0
begin
set
@strTmp =
鈥?lt;(select min鈥?/code>
set
@strOrder =
鈥?nbsp;order by [鈥?/code>
+ @fldName +
鈥榏 desc鈥?/code>
end
else
begin
set
@strTmp =
鈥?gt;(select max鈥?/code>
set
@strOrder =
鈥?nbsp;order by [鈥?/code>
+ @fldName +
鈥榏 asc鈥?/code>
end
set
@strSQL =
鈥榮elect top 鈥?/code>
+ str(@PageSize) +
鈥?nbsp;* from [鈥?/code>
+ @tblName +
鈥榏 where [鈥?/code>
+ @fldName +
鈥榏鈥?/code>
+ @strTmp +
鈥?[鈥?/code>
+ @fldName +
鈥榏) from (select top 鈥?/code>
+ str((@PageIndex-1)*@PageSize) +
鈥?nbsp;[鈥?/code>
+ @fldName +
鈥榏 from [鈥?/code>
+ @tblName +
鈥榏鈥?/code>
+ @strOrder +
鈥? as tblTmp)鈥?/code>
+ @strOrder
if @strWhere !=
鈥樷€?/code>
set
@strSQL =
鈥榮elect top 鈥?/code>
+ str(@PageSize) +
鈥?nbsp;* from [鈥?/code>
+ @tblName +
鈥榏 where [鈥?/code>
+ @fldName +
鈥榏鈥?/code>
+ @strTmp +
鈥?[鈥?/code>
+ @fldName +
鈥榏) from (select top 鈥?/code>
+ str((@PageIndex-1)*@PageSize) +
鈥?nbsp;[鈥?/code>
+ @fldName +
鈥榏 from [鈥?/code>
+ @tblName +
鈥榏 where 鈥?/code>
+ @strWhere +
鈥?nbsp;鈥?/code>
+ @strOrder +
鈥? as tblTmp) and 鈥?/code>
+ @strWhere +
鈥?nbsp;鈥?/code>
+ @strOrder
if @PageIndex = 1
begin
set
@strTmp =
鈥樷€?/code>
if @strWhere !=
鈥樷€?/code>
set
@strTmp =
鈥?nbsp;where (鈥?/code>
+ @strWhere +
鈥?鈥?/code>
set
@strSQL =
鈥榮elect top 鈥?/code>
+ str(@PageSize) +
鈥?nbsp;* from [鈥?/code>
+ @tblName +
鈥榏鈥?/code>
+ @strTmp +
鈥?nbsp;鈥?/code>
+ @strOrder
end
exec
(@strSQL)
GO
1銆佸鎬佹€э紝澶氱鏁版嵁搴撳吋瀹癸紱
2銆佹敮鎸佺炕椤碉紝鏀寔鏌ヨ鎬绘暟锛岄〉鐮佹樉绀猴紱
3銆佽兘澶勭悊100涓囦互涓婃暟鎹噺锛?nbsp;
绛旓細
CREATE PROCEDURE dbo.LSP_SP_SelectElementByPage
@SelectFields varchar(200),/*瑕佹煡璇㈢殑瀛楁鍒楄〃*/
@Condition varchar(300),/*鏌ヨ鏉′欢*/
@PageSize int =20,/*椤甸潰澶у皬锛岄粯璁や负20*/
@PageNumber int =1/*椤靛彿锛岄粯璁や负绗竴椤?/
/*@PageCount int out杩斿洖婊¤冻鏉′欢鐨勬€婚〉鏁?/
AS
begin
declare @count int
select @count =count(*) from lsp_t_elementInfo
if(@count %@PageSize=0)
set @count = @count/@PageSize
else
set @count = @count/@PageSize +1
select @count PageCount
select IDENTITY(int,1,1) as iid,ElementName,Type into #temptable from LSP_T_ElementInfo
select * from #temptable where iid between @PageSize * (@PageNumber -1) and @PageSize * @PageNumber
end
GO
绛旓細select * from a,b where a.瀛楁1 锛?b.瀛楁1 order by a.瀛楁2 asc,b.瀛楁2 desc
2.鏍规嵁绗竴棰橈紝姣忛〉闈㈡樉绀?0鏉¤褰曪紝鍦ㄧ25椤垫椂鎬庢牱鏄剧ず
绛旓細
/*
鍑芥暟鍚嶇О: GetRecordFromPage
鍑芥暟鍔熻兘: 鑾峰彇鎸囧畾椤电殑鏁版嵁
鍙傛暟璇存槑: @tblName 鍖呭惈鏁版嵁鐨勮〃鍚?nbsp;
@fldName 鍏抽敭瀛楁鍚?nbsp;
@PageSize 姣忛〉璁板綍鏁?nbsp;
@PageIndex 瑕佽幏鍙栫殑椤电爜
@OrderType 鎺掑簭绫诲瀷, 0 - 鍗囧簭, 1 - 闄嶅簭
@strWhere 鏌ヨ鏉′欢 (娉ㄦ剰: 涓嶈鍔?where)
*/
CREATE PROCEDURE GetRecordFromPage
@tblName varchar(255), -- 琛ㄥ悕
@fldName varchar(255), -- 瀛楁鍚?nbsp;
@PageSize int = 10, -- 椤靛昂瀵?nbsp;
@PageIndex int = 1, -- 椤电爜
@OrderType bit = 0, -- 璁剧疆鎺掑簭绫诲瀷, 闈?0 鍊煎垯闄嶅簭
@strWhere varchar(2000) = 鈥樷€?nbsp; -- 鏌ヨ鏉′欢 (娉ㄦ剰: 涓嶈鍔?where)
AS
declare @strTmp varchar(1000) -- 涓存椂鍙橀噺
declare @strOrder varchar(500) -- 鎺掑簭绫诲瀷
begin
set @strTmp = 鈥?lt;(select min鈥?nbsp;
set @strOrder = 鈥?order by [鈥?+ @fldName + 鈥榏 desc鈥?nbsp;
end
else
begin
set @strTmp = 鈥?gt;(select max鈥?nbsp;
set @strOrder = 鈥?order by [鈥?+ @fldName +鈥榏 asc鈥?nbsp;
end
+ @tblName + 鈥榏 where [鈥?+ @fldName + 鈥榏鈥?+ @strTmp + 鈥?[鈥?nbsp;
+ @fldName + 鈥榏) from (select top 鈥?+ str((@PageIndex-1)*@PageSize) + 鈥?[鈥?nbsp;
+ @fldName + 鈥榏 from [鈥?+ @tblName + 鈥榏鈥?+ @strOrder + 鈥? as tblTmp)鈥?nbsp;
+ @strOrder
set @strSQL = 鈥榮elect top 鈥?+ str(@PageSize) + 鈥?* from [鈥?nbsp;
+ @tblName + 鈥榏 where [鈥?+ @fldName + 鈥榏鈥?+ @strTmp + 鈥?[鈥?nbsp;
+ @fldName + 鈥榏) from (select top 鈥?+ str((@PageIndex-1)*@PageSize) + 鈥?[鈥?nbsp;
+ @fldName + 鈥榏 from [鈥?+ @tblName + 鈥榏 where 鈥?+ @strWhere + 鈥?鈥?nbsp;
+ @strOrder + 鈥? as tblTmp) and 鈥?+ @strWhere + 鈥?鈥?+ @strOrder
begin
set @strTmp = 鈥樷€?nbsp;
if @strWhere != 鈥樷€?nbsp;
set @strTmp = 鈥?where (鈥?+ @strWhere + 鈥?鈥?/p>
+ @tblName + 鈥榏鈥?+ @strTmp + 鈥?鈥?+ @strOrder
end
select top 10 * from A where id not in (select top 30 id from A)
瑙?: select top 10 * from A where id > (select max(id) from (select top 30 id from A )as A)
锛堢涓€涓瀯閫犲嚱鏁拌皟鐢ㄤ簡绗簩涓瀯閫犲嚱鏁帮紝杩欎釜鏋勯€犲嚱鏁版瀯閫犱簡涓€涓猚瀵硅薄鐨勫疄渚嬨€傦級
绛旓細
using System.Text;
StringBuilder sb = new StringBuilder(0, 10000);
string strABC = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z";
string[] ABC = strABC.Split(鈥?鈥?;
int len = ABC.Length;
Random rd = new Random();
for (int i = 0; i < 10000; i++)
{
sb.Append(ABC[rd.Next(len)]);
}
int[] intArr=new int[100];
ArrayList myList=new ArrayList();
Random rnd=new Random();
while(myList.Count<100)
{
int num=rnd.Next(1,101);
if(!myList.Contains(num))
myList.Add(num);
}
for(int i=0;i<100;i++)
intArr[i]=(int)myList[i];
绛旓細
foreach( object o in array )arrayList.Add(o);
绛旓細private int min;
public void xuanZhe(int[] list)//閫夋嫨鎺掑簭
{
for (int i = 0; i < list.Length - 1; i++)
{
min = i;
{
if (list[j] < list[min])
}
绛旓細public int returnSum(int n)
{
int sum = 0;
for (int i = 1; i <= n; i++)
{
int k = i;
if (i % 2 == 0)
{
k = -k;
}
sum = sum + k;
}
return sum;
}
{
int k = n;
if (n == 0)
{
return 0;
}
if (n % 2 == 0)
{
k = -k;
}
return aaa(n - 1) + k;
}
锛?锛?瀵嗙爜鍗曡瘝鐨勬渶灏忛暱搴︽槸涓や釜瀛楁瘝锛屽彲浠ョ浉鍚岋紝涔熷彲浠ヤ笉鍚?nbsp;
锛?锛?K涓嶅彲鑳芥槸鍗曡瘝鐨勭涓€涓瓧姣?nbsp;
锛?锛?濡傛灉L鍑虹幇锛屽垯鍑虹幇娆℃暟涓嶆涓€娆?nbsp;
锛?锛?M涓嶈兘浣挎渶鍚庝竴涓篃涓嶈兘鏄€掓暟绗簩涓瓧姣?nbsp;
锛?锛?K鍑虹幇锛屽垯N灏变竴瀹氬嚭鐜?nbsp;
锛?锛?O濡傛灉鏄渶鍚庝竴涓瓧姣嶏紝鍒橪涓€瀹氬嚭鐜?nbsp;
闂涓€锛氫笅鍒楀摢涓€涓瓧姣嶅彲浠ユ斁鍦↙O涓殑O鍚庨潰锛屽舰鎴愪竴涓?涓瓧姣嶇殑瀵嗙爜鍗曡瘝锛?nbsp;
A) K B)L C) M D) N
绛旀:B
闂浜岋細濡傛灉鑳藉緱鍒扮殑瀛楁瘝鏄疜銆丩銆丮锛岄偅涔堣兘澶熷舰鎴愮殑涓や釜瀛楁瘝闀跨殑瀵嗙爜鍗曡瘝鐨勬€绘暟鏄灏戯紵
A)1涓?B)3涓?C)6涓?D锛?涓?nbsp;
绛旀:A
闂涓夛細涓嬪垪鍝竴涓槸鍗曡瘝瀵嗙爜锛?nbsp;
A) KLLN B) LOML C) MLLO D)NMKO
绛旀:C
绛旀:62绉诲姩鎴?鐨?娆℃柟
绛旓細
XML.prototype.xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
XML.prototype.InitXML=InitXML;
XML.prototype.getFirstChild=getFirstChild;
XML.prototype.getLastChild=getLastChild;
XML.prototype.getChild=getChild; // 鍙栧緱鑺傜偣鍊?nbsp;
XML.prototype.getNodeslength=getNodeslength; // 鏈€寰楄妭鐐逛笅鐨勫瓙鑺傜偣鐨勪釜鏁?nbsp;
XML.prototype.getNode=getNode; // 鍙栧緱鎸囧畾鑺傜偣
XML.prototype.delNode=delNode; // 鍒犻櫎鎸囧畾鑺傜偣,濡傛灉鑺傜偣鐩稿悓,鍒欏垹闄ゆ渶鍓嶉潰鐨勮妭鐐?
XML.prototype.getNodeAttrib=getNodeAttrib; // 鍙栧緱鑺傜偣鐨勬寚瀹氬睘鎬у€?
XML.prototype.InsertBeforeChild=InsertBeforeChild; // 鍦ㄦ寚瀹氳妭鐐逛箣鍓嶆彃鍏ヤ竴涓妭鐐?
XML.prototype.InsertChild=InsertChild; // 鍦ㄦ寚瀹氳妭鐐逛笅鎻掑叆鑺傜偣.
XML.prototype.setAttrib=setAttrib; // 璁剧疆鎸囧畾灞炴€х殑鍊?
XML.prototype.setNodeValue=setNodeValue; // 璁剧疆鎸囧畾鑺傜偣鐨勫€?
XML.prototype.CreateNodeS=CreateNodeS; // 鍒涘缓涓€涓寚瀹氬悕鐨勮妭鐐癸紟
XML.prototype.addAttrib=addAttrib; // 涓烘寚瀹氳妭鐐规坊鍔犳寚瀹氬睘鎬э紝骞惰缃垵鍊?
XML.prototype.FindString=FindString; // 鍦ㄦ寚瀹氳妭鐐逛笅鏌ユ壘瀛楃涓?
< DriverC >
<Dir DirName=”MSDOS622”>
<File FileName =” Command.com” ></File>
</Dir>
<File FileName =”MSDOS.SYS” ></File>
<File FileName =” IO.SYS” ></File>
</DriverC>
</FileSystem>
璇风敾鍑洪亶鍘嗘墍鏈夋枃浠跺悕锛團ileName锛夌殑娴佺▼鍥?璇蜂娇鐢ㄩ€掑綊绠楁硶)銆?nbsp;
绛旓細
void FindFile( Directory d )
{
FileOrFolders = d.GetFileOrFolders();
foreach( FileOrFolder fof in FileOrFolders )
{
if( fof is File )
You Found a file;
else if ( fof is Directory )
FindFile( fof );
}
}
以上是关于H5绔己鍒舵í灞忓悗锛屼笉鑳芥粴鍔ㄦ祻瑙堜互鍙妉i鏍囩瀹藉害涓嶈兘鎾戞弧锛屼袱涓棶棰樼殑瑙e喅鏂规硶的主要内容,如果未能解决你的问题,请参考以下文章