C#¡¢ASP.NETÖÐrefºÍoutµÄÇø±ð
ÕâÁ½¸öÊý¾ÝÀàÐÍÊÇÎÒÃÇÔÚѧϰC#ÓïÑԵĹý³ÌÖÐÊý¾Ý±È½ÏÄѵÄÁ½¸öÊý¾ÝÀàÐÍ£¬²»¹ýËûÃǺÜÖØÒª£¬ËùÒÔÓбØÒªÄóöÀ´ËµËµËûÃǵÄʹÓ÷½·¨ºÍ²»Í¬Ö®´¦£¬Ï£Íû¶ÔÄãÓÐËù°ïÖú¡£
ÏÈ×ܵÄÀ´Ëµ£º
ͨ³£ÎÒÃÇÏò·½·¨Öд«µÝµÄÊÇÖµ.·½·¨»ñµÃµÄÊÇÕâЩֵµÄÒ»¸ö¿½±´,È»ºóʹÓÃÕâЩ¿½±´,µ±·½·¨ÔËÐÐÍê±Ïºó,ÕâЩ¿½±´½«±»¶ªÆú,¶øÔÀ´µÄÖµ²»½«Êܵ½Ó°Ïì.´ËÍâÎÒÃÇ»¹ÓÐÆäËûÏò·½·¨´«µÝ²ÎÊýµÄÐÎʽ,ÒýÓÃ(ref)ºÍÊä³ö(out).
ÓÐʱ,ÎÒÃÇÐèÒª¸Ä±äÔÀ´±äÁ¿ÖеÄÖµ,Õâʱ,ÎÒÃÇ¿ÉÒÔÏò·½·¨´«µÝ±äÁ¿µÄÒýÓÃ,¶ø²»ÊDZäÁ¿µÄÖµ.ÒýÓÃÊÇÒ»¸ö±äÁ¿,Ëû¿ÉÒÔ·ÃÎÊÔÀ´±äÁ¿µÄÖµ,ÐÞ¸ÄÒýÓý«ÐÞ¸ÄÔÀ´±äÁ¿µÄÖµ.±äÁ¿µÄÖµ´æ´¢ÔÚÄÚ´æÖÐ,¿ÉÒÔ´´½¨Ò»¸öÒýÓÃ,ËûÖ¸Ïò±äÁ¿ÔÚÄÚ´æÖеÄλÖÃ.µ±ÒýÓñ»ÐÞ¸Äʱ,Ð޸ĵÄÊÇÄÚ´æÖеÄÖµ,Òò´Ë±äÁ¿µÄÖµ¿ÉÒÔ½«±»ÐÞ¸Ä.µ±ÎÒÃǵ÷ÓÃÒ»¸öº¬ÓÐÒýÓòÎÊýµÄ·½·¨Ê±,·½·¨ÖеIJÎÊý½«Ö¸Ïò±»´«µÝ¸ø·½·¨µÄÏàÓ¦±äÁ¿,Òò´Ë,ÎÒÃÇ»áÃ÷°×,Ϊʲôµ±Ð޸IJÎÊý±äÁ¿µÄÐÞ¸ÄÒ²½«µ¼ÖÂÔÀ´±äÁ¿µÄÖµ.
RefÖ¸Ã÷ÁË·½·¨ÖÐʹÓõÄÊÇÒýÓÃÐͲÎÊý£¬ÒýÓÃÐͲÎÊý²»¿ª±ÙеÄÄÚ´æÇøÓò¡£µ±ÀûÓÃÒýÓÃÐͲÎÊýÏò·½·¨´«µÝÐβÎʱ£¬±àÒë³ÌÐò½«°Ñʵ¼ÊÖµÔÚÄÚ´æÖеĵØÖ·´«µÝ¸Ã·½·¨¡£ÒýÓÃÐͲÎÊýͨ³£ÒѾ³õʼ»¯¡£
Èç
int i=1,j=2;//³õʼ»¯
Swap(ref i,ref j);
OutÊä³öÐͲÎÊýÒ²²»¿ª±ÙеÄÄÚ´æÇøÓò£¬µ«ÓëÒýÓÃÐͲÎÊý²»Í¬µÄÊÇ£¬µ÷Ó÷½·¨Ö®Ç°ÎÞÐè¶Ô±äÁ¿½øÐгõʼ»¯£¬Êä³öÐͲÎÊýÖ÷ÒªÓÃÓÚ´«µÝ·½·¨·µ»ØµÄÊý¾Ý¡£
string name,path;//ûÓгõʼ»¯
File(out name,out path);
Ê×ÏÈÏÈ˵ref:(MSDN)
C# ¹Ø¼ü×Ö | ·½·¨²ÎÊý
·½·¨²ÎÊýÉ쵀 ref ·½·¨²ÎÊý¹Ø¼ü×Öʹ·½·¨ÒýÓô«µÝµ½·½·¨µÄͬһ¸ö±äÁ¿¡£µ±¿ØÖÆ´«µÝ»Øµ÷Ó÷½·¨Ê±£¬ÔÚ·½·¨ÖжԲÎÊýËù×öµÄÈκθü¸Ä¶¼½«·´Ó³ÔڸñäÁ¿ÖС£ÈôҪʹÓà ref ²ÎÊý£¬±ØÐ뽫²ÎÊý×÷Ϊ ref ²ÎÊýÏÔʽ´«µÝµ½·½·¨¡£ref ²ÎÊýµÄÖµ±»´«µÝµ½ ref ²ÎÊý¡£´«µÝµ½ ref ²ÎÊýµÄ²ÎÊý±ØÐë×îÏȳõʼ»¯¡£½«´Ë·½·¨Óë out ²ÎÊýÏà±È£¬ºóÕߵIJÎÊýÔÚ´«µÝµ½ out ²ÎÊý֮ǰ²»±ØÏÔʽ³õʼ»¯¡£
ÊôÐÔ²»ÊDZäÁ¿£¬²»ÄÜ×÷Ϊref ºÍout²ÎÊý´«µÝ¡£
Èç¹ûÁ½ÖÖ·½·¨µÄÉùÃ÷½öÔÚËüÃÇ¶Ô ref µÄʹÓ÷½Ã治ͬ£¬Ôò½«³öÏÖÖØÔØ¡£µ«ÊÇ£¬ÎÞ·¨¶¨Òå½öÔÚ ref ºÍ out ·½Ã治ͬµÄÖØÔØ¡£ÀýÈ磺
//ÒÔÏÂÖØÔØÉùÃ÷ÊÇÓÐЧµÄ£º
class MyClass
{
public void MyMethod(int i) {i = 10;}
public void MyMethod(ref int i) {i = 10;}
}
µ«ÒÔÏÂÖØÔØÉùÃ÷ÊÇÎÞЧ
Ïà¹ØÎĵµ£º
Ö»ÓÐÔÚ¡òPageÖ¸ÁîÖÐÉèÖÃÁË£ºAutoEventWireup="true"£¬·þÎñÆ÷¶ËµÄ±àÒëÆ÷½«°´ÕÕ Page_eventname ·½·¨ÃûµÄÐÎʽ×Ô¶¯µÄ¼ì²éÏàӦʼþ´¦Àí·½·¨£¬×Ô¶¯ÊµÏÖʼþµÄ¶©ÔÄ¡£
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System ......
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
´«ËͲÎÊý£º
response.write("<script>window.open
('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="++"')</script>")
½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1.Attributes.Add("o ......
ÔÚ.netÖÐͨ¹ýÕâÖÖ·½Ê½ÒýÓÃjsÎļþ
<script type="text/javascript" src="setday0.js"></script>
È»ºóÔÚÒ³ÃæÖе÷ÓÃsetday0.jsÎļþÖеķ½·¨ÍùÍù»á³ö´í£¡µ«ÊÇÄãÈç¹û°Ñsetday0.jsÎļþµÄÄÚÈÝÖ±½Ó·Åµ½¸ÃÒ³ÃæÖÐÀ´ÓÖÒ»µãÎÊÌâҲûÓС£Õâ¸öÎÊÌâÀ§»óÁËÎҺܾã¬ÔÚ1.1µÄʱºò¾ÍÓöµ½Á˵±Ê±Ã»°ì·¨¾ÍÔÚÒ³ÃæÖÐÖØдjs´úÂë¡£½ñÌ ......
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/lzy_1515/archive/2010/03/22/5405250.aspx
FCKEditorÓÚ2009Äê±»¸üÃûΪÐÂÒ»´úµÄCKEditorºÍCKFinder£¬¼ûhttp://ckeditor.com/¡£Ö»ÊDZ¾À´ÊÇÒ»¸öµÄ²úÆ·£¨FCKEditor£©ÏÖÔÚ±ä³ÉÁËÁ½¸ö£¨CKEditor + CKFinder£©£¬Èç¹ûÒªÉÏ´«Îļþµ½·þÎñÆ÷ÉÏ£¬×îа汾µÄCKEditor + CKFinde ......
asp.net(c#)ÍøÒ³ÌøתÆßÖÖ·½·¨Ð¡½á
·¢²¼Ê±¼ä£º2009-11-25 11:13:03
¡¡¡¡1.Response.Redirect("http://www.yayiba.com",false);
¡¡¡¡Ä¿±êÒ³ÃæºÍÔÒ³Ãæ¿ÉÒÔÔÚ2¸ö·þÎñÆ÷ÉÏ£¬¿ÉÊäÈëÍøÖ·»òÏà¶Ô·¾¶¡£ºóÃæµÄboolֵΪÊÇ·ñÍ£Ö¹Ö´Ðе±Ç°Ò³¡£
ÌøתÏòеÄÒ³Ã棬Դ°¿Ú±»´úÌæ¡£"
ä¯ÀÀÆ÷ÖеÄURLΪз¾¶¡£
:Response.Redirect·½ ......