锘??xml version="1.0" encoding="utf-8" standalone="yes"?>99视频日韩,亚洲一区二区三区在线,亚洲一区国产精品http://www.shnenglu.com/fenglin/category/17074.html鍒涙柊銆佸垱鎰忋佹寫鎴?/description>zh-cnWed, 13 Jul 2011 03:23:20 GMTWed, 13 Jul 2011 03:23:20 GMT60淇濇姢緗戠珯瀹夊叏騫朵嬌鐢╓eb紿椾綋璁塊棶鏁版嵁http://www.shnenglu.com/fenglin/articles/150750.html椋庢灄椋庢灄Tue, 12 Jul 2011 05:27:00 GMThttp://www.shnenglu.com/fenglin/articles/150750.htmlhttp://www.shnenglu.com/fenglin/comments/150750.htmlhttp://www.shnenglu.com/fenglin/articles/150750.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/150750.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/150750.html1銆佸垱寤虹櫥褰昗eb紿椾綋
鏂板緩涓涓猈eb紿椾綋錛屽湪鍏朵腑娣誨姞鐢ㄤ簬鐢ㄦ埛韜喚楠岃瘉鐨凩ogin鎺т歡

2銆佷負ASP.NET緗戠珯閰嶇疆瀹夊叏鐗規(guī)?br />浣跨敤“ASP.NET緗戠珯綆$悊宸ュ叿”娣誨姞鍜岀淮鎶ょ敤鎴楓佸畾涔夎鑹插拰鍒涘緩璁塊棶瑙勫垯錛堥夋嫨“緗戠珯”|“ASP.NET閰嶇疆”鏉ュ惎鍔ㄨ宸ュ叿錛?br />娉ㄦ剰錛氬湪緗戠珯璺緞涓笉鑳藉瓨鍦?瀛楃錛屽惁鍒欏湪鍚姩ASP.NET閰嶇疆綆$悊宸ュ叿鏃朵細澶辮觸銆?/u>


3銆佸疄鐜板熀浜庣獥浣撶殑瀹夊叏鎬?br />緙栬緫Web.config鏂囦歡錛屽皢<authentication mode>灞炴ц涓?Forms"錛屾寚瀹氱櫥褰曠獥浣撶殑URL,騫舵寚瀹氭墍闇鐨勪換浣曡韓浠介獙璇佸弬鏁般傚錛?
1        <authentication mode="Forms">
2            <forms loginUrl="LoginForm.aspx" timeout="5" cookieless="AutoDetect" protection="All"/>
3        </authentication>

4銆佸垱寤轟竴涓猈eb紿椾綋鏉ユ樉紺烘暟鎹簱鏁版嵁
鍚慦eb紿椾綋娣誨姞涓涓暟鎹簮鎺т歡錛屽茍閰嶇疆瀹冩潵榪炴帴鎭板綋鐨勬暟鎹簱錛涘悜Web紿椾綋娣誨姞涓涓狦ridView鎺т歡錛屽皢鍏禗ataSourceId灞炴ц緗負鏁版嵁婧愭帶浠?br />
5銆佽幏鍙栨暟鎹紝騫跺湪Web紿椾綋涓互渚夸簬綆$悊鐨勫艦寮忓垎鎵規(guī)樉紺烘暟鎹?br />灝咷ridView鎺т歡鐨凙llowPaging灞炴ц緗負True銆傚皢PagerSize灞炴ц緗負姣忛〉鍏佽鏄劇ず鐨勮鏁般備慨鏀筆agerSettings鍜孭agerStyle灞炴э紝浣垮叾涓嶹eb紿椾綋鐨勬牱寮忓尮閰?br />
6銆佺敤GridView鎺т歡淇敼鏁版嵁搴撲腑鐨勮
紜畾鏁版嵁婧愬厑璁告洿鏂版暟鎹紱鍦?#8220;GridView浠誨姟”鏅鴻兘鏍囪鑿滃崟涓夋嫨“鍚敤鏇存柊”

7銆侀夋嫨GridView鎺т歡涓殑涓琛岋紝浠庝竴涓猈eb紿椾綋瀵艱埅鑷沖彟涓涓猈eb紿椾綋
灝嗘煇鍒楀畾涔夋垚HyperLinkField鎺т歡銆傚湪DataNavigateUrlFormatString灞炴т腑錛屾寚瀹氱洰鏍囩獥浣撶殑URL鍜屽彲閫夌殑鏌ヨ瀛楃涓詫紝騫跺湪DataNavigateUrlFields灞炴т腑鎸囧畾瑕佷綔涓烘煡璇㈠瓧絎︿覆鍙傛暟浼犵粰紿椾綋鐨勪換浣曟暟鎹紱鍦ㄧ洰鏍囩獥浣撲腑錛岄氳繃璁塊棶Web紿椾綋鐨凴equest灞炴х殑QueryString闆嗗悎鏉ヨ幏鍙栦換浣曟煡璇㈠瓧絎︿覆鍙傛暟

8銆佸湪榪愯鏃訛紝灝咷ridView鎺т歡緇戝畾鍒頒竴涓暟鎹簮
灝咷ridView鎺т歡鐨凞ataSource灞炴ц緗負鏁版嵁婧愩傚皢GridView鐨勪換浣旴oundField鍒楃殑DataField灞炴ц緗負鏁版嵁婧愪腑瀹圭撼鐫瑕佹樉紺虹殑鏁版嵁鐨勫睘鎬х殑鍚嶇О錛堜互瀛楃涓茬殑褰㈠紡鎸囧畾錛?br />濡傦細
 1public partial class OrderHistory : System.Web.UI.Page
 2{
 3    protected void Page_Load(object sender, EventArgs e)
 4    {
 5        string customerID = Request.QueryString["CustomerID"];
 6        this.OrderLabel.Text += " " + customerID;
 7        this.Title += " " + customerID;
 8
 9        OrderHistoryDataContext context = new OrderHistoryDataContext();
10        var orderDetails = context.CustOrderHist(customerID);
11        this.OrderGrid.DataSource = orderDetails;
12
13        BoundField productName = this.OrderGrid.Columns[0as BoundField;
14        productName.DataField = "ProductName";
15        BoundField total = this.OrderGrid.Columns[1as BoundField;
16        total.DataField = "Total";
17        this.OrderGrid.DataBind();
18
19    }

20}




椋庢灄 2011-07-12 13:27 鍙戣〃璇勮
]]>
鐢ㄦ埛杈撳叆鏍¢獙http://www.shnenglu.com/fenglin/articles/149935.html椋庢灄椋庢灄Fri, 01 Jul 2011 11:33:00 GMThttp://www.shnenglu.com/fenglin/articles/149935.htmlhttp://www.shnenglu.com/fenglin/comments/149935.htmlhttp://www.shnenglu.com/fenglin/articles/149935.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/149935.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/149935.html1銆佹墽琛屾湇鍔″櫒绔殑鐢ㄦ埛杈撳叆鏍¢獙
鍒╃敤Server鎺т歡鐨勪簨浠訛紝渚嬪TextBox鎺т歡鐨凾extChanged浜嬩歡

2銆佹墽琛屽鎴風鐨勭敤鎴瘋緭鍏ユ牎楠?br />浣跨敤鏍¢獙鎺т歡銆傚皢ControlToValidate灞炴ц涓鴻鏍¢獙鐨勬帶浠訛紝灝咵rrorMessage灞炴ц涓鴻鏄劇ず鐨勯敊璇秷鎭傞獙璇丒nableClientScript灞炴у凡璁句負True

3銆佽姹傜敤鎴峰繀欏誨湪鏂囨湰妗嗗唴杈撳叆鍊?/strong>
浣跨敤RequiredFieldValidator鎺т歡

4銆佹鏌ュ湪鏂囨湰妗嗕腑杈撳叆鐨勬暟鎹殑綾誨瀷鍜岃寖鍥?/strong>
浣跨敤RangeValidatotr鎺т歡銆傛牴鎹渶瑕佽緗甌ype錛孧aximumValue鍜孧inimumValue灞炴?br />
5銆佹樉紺烘牎楠岄敊璇秷鎭眹鎬?/strong>
浣跨敤ValidationSummary鎺т歡銆傜‘瀹歋howSummary灞炴у凡璁句負True銆傚鏋滃笇鏈涙敮鎸佸姩鎬丠TML鐨勬祻瑙堝櫒鍦ㄦ秷鎭涓樉紺洪敊璇秷鎭紝灝哠howMessageBox璁句負True

椋庢灄 2011-07-01 19:33 鍙戣〃璇勮
]]>
ASP.NET寮鍙慦eb搴旂敤紼嬪簭http://www.shnenglu.com/fenglin/articles/149578.html椋庢灄椋庢灄Mon, 27 Jun 2011 08:55:00 GMThttp://www.shnenglu.com/fenglin/articles/149578.htmlhttp://www.shnenglu.com/fenglin/comments/149578.htmlhttp://www.shnenglu.com/fenglin/articles/149578.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/149578.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/149578.html1銆佸垱寤篧eb搴旂敤紼嬪簭
浣跨敤“ASP.NET緗戠珯”妯℃澘鏂板緩涓涓綉绔欍傛寚瀹氭槸鎯充嬌鐢―evelopment Web Server錛堟寚瀹氫竴涓枃浠剁郴緇熶綅緗拰鏂囦歡鍚嶏級錛岃繕鏄兂浣跨敤IIS錛堟寚瀹氫竴涓狧TTP浣嶇疆鍜孶RL錛?br />
2銆佹煡鐪嬪茍緙栬緫Web紿椾綋鐨凥TML瀹氫箟
鍦ㄨ璁¤鍥劇獥鍙d腑鍗曞嚮紿椾綋涓嬫柟鐨?#8220;婧?#8221;鏍囩錛堟垨鑰呮寜Shift+F7錛?br />
3銆佷負Web紿椾綋鍒涘緩鏍峰紡
閫夋嫨“鏍煎紡”|“鏂板緩鏍峰紡”銆備嬌鐢?#8220;鏍峰紡鐢熸垚鍣?#8221;瀵硅瘽妗嗘潵瀹氫箟紿椾綋鐨勬牱寮?br />
4銆佸湪Web紿椾綋涓婃坊鍔燞TML鎺т歡錛堜嬌鐢℉TML鎺т歡錛屽彲浠ユ洿瀹規(guī)槗鍦板皢鐜版湁鐨凙SP緗戦〉瀵煎叆ASP.NET錛?/strong>
灞曞紑宸ュ叿綆變腑鐨?#8220;HTML”綾誨瀷銆傚皢鎺т歡鎷栨斁鍒癢eb紿椾綋涓?br />
5銆佷負ASP.NET Server鎺т歡鍒涘緩浜嬩歡澶勭悊紼嬪簭
鍦ㄨ璁¤鍥句腑錛岄夊畾Web紿椾綋涓婄殑鎺т歡銆傚湪“灞炴?#8221;紿楀彛涓紝鍗曞嚮“浜嬩歡”宸ュ叿鏍忔寜閽紙鏈夐棯鐢?shù)鍥惧舰鐨勬寜閽Q夈傛壘鍒版兂瑕佷嬌鐢ㄧ殑浜嬩歡錛岀劧鍚庤緭鍏ヤ簨浠跺鐞嗘柟娉曠殑鍚嶇О錛屾垨鑰呭弻鍑諱簨浠舵潵浣跨敤榛樿鍚嶇О銆傚湪“浠g爜鍜屾枃鏈紪杈戝櫒”紿楀彛涓紝緙栧啓浠g爜鏉ュ鐞嗕簨浠?br />
6銆佸垱寤轟富棰?br />涓虹綉绔欐坊鍔犱竴涓狝pp_Themes鏂囦歡澶廣備負涓婚鍒涘緩涓涓瓙鏂囦歡澶廣傚湪榪欎釜鏂囦歡澶逛腑錛屽垱寤轟竴涓瑙傛枃浠舵潵瀹氫箟鎺т歡鐨勫睘鎬?br />
7銆佸悜緗戠珯搴旂敤涓涓富棰?br />瑕佷箞浣跨敤姣忎釜欏電殑@Page灞炴ф潵鎸囧畾涓婚錛?br />%@Page Theme="BlueTheme" .....%
瑕佷箞淇敼Web.config鏂囦歡錛屽茍鍦╬ages鍏冪礌涓寚瀹氫富棰橈細
<pages theme="BlueTheme" />

椋庢灄 2011-06-27 16:55 鍙戣〃璇勮
]]>
浣跨敤鏁版嵁緇戝畾鏉ユ樉紺?緙栬緫鏁版嵁(WPF&LINQ)http://www.shnenglu.com/fenglin/articles/149543.html椋庢灄椋庢灄Mon, 27 Jun 2011 02:53:00 GMThttp://www.shnenglu.com/fenglin/articles/149543.htmlhttp://www.shnenglu.com/fenglin/comments/149543.htmlhttp://www.shnenglu.com/fenglin/articles/149543.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/149543.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/149543.html闃呰鍏ㄦ枃

椋庢灄 2011-06-27 10:53 鍙戣〃璇勮
]]>
ADO.NET,DLINQ鏌ヨ鏁版嵁http://www.shnenglu.com/fenglin/articles/149502.html椋庢灄椋庢灄Sun, 26 Jun 2011 09:14:00 GMThttp://www.shnenglu.com/fenglin/articles/149502.htmlhttp://www.shnenglu.com/fenglin/comments/149502.htmlhttp://www.shnenglu.com/fenglin/articles/149502.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/149502.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/149502.html1SqlConne...  闃呰鍏ㄦ枃

椋庢灄 2011-06-26 17:14 鍙戣〃璇勮
]]>
WPF寮鍙?/title><link>http://www.shnenglu.com/fenglin/articles/149264.html</link><dc:creator>椋庢灄</dc:creator><author>椋庢灄</author><pubDate>Thu, 23 Jun 2011 04:57:00 GMT</pubDate><guid>http://www.shnenglu.com/fenglin/articles/149264.html</guid><wfw:comment>http://www.shnenglu.com/fenglin/comments/149264.html</wfw:comment><comments>http://www.shnenglu.com/fenglin/articles/149264.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/fenglin/comments/commentRss/149264.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/fenglin/services/trackbacks/149264.html</trackback:ping><description><![CDATA[<div>1銆佸垱寤轟竴涓猈PF錛圵indows Presentation Foundation錛夊簲鐢ㄧ▼搴?br />浣跨敤“WPF搴旂敤紼嬪簭”妯℃澘<br /><br />2銆佸皢鎺т歡娣誨姞鍒扮獥浣?br />灝嗘帶浠朵粠“宸ュ叿綆?#8221;鎷栨斁鍒扮獥浣?br /><br />3銆佹洿鏂扮獥浣撴垨鎺т歡鐨勫睘鎬?br />鍦ㄨ璁¤鍥句腑鍗曞嚮紿椾綋鎴栨帶浠躲傜劧鍚庨夋嫨浠ヤ笅鎿嶄綔涔嬩竴錛?br />A銆佸湪“灞炴?#8221;紿楀彛錛堟寜F4鎵撳紑錛変腑錛岄夋嫨鎯寵鏇存敼鐨勫睘鎬э紝騫惰緭鍏ユ柊鍊?br />B銆佸湪XAML紿楁牸涓紝鍦?lt;Window>鍏冪礌鎴栬呭畾涔変簡鎺т歡鐨勫叾瀹冨厓绱犱腑鎸囧畾灞炴у拰鍊?br /><br />4銆佹煡鐪嬬獥浣撹儗鍚庣殑浠g爜<br />閫夋嫨浠ヤ笅鎿嶄綔涔嬩竴錛?br />A銆侀夋嫨“瑙嗗浘”|“浠g爜”<br />B銆佸湪璁捐瑙嗗浘涓彸鍑伙紝鐒跺悗浠庡脊鍑虹殑蹇嵎鑿滃崟涓夋嫨“鏌ョ湅浠g爜”<br />C銆佸湪瑙e喅鏂規(guī)璧勬簮綆$悊鍣ㄤ腑錛屽睍寮紿椾綋鐨?xaml鏂囦歡錛岀劧鍚庡弻鍑諱笅闈㈢殑.xaml.cs鏂囦歡<br /><br />5銆佸畾涔変竴緇勪簰鏂ョ殑鍗曢夋寜閽?br />鍦ㄧ獥浣撲笂娣誨姞涓涓潰鏉挎帶浠訛紝渚嬪StackPanel銆傚皢鍗曢夋寜閽坊鍔犲埌闈㈡澘涓傚悓涓涓潰鏉夸腑鐨勬墍鏈夊崟閫夋寜閽兘鏄簰鏂ョ殑銆?br /><br />6銆佸鐞嗘帶浠舵垨紿椾綋鐨勪簨浠?br />鍦╔AML紿楁牸涓紝娣誨姞浠g爜鏉ユ寚瀹氫簨浠訛紙渚嬪杈撳叆Closing=''錛夛紝鐒跺悗浠庡揩鎹瘋彍鍗曚腑錛岃涔堥夋嫨涓涓幇鏈夌殑浜嬩歡澶勭悊鏂規(guī)硶錛堣鏈夋紜殑絳懼悕錛夛紝瑕佷箞閫夋嫨<鏂板緩浜嬩歡澶勭悊紼嬪簭>鍛戒護銆傜劧鍚庯紝鍦ㄤ簨浠舵柟娉曚腑鍐欎唬鐮佹潵澶勭悊浜嬩歡銆?br /><br />7銆佷負WPF紿椾綋鍒涘緩涓涓彍鍗?br />娣誨姞涓涓狣ockPanel鎺т歡錛屾妸瀹冩斁鍦ㄧ獥浣撻《閮ㄣ傜劧鍚庡湪DockPanel鎺т歡涓坊鍔犱竴涓狹enu鎺т歡銆?br /><br />8銆佸湪鑿滃崟涓坊鍔犺彍鍗曢」<br />涓篗enu鎺т歡娣誨姞MenuItem鍏冪礌銆傝緗瓾eader灞炴ф潵鎸囧畾鑿滃崟欏圭殑鏄劇ず鏂囦歡銆備負浜嗘寚瀹氳彍鍗曢」鐨勮闂揩鎹烽敭錛屽彲浠ュ湪瀛楁瘝鍓嶉潰娣誨姞涓涓笅鍒掔嚎瀛楃銆?br /><br />9銆佸湪鑿滃崟涓垱寤轟竴鏉″垎闅旂嚎<br />涓鴻彍鍗曟坊鍔犱竴涓猄eperator鍏冪礌銆?br /><br />10銆佸崟鍑昏彍鍗曢」鍚庢墽琛屼竴涓搷浣?br />閫夋嫨鑿滃崟欏癸紝鐒跺悗涓篊lick浜嬩歡鎸囧畾涓涓簨浠舵柟娉曘傚皢浣犵殑浠g爜娣誨姞鍒頒簨浠舵柟娉曚腑銆?br /><br />11銆佸垱寤哄揩鎹瘋彍鍗?br />鍦╓indows璧勬簮錛?lt;Window.Sources>...</Window.Sources>錛変腑娣誨姞涓涓狢ontextMenu銆傞噰鍙栧拰鍦ㄦ櫘閫氳彍鍗曚腑娣誨姞鑿滃崟欏逛竴鏍風殑鏂瑰紡錛屽湪蹇嵎鑿滃崟涓坊鍔犺彍鍗曢」銆?br /><br />12銆佸皢蹇嵎鑿滃崟鍏寵仈鍒扮獥浣撴垨鎺т歡<br />璁劇疆紿椾綋鎴栨帶浠剁殑ContextMenu灞炴э紝璁╄繖涓睘鎬у紩鐢ㄥ揩鎹瘋彍鍗曘?br /><br />13銆佸姩鎬佸垱寤哄揩鎹峰紡鑿滃崟<br />鍒涘緩涓涓狢ontextMenu瀵硅薄銆備嬌鐢ㄥ畾涔変簡姣忎釜鑿滃崟欏圭殑MenuItem瀵硅薄鏉ュ~鍏呰繖涓璞$殑Items闆嗗悎錛堜嬌鐢↖tems.Add鏂規(guī)硶錛夈傝緗獥浣撴垨鎺т歡鐨凜ontextMenu灞炴э紝浣夸箣寮曠敤榪欎釜ContextMenu銆?br /><br />14銆佹彁紺虹敤鎴鋒寚瀹氳淇濆瓨鍒板摢涓枃浠朵腑<br />浣跨敤SaveFileDialog綾匯備嬌鐢⊿howDialog鏂規(guī)硶鏉ユ樉紺哄璇濇銆傚璇濇鍏抽棴鍚庯紝FileName灞炴у氨鍖呭惈浜嗙敤鎴烽夋嫨鐨勬枃浠跺悕銆?br /><br />15銆佷嬌鐢ㄦ暟鎹粦瀹氭妧鏈紝灝嗙獥浣撴帶浠剁殑灞炴т笌瀵硅薄鐨勫睘鎬х粦瀹?br />鍦ㄦ帶浠跺睘鎬х殑XAML浠g爜涓紝娣誨姞<Binding>鍏冪礌鏉ユ寚瀹氱粦瀹氭簮(涓涓璞?浠ュ強瑕佸拰瀵硅薄涓殑鍝釜灞炴х粦瀹氥傚錛?br /><TextBox ...><br />  <TextBox.Text><br />    <Binding Source="{StaticResource customerData}"<br />      Path="ForeName" /><br />  </TextBox.Text><br /></TextBox><br /><br />16銆佸厑璁鎬竴涓暟鎹粦瀹氬鐢ㄦ埛杈撳叆鐨勬暟鎹繘琛屾牎楠?br />涓?lt;Binding>鍏冪礌娣誨姞<Binding.ValidationRules>瀛愬厓绱犮傚錛?br /><Binding Source="{StaticResource customerData}" Path="ForeName" /><br />  <Binding.ValidationRules><br />    <ExceptionValidationRules /><br />  </Binding.ValidationRules><br /></Binding><br /><br />17銆侀噰鐢ㄤ嬌鐢ㄨ涓嶅弽鎰熺殑鏂瑰紡鏄劇ず閿欒淇℃伅<br />瀹氫箟涓涓牱寮忥紝瀹冭礋璐f嫻嬪鎺т歡鐨刅alidation.HasError灞炴х殑鏇存敼錛屽茍灝嗘帶浠剁殑ToolTip灞炴ц涓哄紓甯告墍榪斿洖鐨勬秷鎭傚皢姝ゆ牱寮忓簲鐢ㄤ簬闇瑕佹牎楠岀殑鎵鏈夋帶浠躲傚錛?br /><Style x:Key="errorStyle" TargetType="Control"><br />            <Style.Triggers><br />                <Trigger Property="Validation.HasError" Value="True"><br />                    <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self},Path=(Validation.Errors)[0].ErrorContent}" /><br />                </Trigger><br />            </Style.Triggers><br />            <br />        </Style><br /><br />18銆佸湪紼嬪簭鎺у埗涓嬫牎楠屾墍鏈夋帶浠訛紝鑰屼笉鏄湪鐢ㄦ埛浠庝竴涓帶浠跺垏鎹㈠埌鍙︿竴涓帶浠舵椂榪涜鏍¢獙<br />鍦ㄥ畾涔夌粦瀹氱殑XAML浠g爜涓紝灝哢pdateSourceTrigger灞炴ц涓?Explicit"錛屼粠鑰屽皢鏍¢獙鎺ㄨ繜鍒板簲鐢ㄧ▼搴忔槑紜姹傝繘琛屾牎楠岀殑鏃跺欍備負浜嗘爣鍑嗗寲鎵鏈夋帶浠剁殑鏁版嵁錛岃涓烘瘡涓帶浠剁殑宸茬粦瀹氱殑灞炴у垱寤轟竴涓狟indingExpression瀵硅薄錛屽茍璋冪敤璇ュ璞$殑UpdateSource鏂規(guī)硶銆傛鏌ユ瘡涓狟indingExpression瀵硅薄鐨凥asError灞炴с傚鏋滆繖涓睘鎬т負true錛岃〃鏄庢牎楠屽け璐ャ?/div><img src ="http://www.shnenglu.com/fenglin/aggbug/149264.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/fenglin/" target="_blank">椋庢灄</a> 2011-06-23 12:57 <a href="http://www.shnenglu.com/fenglin/articles/149264.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鑷畾涔夌粨鏋?綾葷殑鎿嶄綔絎﹂噸杞?/title><link>http://www.shnenglu.com/fenglin/articles/149058.html</link><dc:creator>椋庢灄</dc:creator><author>椋庢灄</author><pubDate>Mon, 20 Jun 2011 10:55:00 GMT</pubDate><guid>http://www.shnenglu.com/fenglin/articles/149058.html</guid><wfw:comment>http://www.shnenglu.com/fenglin/comments/149058.html</wfw:comment><comments>http://www.shnenglu.com/fenglin/articles/149058.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/fenglin/comments/commentRss/149058.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/fenglin/services/trackbacks/149058.html</trackback:ping><description><![CDATA[<div><strong>1銆佸疄鐜版搷浣滅<br /></strong>鍏堝啓鍏抽敭瀛梡ublic鍜宻tatic錛屽悗璺熻繑鍥炵被鍨嬶紝鍚庤窡operator鍏抽敭瀛楋紝鍐嶅悗璺熻澹版槑鐨勬搷浣滅絎﹀彿錛屾渶鍚庡湪涓瀵瑰渾鎷彿涓坊鍔犳伆褰撶殑鍙傛暟銆傚錛?br />struct Hour<br />{<br />  ...<br />  public static bool operator==(Second lhs, Second rhs)<br /> {<br />  ...<br />  }<br />  ...<br />}<br /><br /><strong>2銆佸0鏄庤漿鎹㈡搷浣滅<br /></strong>鍏堝啓鍏抽敭瀛梡ublic鍜宻tatic錛屽悗璺熷叧閿瓧implicit(闅愬紡杞崲)鎴杄xplicit(鏄劇ず杞崲)錛屽悗璺無perator鍏抽敭瀛楋紝鍚庤窡瑕佽漿鎹㈡垚鐨勭洰鏍囩被鍨嬶紝鐒跺悗鍦ㄤ竴瀵瑰渾鎷彿涓坊鍔犱竴涓弬鏁版潵琛ㄧず杞崲鏃剁殑鏉ユ簮綾誨瀷銆傚錛?br />struct Hour<br />{<br />  ...<br />  public static implicit operator Hour(int arg)<br />  {<br />    ...<br />  }<br />  ...<br />}</div><img src ="http://www.shnenglu.com/fenglin/aggbug/149058.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/fenglin/" target="_blank">椋庢灄</a> 2011-06-20 18:55 <a href="http://www.shnenglu.com/fenglin/articles/149058.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>浣跨敤鏌ヨ琛ㄨ揪寮忔潵鏌ヨ鍐呭瓨涓殑鏁版嵁錛圠INQ錛?/title><link>http://www.shnenglu.com/fenglin/articles/149055.html</link><dc:creator>椋庢灄</dc:creator><author>椋庢灄</author><pubDate>Mon, 20 Jun 2011 10:13:00 GMT</pubDate><guid>http://www.shnenglu.com/fenglin/articles/149055.html</guid><wfw:comment>http://www.shnenglu.com/fenglin/comments/149055.html</wfw:comment><comments>http://www.shnenglu.com/fenglin/articles/149055.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/fenglin/comments/commentRss/149055.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/fenglin/services/trackbacks/149055.html</trackback:ping><description><![CDATA[<div><strong>1銆佷粠鍙灇涓鵑泦鍚坧roject鎸囧畾鐨勫瓧孌?br /></strong>浣跨敤Select鏂規(guī)硶錛岀敤lambda琛ㄨ揪寮忔潵鏍囪瘑瑕乸roject鐨勫瓧孌點傚錛?br />var customerFirstNames=customers.Select(cust=>cust.FirstName);<br /><u style="color: red">鎴栬呬嬌鐢╢rom鍜宻elect 鏌ヨ鎿嶄綔絎︺傚錛?br />var customerFirstNames=from cust in customers select cust.FirstName;</u><u><br /></u><br /><strong>2銆佺瓫閫夋潵鑷彲鏋氫婦闆嗗悎鐨?/strong><br />浣跨敤Where鏂規(guī)硶錛岀敤lambda琛ㄨ揪寮忔潵鎸囧畾琛岀殑鍖歸厤鏉′歡銆傚錛?br />var usCompanies=addresses.Where(addr=>String.Equals(addr.Country,"United States")).Select(usComp=>usComp.CompanyName);<br /><u style="color: red">鎴栬呬嬌鐢╳here鏌ヨ鎿嶄綔絎︺傚錛?br />var usCompanies=from a in addresses where String.Equals(a.Country,"United States")<br />select a.CompanyName;</u><br /><br /><strong>3銆佹寜鐗瑰畾欏哄簭鏋氫婦鏁版嵁<br /></strong>浣跨敤OrderBy鏂規(guī)硶錛岀敤lambda琛ㄨ揪寮忔潵鏍囪瘑鐢ㄤ簬瀵硅榪涜鎺掑簭鐨勫瓧孌點傚錛?br />var companyNames=addresses.OrderBy(addr=>addr.CompanyName).Select(comp=>comp.CompanyName);<br /><u style="color: red">鎴栬呬嬌鐢╫rderby鏌ヨ鎿嶄綔絎︺傚錛?br />var companyNames=from a in addresses orderby a.CompanyName select a.CompanyName;</u><u><br /></u><br /><strong>4銆佹牴鎹竴涓瓧孌電殑鍊煎鏁版嵁榪涜鍒嗙粍</strong><br />浣跨敤GroupBy鏂規(guī)硶錛岀敤lambda琛ㄨ揪寮忔潵鏍囪瘑鐢ㄤ簬瀵硅榪涜鍒嗙粍鐨勫瓧孌點傚錛?br />var companiesGroupedByCountry=addresses.GroupBy(addrs=>addrs.Country);<br /><u style="color: red">鎴栬呬嬌鐢╣roup by鏌ヨ鎿嶄綔絎︺傚錛?br />var companiesGroupedByCountry=from a in addresses group a by a.Country;</u><u><br /></u><br /><strong>5銆佽仈鎺ヤ袱涓笉鍚岄泦鍚堜腑鐨勬暟鎹?/strong><br />浣跨敤Join鏂規(guī)硶鏉ユ寚瀹氳鑱旀帴鐨勯泦鍚堬紝鑱旀帴鏉′歡錛屼互鍙婄粨鏋滃瓧孌點傚錛?br />var citiesAndCustomers=customers.Select(c=>new{c.FirstName,c.LastName,c.CompanyName}).Join(addresses,custs=>custs.CompanyName,addrs=>addrs.CompanyName,(custs,addrs)=>new{custs.FirstName,custs.LastName,addrs.Country});<br /><u style="color: red">鎴栬呬嬌鐢╦oin鏌ヨ鎿嶄綔絎︺傚錛?br />var citiesAndCustomers=from a in addresses join c in customers on a.CompanyName equals c.CompanyName select new{c.FirstName,c.LastName,a.Country};</u><u><br /></u><br /><strong>6銆佸己榪珛鍗崇敓鎴怢INQ鏌ヨ緇撴灉<br /></strong>浣跨敤ToList鎴朤oArray鏂規(guī)硶鐢熸垚鍖呭惈緇撴灉鐨勫垪琛ㄦ垨鏁扮粍銆傚錛?br />var allEmployees=from e in empTree.ToList<Employee>() select e;<br /><br />//搴旇灝介噺浣跨敤鍏舵硾鍨嬫柟娉?灝嗘暟鎹紦瀛樹簬鍐呭瓨涓紝鍥犳鏃犳硶鏌ュ埌鏈鏂扮殑鏁版嵁銆?br /></div><img src ="http://www.shnenglu.com/fenglin/aggbug/149055.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/fenglin/" target="_blank">椋庢灄</a> 2011-06-20 18:13 <a href="http://www.shnenglu.com/fenglin/articles/149055.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鏋氫婦闆嗗悎http://www.shnenglu.com/fenglin/articles/149044.html椋庢灄椋庢灄Mon, 20 Jun 2011 08:40:00 GMThttp://www.shnenglu.com/fenglin/articles/149044.htmlhttp://www.shnenglu.com/fenglin/comments/149044.htmlhttp://www.shnenglu.com/fenglin/articles/149044.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/149044.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/149044.html1銆佷嬌涓涓被“鍙灇涓?#8221;錛屽厑璁稿畠鏀寔foreach緇撴瀯
瀹炵幇IEnumerable鎺ュ彛錛屽茍鎻愪緵涓涓狦etEnumerator鏂規(guī)硶鏉ヨ繑鍥炰竴涓狪Enumerator瀵硅薄銆傚錛?br />public class Tree<TItem>:IEnumerable<TItem>
{
...
IEnumerator<TItem> GetEnumerator()
{
...
}
}

2銆佸湪涓嶇敤榪唬鍣ㄧ殑鍓嶆彁涓嬪疄鐜頒竴涓灇涓懼櫒
瀹氫箟涓涓灇涓懼櫒綾伙紝瀹冨簲璇ュ疄鐜癐Enumerator鎺ュ彛錛屽茍鍦ㄦ帴鍙d腑鎻愪緵Current灞炴у拰MoveNext錛堝茍鍙夋嫨鎻愪緵Reset錛夋柟娉曘傚錛?br />public class TreeEnumerator<TItem>:IEnumerator<T>
{
...
TItem Current
{
  get
  {
  ...
   }
}

bool MoveNext()
{
  ...
}
}

3銆佺敤榪唬鍣ㄦ潵瀹炵幇涓涓灇涓懼櫒
浣跨敤yield璇彞鏉ュ疄鐜版灇涓懼櫒銆倅ield鎸囧畾浜嗚榪斿洖鐨勬暟鎹」浠ュ強浠ヤ粈涔堥『搴忚繑鍥炪傚錛?br />IEnumerator<TItem> GetEnumerator()
{
  for(...)
   yield return ...
}

椋庢灄 2011-06-20 16:40 鍙戣〃璇勮
]]>
娉涘瀷http://www.shnenglu.com/fenglin/articles/149015.html椋庢灄椋庢灄Mon, 20 Jun 2011 03:53:00 GMThttp://www.shnenglu.com/fenglin/articles/149015.htmlhttp://www.shnenglu.com/fenglin/comments/149015.htmlhttp://www.shnenglu.com/fenglin/articles/149015.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/149015.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/149015.html1銆佸垱寤烘硾鍨嬬被
浣跨敤綾誨瀷鍙傛暟鏉ュ畾涔夌被銆傚錛?br />public class Tree<TItem>
{
  ...
}

2銆佸疄渚嬪寲娉涘瀷綾葷殑瀵硅薄
鎸囧畾鍏蜂綋鐨勭被鍨嬪弬鏁般傚錛?br />Tree<char> charTree = new Tree<char>('M');

3銆佸娉涘瀷綾葷殑綾誨瀷鍙傛暟榪涜闄愬埗
瀹氫箟綾繪椂錛屼嬌鐢╳here 瀛愬彞鏉ユ寚瀹氱害鏉熴傚錛?br />public class Tree<TItem> where TItem:IComparable<TItem>
{
...
}

4銆佸畾涔夋硾鍨嬫柟娉?/strong>
浣跨敤綾誨瀷鍙傛暟鏉ュ畾涔夋柟娉曘傚錛?br />static void InsertIntoTree<TItem>(Tree<TItem> tree, params TItem[] data)
{
...
}
鍔犵害鏉熷垯涓猴細
static void InsertIntoTree<TItem>(Tree<TItem> tree, params TItem[] data) where TItem : IComparable<TItem>

5銆佽皟鐢ㄦ硾鍨嬫柟娉?/strong>
涓烘瘡涓被鍨嬪弬鏁伴兘鎻愪緵鎭板綋鐨勭被鍨嬨傚錛?br />InsertIntoTree<char>(charTree, 'X', 'A', 'M', 'Z', 'Z', 'N');

椋庢灄 2011-06-20 11:53 鍙戣〃璇勮
]]>
涓柇紼嬪簭嫻佺▼騫跺鐞嗕簨浠訛紙濮旀墭銆佷簨浠訛級http://www.shnenglu.com/fenglin/articles/149008.html椋庢灄椋庢灄Mon, 20 Jun 2011 02:32:00 GMThttp://www.shnenglu.com/fenglin/articles/149008.htmlhttp://www.shnenglu.com/fenglin/comments/149008.htmlhttp://www.shnenglu.com/fenglin/articles/149008.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/149008.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/149008.html1銆佸0鏄庡鎵樼被鍨?br />鍏堝啓鍏抽敭瀛梔elegate,鍐嶅啓榪斿洖綾誨瀷錛屽啀鍐欏鎵樺悕縐幫紝鐒跺悗鍦ㄤ竴瀵?)涓坊鍔犲弬鏁板垪琛ㄣ傚錛?br />delegate void myDelegate();

2銆佸垱寤哄鎵樼殑瀹炰緥錛屽茍鐢ㄤ竴涓叿浣撶殑鏂規(guī)硶鏉ュ垵濮嬪寲瀹?/strong>
濡傦細
delegate void myDelegate();
private void myMethod(){...}
...
myDelegate del = new myDelegate(this.myMethod);

3銆佽皟鐢ㄥ鎵?br />濡傦細
myDelegate del;
...
del();

4銆佸0鏄庝簨浠?/strong>
鍏堝啓鍏抽敭瀛梕vent錛屽啀鍐欑被鍨嬬殑鍚嶇О錛堢被鍨嬪繀欏繪槸涓涓鎵樼被鍨嬶級錛屽啀鍐欎簨浠剁殑鍚嶇О銆傚錛?br />delegate void myDelegate();

class MyClass
{
  public event myDelagate MyEvent;
}

5銆佽闃呬簨浠訛紙鎴愪負浜嬩歡鐨勮闃呰咃級
鐢╪ew鎿嶄綔絎﹀垱寤轟竴涓鎵樺疄渚嬶紙璇ュ鎵樺叿鏈変笌浜嬩歡鐩稿悓鐨勭被鍨嬶級錛岀劧鍚庝嬌鐢?=鎿嶄綔絎︼紝灝嗗鎵樺疄渚嬪悓浜嬩歡鍏寵仈璧鋒潵銆傚
class MyEventHandlingClass
{
...
public void Start()
{
  myClass.MyEvent += new myDelegate(this.eventHandlingMethod);
}

private void eventHandlingMethod()
{
  ...
}

private MyClass myClass = new MyClass();
}
榪樺彲浠ョ洿鎺ユ寚瀹氳闃呮柟娉曪紝璁╃紪璇戝櫒鑷姩鐢熸垚鏂扮殑濮旀墭錛?br />public void Start()
{
  myClass.MyEvent += this.eventHandlingMethod;
}

6銆佸彇娑堣闃呬簨浠訛紙涓嶅啀鎴愪負涓涓簨浠剁殑璁㈤槄鑰咃級
鍒涘緩涓涓鎵樺疄渚嬶紙璇ュ鎵樺叿鏈変笌浜嬩歡鐩稿悓鐨勭被鍨嬶級錛岀劧鍚庝嬌鐢?=鎿嶄綔絎︼紝浣垮鎵樺疄渚嬩粠浜嬩歡涓劚紱匯傚錛?br />class MyEventHandlingClass
{
  ...
  public void Stop()
{
myClass.MyEvent -= new myDelegate(this.eventHandlingMethod);
}

private void eventHandlingMethod()
{
  ...
}

private MyClass myClass = new MyClass();
}

鎴栬咃細

public void Stop()
{
  myClass.myEvent -= this.eventHandlingMethod;
}


7銆佸紩鍙戜竴涓簨浠?br />鍍忚皟鐢ㄦ柟娉曢偅鏍?#8220;璋冪敤”浜嬩歡錛堝湪浜嬩歡鍚嶇О鍚庢坊鍔犱竴瀵瑰渾鎷彿錛夈傚鏋滃畾涔変簨浠剁殑濮旀墭瑕佹眰鍙傛暟錛岄偅涔堣繕瑕佹彁渚涘搴旂殑瀹炲弬銆傚紩鍙戜簨浠朵箣鍓嶏紝涓嶈蹇樿媯鏌ヤ簨浠舵槸鍚︿負null銆傚錛?br />class MyClass
{
public event myDelegate MyEvent;
...
private void RaiseEvent()
{
if(this.MyEvent != null)
{
  this.MyEvent();
}
}
...
}

椋庢灄 2011-06-20 10:32 鍙戣〃璇勮
]]>
浣跨敤绱㈠紩鍣?/title><link>http://www.shnenglu.com/fenglin/articles/148875.html</link><dc:creator>椋庢灄</dc:creator><author>椋庢灄</author><pubDate>Fri, 17 Jun 2011 09:39:00 GMT</pubDate><guid>http://www.shnenglu.com/fenglin/articles/148875.html</guid><wfw:comment>http://www.shnenglu.com/fenglin/comments/148875.html</wfw:comment><comments>http://www.shnenglu.com/fenglin/articles/148875.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/fenglin/comments/commentRss/148875.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/fenglin/services/trackbacks/148875.html</trackback:ping><description><![CDATA[<div>1銆佷負綾繪垨緇撴瀯鍒涘緩绱㈠紩鍣?br />澹版槑绱㈠紩鍣ㄧ被鍨嬶紝鍚庤窡鍏抽敭瀛梩his錛岀劧鍚庡湪鏂規(guī)嫭鍙蜂腑娣誨姞绱㈠紩鍣ㄥ弬鏁般傚<br />struct RawInt<br />{<br />  ...<br />  public bool this[int index]<br />  {<br />    get{...}<br />    set{...}<br />   }<br />  ...<br />}<br /><br />2銆佸湪鎺ュ彛涓畾涔夌儲寮曞櫒<br />浣跨敤get浠ュ強/鎴栬卻et鍏抽敭瀛楁潵瀹氫箟涓涓儲寮曞櫒銆傚<br />interface IRawInt<br />{<br />  bool this [int index]{get;set;}<br />}<br /><br />3銆佸湪綾繪垨緇撴瀯涓疄鐜頒竴涓帴鍙g儲寮曞櫒<br />濡?br />struct RawInt:IRawInt<br />{<br />  ...<br />  public bool this[int index]<br />  {<br />    get{...}<br />    set{...}<br />  }<br />  ...<br />}<br /><br />4銆佸湪綾繪垨緇撴瀯涓紝閲囧彇“鏄懼紡鎺ュ彛瀹炵幇”鏉ュ疄鐜版帴鍙e畾涔夌殑绱㈠紩鍣?br />鍦ㄥ疄鐜版帴鍙g殑綾繪垨緇撴瀯涓紝鏄懼紡鍛藉悕鎺ュ彛錛屼絾涓嶈鎸囧畾绱㈠紩鍣ㄧ殑鍙闂с傚<br />struct RawInt : IRawInt<br />{<br />  ...<br />  bool IRawInt.this [int index]<br />  {<br />     get{...}<br />     set{...}<br />   }<br />   ...<br />}</div><img src ="http://www.shnenglu.com/fenglin/aggbug/148875.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/fenglin/" target="_blank">椋庢灄</a> 2011-06-17 17:39 <a href="http://www.shnenglu.com/fenglin/articles/148875.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>瀹炵幇灞炴т互璁塊棶瀛楁http://www.shnenglu.com/fenglin/articles/148842.html椋庢灄椋庢灄Fri, 17 Jun 2011 03:10:00 GMThttp://www.shnenglu.com/fenglin/articles/148842.htmlhttp://www.shnenglu.com/fenglin/comments/148842.htmlhttp://www.shnenglu.com/fenglin/articles/148842.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/148842.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/148842.html1銆佷負緇撴瀯鎴栬呯被澹版槑涓涓彲璇?鍙啓鐨勫睘鎬?br />struct Screen Position
{
  ...
  public int X
  {
      get {...}
      set {...}
  }
...
}

2銆佷負緇撴瀯鎴栬呯被澹版槑涓涓彧璇誨睘鎬?br />struct Screen Position
{
  ...
  public int X
  {
      get {...}
  }
...
}

3銆佷負緇撴瀯鎴栬呯被澹版槑涓涓彧鍐欏睘鎬?br />struct Screen Position
{
  ...
  public int X
  {
      set {...}
  }
...
}

4銆佸湪鎺ュ彛涓0鏄庝竴涓睘鎬?br />interface IScreenPosition
{
  int X{get;set;}
  int Y {get;set;}
}

5銆佸湪緇撴瀯鎴栬呯被涓疄鐜頒竴涓帴鍙e睘鎬?br />struct ScreenPosition:IScreenPosition
{
  public int X{...}
  public int Y {...}
}

6銆佸垱寤轟竴涓嚜鍔ㄥ睘鎬?br />

    class Polygon
    {
        public int NumSides { get; set; }
        public double SideLength { get; set; }

        public Polygon()
        {
            this.NumSides = 4;
            this.SideLength = 10.0;
        }
    }


Polygon square = new Polygon();
Polygon triangle = new Polygon { NumSides = 3 };
Polygon pentagon = new Polygon { SideLength = 15.5, NumSides = 5 };


娉細
鍙湁鍦ㄤ竴涓粨鏋勬垨綾誨垵濮嬪寲濂戒箣鍚庯紝鎵嶈兘閫氳繃榪欎釜緇撴瀯鎴栫被鐨勫睘鎬ф潵榪涜璧嬪箋?br />ScreenPosition location;
location.X=40;//緙栬瘧鏃墮敊璇紝location灝氭湭浣跨敤new鏉ュ垵濮嬪寲

涓嶅彲灝嗗睘鎬т綔涓轟竴涓猺ef鎴栬卭ut鍙傛暟鍊間紶緇欎竴涓柟娉曪紱浣嗗彲浠ュ皢涓涓彲鍐欑殑瀛楁浣滀負ref鎴杘ut鍙傛暟鍊兼潵浼犻掋傝繖鏄敱浜庡睘鎬у茍涓嶇湡姝f寚鍚戜竴涓唴瀛樹綅緗紝鐩稿弽錛屽畠鎸囧悜鐨勬槸涓涓闂柟娉曘?/strong>

鍦ㄤ竴涓睘鎬т腑錛屾渶澶氬彧鑳藉寘鍚竴涓猤et accessor鍜屼竴涓猻et accessor銆傚睘鎬т笉鑳藉寘鍚叾瀹冩柟娉曘佸瓧孌墊垨灞炴с?/strong>

get accessor鍜宻et accessor涓嶈兘鑾峰彇浠諱綍鍙傛暟銆傝璧嬬殑鍊間細閫氳繃鍐呭緩鐨勩侀殣钘忕殑value鍙橀噺錛岃嚜鍔ㄤ紶緇檚et accessor銆?/strong>

涓嶈兘澹版槑const灞炴с傚
const int X{get{...}set{...}}//緙栬瘧鏃墮敊璇?/p>

椋庢灄 2011-06-17 11:10 鍙戣〃璇勮
]]>
鍨冨溇鍥炴敹綆$悊http://www.shnenglu.com/fenglin/articles/148829.html椋庢灄椋庢灄Fri, 17 Jun 2011 01:26:00 GMThttp://www.shnenglu.com/fenglin/articles/148829.htmlhttp://www.shnenglu.com/fenglin/comments/148829.htmlhttp://www.shnenglu.com/fenglin/articles/148829.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/148829.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/148829.html1銆佹瀽鏋勫嚱鏁?br />class Test
{
   public Test()//鏋勯犲嚱鏁?br />   {
 ...
   }

   ~Test()//鏋愭瀯鍑芥暟
   {
 ...
   }

鏋愭瀯鍑芥暟鍙傜敤浜庡紩鐢ㄧ被鍨嬶紱涓嶈兘緇欐瀽鏋勫嚱鏁板姞璁塊棶鏉冮檺淇グ絎︼紱鏋愭瀯鍑芥暟涓嶈兘甯﹀弬鏁幫紱鍙湁鍨冨溇鍥炴敹鍣ㄦ墠鑳借皟鐢ㄦ瀽鏋勫嚱鏁般?br />
2銆佸紓甯稿畨鍏ㄧ殑disposal鏂規(guī)硶
娉細寮鴻皟鐨勬槸鏂規(guī)硶鐨勭敤閫旇屼笉鏄悕縐般傛崲璦涔嬶紝涓涓猟isposal鏂規(guī)硶鍙互浣跨敤浠諱綍鏈夋晥鐨凜#鏂規(guī)硶鍚嶏紝鑰屼笉璇翠笓闂ㄥ瓨鍦ㄤ竴涓悕涓篸isposal鐨勬柟娉曘傛瘮濡俆extReader鐨刢lose鏂規(guī)硶

3銆乽sing璇彞
using(TextReader reader = new StreamReader(fileName))
{

  ...
}

4銆佸己鍒跺瀮鍦懼洖鏀訛紙涓嶆帹鑽愶級
璋冪敤  System.GC.Collect()

椋庢灄 2011-06-17 09:26 鍙戣〃璇勮
]]>
interface,abstract,sealedhttp://www.shnenglu.com/fenglin/articles/148724.html椋庢灄椋庢灄Wed, 15 Jun 2011 09:34:00 GMThttp://www.shnenglu.com/fenglin/articles/148724.htmlhttp://www.shnenglu.com/fenglin/comments/148724.htmlhttp://www.shnenglu.com/fenglin/articles/148724.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/148724.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/148724.html1銆佸0鏄庝竴涓帴鍙?br />interface IDemo
{
string Name();
...
}

2銆佸疄鐜頒竴涓帴鍙?br />class Test:IDemo
{
  public string IDemo.Name()//蹇呴』鍐欐帴鍙e墠緙
  {
   ...
  }
}

3銆佹娊璞$被錛屽繀欏諱綔涓哄熀綾葷戶鎵垮叾鐨勯潪鎶借薄綾繪墠鑳藉疄渚嬪寲
abstract class Test
{
  abstract string Name();
...
}

4銆佸瘑灝佺被錛堜笉鍏佽琚戶鎵匡級
sealed class Test
{
...
}

椋庢灄 2011-06-15 17:34 鍙戣〃璇勮
]]>
interface,virtual,override,sealedhttp://www.shnenglu.com/fenglin/articles/148714.html椋庢灄椋庢灄Wed, 15 Jun 2011 07:55:00 GMThttp://www.shnenglu.com/fenglin/articles/148714.htmlhttp://www.shnenglu.com/fenglin/comments/148714.htmlhttp://www.shnenglu.com/fenglin/articles/148714.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/148714.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/148714.htmlinterface 寮曞叆涓涓柟娉曠殑鍚嶇О銆?br />virtual 鏂規(guī)硶鏄柟娉曠殑絎竴涓疄鐜般?br />override 鏂規(guī)硶鏄柟娉曠殑鍙︿竴涓疄鐜般?br />sealed 鏂規(guī)硶鍒欐槸鏂規(guī)硶鐨勬渶鍚庝竴涓疄鐜般?/div>

椋庢灄 2011-06-15 15:55 鍙戣〃璇勮
]]>
緇ф壙銆佹墿灞?/title><link>http://www.shnenglu.com/fenglin/articles/148711.html</link><dc:creator>椋庢灄</dc:creator><author>椋庢灄</author><pubDate>Wed, 15 Jun 2011 07:03:00 GMT</pubDate><guid>http://www.shnenglu.com/fenglin/articles/148711.html</guid><wfw:comment>http://www.shnenglu.com/fenglin/comments/148711.html</wfw:comment><comments>http://www.shnenglu.com/fenglin/articles/148711.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/fenglin/comments/commentRss/148711.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/fenglin/services/trackbacks/148711.html</trackback:ping><description><![CDATA[<div>1銆佷粠鍩虹被鍒涘緩涓涓淳鐢熺被<br />class Derived:Base<br />{<br />...<br />}<br />2銆佸湪媧劇敓綾葷殑鏋勯犲嚱鏁頒腑璋冪敤鍩虹被鏋勯犲嚱鏁?br />class Derived:Base<br />{<br />...<br />  public Derived(int x):base(x)<br />  {<br />   ...<br />   }<br />...<br />}<br />3銆佸0鏄庝竴涓獀irtual鏂規(guī)硶<br />class Mammal<br />{<br />  public virtual void Breathe()<br />  {<br />  ...<br />  }<br />...<br />}<br />4銆佸湪媧劇敓綾諱腑瀹炵幇涓涓柟娉曪紝璁╁畠瑕嗙洊涓涓戶鎵跨殑virtual鏂規(guī)硶<br />class Whale : Mammal<br />{<br />  public override void Breathe()<br />  {<br />  ...<br />  }<br />}<br />5銆佷負涓涓被鍨嬪畾涔夋墿灞曟柟娉?br />static class Util<br />{<br />  public static int Negate(this int i)<br />  {<br />    return -i;<br />  }<br />}</div><img src ="http://www.shnenglu.com/fenglin/aggbug/148711.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/fenglin/" target="_blank">椋庢灄</a> 2011-06-15 15:03 <a href="http://www.shnenglu.com/fenglin/articles/148711.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鏁扮粍鍙傛暟http://www.shnenglu.com/fenglin/articles/148699.html椋庢灄椋庢灄Wed, 15 Jun 2011 02:40:00 GMThttp://www.shnenglu.com/fenglin/articles/148699.htmlhttp://www.shnenglu.com/fenglin/comments/148699.htmlhttp://www.shnenglu.com/fenglin/articles/148699.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/148699.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/148699.html1銆佷負鏂規(guī)硶澹版槑涓涓粰瀹氱被鍨嬬殑params鏁扮粍鍙傛暟錛屽彲浠ユ帴鍙椾換鎰忔暟閲忕粰瀹氱被鍨嬬殑鍙傛暟
濡傦細
someType Method(params int[] numbers)
{
 ...
}

2銆佷負鏂規(guī)硶澹版槑涓涓猳bject綾誨瀷鐨刾arams鏁扮粍鍙傛暟錛屽彲浠ユ帴鍙椾換鎰忔暟閲忋佷換鎰忕被鍨嬬殑鍙傛暟
濡傦細
someType Method(params object[] paramList)
{
 ...
}

椋庢灄 2011-06-15 10:40 鍙戣〃璇勮
]]>
鏁扮粍http://www.shnenglu.com/fenglin/articles/148696.html椋庢灄椋庢灄Wed, 15 Jun 2011 02:08:00 GMThttp://www.shnenglu.com/fenglin/articles/148696.htmlhttp://www.shnenglu.com/fenglin/comments/148696.htmlhttp://www.shnenglu.com/fenglin/articles/148696.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/148696.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/148696.html 1            //鏁扮粍
 2            //Time[] times = new Time[2] { new Time(21, 7, 10), new Time(9, 10, 11) };
 3            //Time[] copyToTimes = new Time[times.Length];
 4            //times.CopyTo(copyToTimes, 0);
 5            //foreach (Time time in copyToTimes)
 6            //{
 7            //    Console.WriteLine(time.ToString());
 8            //}
 9
10            //ArrayList鏁扮粍
11            ArrayList times = new ArrayList();
12            times.Add(new Time(21710));
13            times.Add(new Time(91011));
14
15            Time[] copyToTimes = new Time[times.Count];
16            times.CopyTo(copyToTimes, 0);
17
18            foreach (Time time in copyToTimes)
19            {
20                Console.WriteLine(time.ToString());
21            }

22
23            //闃熷垪
24            //Queue<int> queue = new Queue<int>();
25            //foreach (int i in new int[] { 8, 10, 2, 3, 6, 5 })
26            //{
27            //    queue.Enqueue(i);
28            //}
29            //while(queue.Count>0)
30            //{
31            //    Console.WriteLine(queue.Dequeue());
32            //}
33
34            //鍫嗘爤
35            //Stack<int> stack = new Stack<int>();
36            //foreach (int i in new int[] { 8, 10, 2, 3, 6, 5 })
37            //{
38            //    stack.Push(i);
39            //}
40            //while (stack.Count > 0)
41            //{
42            //    Console.WriteLine(stack.Pop());
43            //}
44
45            //Hashtable 涓嶅厑璁告湁閲嶅KEY鐨勫厓绱?br />46            //Hashtable ages = new Hashtable();
47            //ages["don"] = 27;
48            //ages["fly"] = 27;
49            //ages["don"] = 29;//涓嶄細鎶涘紓甯革紝浣嗕細灝嗘key鐨剉alue瑕嗙洊
50            //ages.Add("don", 29);//浼氭姏寮傚父
51            //foreach (DictionaryEntry e in ages)
52            //{
53            //    string name = e.Key.ToString();
54            //    int age = (int)e.Value;
55            //    Console.WriteLine("Name:{0},Age:{1}", name, age);
56            //}
57
58            //SortedList 鍏冪礌宸茶嚜鍔ㄦ帓搴?br />59            //SortedList ages = new SortedList();
60            //ages["sun"] = 28;
61            //ages["fly"] = 27;
62            //ages["don"] = 27;
63            //foreach (DictionaryEntry e in ages)
64            //{
65            //    string name = e.Key.ToString();
66            //    int age = (int)e.Value;
67            //    Console.WriteLine("Name:{0},Age:{1}", name, age);
68            //}

椋庢灄 2011-06-15 10:08 鍙戣〃璇勮
]]>
浼犲箋佷紶寮曠敤http://www.shnenglu.com/fenglin/articles/148633.html椋庢灄椋庢灄Tue, 14 Jun 2011 07:24:00 GMThttp://www.shnenglu.com/fenglin/articles/148633.htmlhttp://www.shnenglu.com/fenglin/comments/148633.htmlhttp://www.shnenglu.com/fenglin/articles/148633.html#Feedback0http://www.shnenglu.com/fenglin/comments/commentRss/148633.htmlhttp://www.shnenglu.com/fenglin/services/trackbacks/148633.html
 1static void Main(string[] args)
 2{
 3  int n=10;
 4  add(n);
 5  Console.WriteLine(n);//n=10
 6
 7}

 8
 9private static void add(int num)
10{
11  num++;
12}
2銆佷紶寮曠敤ref銆乷ut
 
 1        static void Main(string[] args)
 2        {
 3            int a = 7;
 4            add(ref a);
 5            Console.WriteLine(a);//a=8
 6        }

 7
 8        public static void add(ref int num) {
 9            num++;
10        }
ref涓巓ut閮戒負浼犲紩鐢紝涓昏鐨勫尯鍒湪浜庯細ref鍓嶇紑鐨勫弬鏁板湪浼犲叆鍓嶅繀欏誨垵濮嬪寲,鑰宱ut鍓嶇紑鐨勫弬鏁板垯涓嶇劧錛屽彲浠ュ湪璋冪敤鍑芥暟閲屽垵濮嬪寲鍙傛暟銆?img src ="http://www.shnenglu.com/fenglin/aggbug/148633.html" width = "1" height = "1" />

椋庢灄 2011-06-14 15:24 鍙戣〃璇勮
]]>
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
      <noscript id="pjuwb"></noscript>
            <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
              <dd id="pjuwb"></dd>
              <abbr id="pjuwb"></abbr>
              在线不卡中文字幕| 亚洲免费观看视频| 欧美伊人久久| 性色av一区二区三区红粉影视| 欧美日韩一区二区在线视频 | 久久精品一区| 黄色日韩在线| 欧美激情麻豆| 欧美日韩免费观看一区二区三区| 亚洲午夜久久久久久久久电影网| 99在线精品视频| 国产麻豆精品在线观看| 久久久综合网站| 欧美gay视频| 亚洲一区在线免费| 久久精品视频在线播放| 亚洲片区在线| 亚洲一二区在线| 一区免费观看| 99在线精品观看| 国产一区二区三区免费不卡| 亚洲电影在线看| 欧美午夜不卡| 久久天堂国产精品| 欧美日韩久久久久久| 欧美中文在线视频| 欧美国产精品人人做人人爱| 亚洲伊人一本大道中文字幕| 午夜精品久久一牛影视| 最新日韩在线| 午夜亚洲福利在线老司机| 亚洲激情视频网站| 亚洲欧美久久久久一区二区三区| 在线成人性视频| 中文国产一区| 日韩天堂在线观看| 久久精品123| 亚洲欧美另类在线| 蜜月aⅴ免费一区二区三区| 亚洲欧美日韩国产成人| 蜜臀va亚洲va欧美va天堂| 亚洲综合电影| 欧美日产国产成人免费图片| 久久蜜臀精品av| 国产精品日韩久久久| 亚洲国产精品传媒在线观看| 国产一区91| 亚洲影院免费观看| 亚洲一二三区在线观看| 欧美高清影院| 免费一级欧美片在线观看| 国产日韩欧美一二三区| 在线视频日本亚洲性| 一区二区三区www| 免费在线看一区| 欧美成人午夜| 在线观看91久久久久久| 欧美一区三区三区高中清蜜桃| 日韩一级二级三级| 欧美成年人视频网站| 欧美肥婆bbw| 亚洲国产成人久久综合一区| 久久久av毛片精品| 久久久亚洲国产天美传媒修理工| 国产日韩欧美在线播放| 亚洲一区二区免费视频| 亚洲欧美三级伦理| 欧美午夜不卡在线观看免费 | 久久视频这里只有精品| 国产精品v片在线观看不卡| 99re6这里只有精品视频在线观看| 亚洲国产综合91精品麻豆| 久久激情视频| 免费人成网站在线观看欧美高清 | 久久久久国产精品一区三寸| 久久精品国产久精国产爱| 国产欧美日韩激情| 欧美一级播放| 乱中年女人伦av一区二区| 黄色一区二区三区| 母乳一区在线观看| 日韩视频在线观看| 性色av一区二区三区| 国内一区二区三区| 久久亚洲精选| 亚洲三级性片| 亚洲性xxxx| 国产一区二区视频在线观看| 久久女同互慰一区二区三区| 免费高清在线视频一区·| 亚洲精品久久久久久下一站 | 欧美日韩国产黄| 亚洲私人影院| 久久久青草婷婷精品综合日韩| 在线成人av| 欧美日一区二区在线观看 | 久久亚洲图片| 一区二区三区不卡视频在线观看| 亚洲欧美成aⅴ人在线观看| 国产综合在线视频| 欧美国产精品中文字幕| 亚洲免费在线视频一区 二区| 久久久久久黄| 亚洲视频电影在线| 一区在线观看视频| 国产精品国产三级国产a| 久久久久久久综合狠狠综合| 日韩视频在线免费| 美女视频一区免费观看| 亚洲综合日韩| 亚洲国产精品久久久久婷婷884 | 国产精品jvid在线观看蜜臀 | 亚洲免费黄色| 久久亚洲美女| 午夜视频在线观看一区二区| 亚洲电影专区| 国产农村妇女毛片精品久久莱园子 | 亚洲国产99精品国自产| 国产精品你懂的| 欧美国产日韩一区二区在线观看 | 欧美成人免费网站| 午夜激情综合网| 亚洲精品中文字幕有码专区| 国产亚洲美州欧州综合国| 欧美日韩精品一区二区在线播放 | 国产午夜久久久久| 欧美视频专区一二在线观看| 美国十次成人| 久久久久久**毛片大全| 亚洲视频一区二区| 亚洲精品自在久久| 亚洲国产精品va在线看黑人| 久久免费视频一区| 欧美在线国产| 亚洲在线一区二区三区| 一区二区av| 亚洲美女免费精品视频在线观看| 一区二区三区在线不卡| 国产一区二区三区高清在线观看 | 久热精品视频在线观看| 欧美一区深夜视频| 欧美一区二区免费| 新狼窝色av性久久久久久| 亚洲影视在线| 亚洲影院在线观看| 亚洲欧美综合v| 午夜精品一区二区三区电影天堂| 一级成人国产| 亚洲一区久久久| 西瓜成人精品人成网站| 欧美一区二区在线| 久久亚洲精品网站| 欧美电影免费观看网站| 欧美激情网站在线观看| 欧美乱大交xxxxx| 国产精品ⅴa在线观看h| 国产精品裸体一区二区三区| 国产精品免费福利| 国产一区91精品张津瑜| 激情五月婷婷综合| 亚洲日本理论电影| 一区二区三区四区国产| 午夜精品福利一区二区三区av| 篠田优中文在线播放第一区| 欧美伊人久久久久久午夜久久久久| 欧美一区二区| 免费看av成人| 亚洲三级免费| 亚洲欧美亚洲| 久久夜色精品国产亚洲aⅴ| 欧美成人蜜桃| 国产精品高清免费在线观看| 国产欧美大片| 亚洲国产精品欧美一二99| 亚洲最新中文字幕| 久久不射2019中文字幕| 欧美激情一区二区三区成人| 亚洲人午夜精品免费| 亚洲欧美在线一区| 蜜臀久久99精品久久久画质超高清 | 亚洲人成久久| 欧美一区国产一区| 欧美日韩高清不卡| 国产一区二区电影在线观看| 亚洲精品资源美女情侣酒店| 亚洲欧美日韩爽爽影院| 老鸭窝91久久精品色噜噜导演| 91久久线看在观草草青青| 午夜激情久久久| 欧美精品免费看| 狠狠色狠狠色综合人人| 中文精品视频| 欧美va亚洲va日韩∨a综合色| 宅男噜噜噜66一区二区| 麻豆精品视频| 国内成人精品2018免费看| 一区二区欧美在线观看| 欧美成人精品| 久久久999成人| 国产视频一区在线观看一区免费|