Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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;}
}
µ«ÒÔÏÂÖØÔØÉùÃ÷ÊÇÎÞЧ


Ïà¹ØÎĵµ£º

asp.net¿ª·¢³£Óü¼ÇÉ

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 ......

vs ¿ª·¢ asp.net¹ý³ÌÖÐ ÒýÓà jsÎļþ³ö´íµÄ½â¾ö°ì·¨


ÔÚ.netÖÐͨ¹ýÕâÖÖ·½Ê½ÒýÓÃjsÎļþ
<script type="text/javascript" src="setday0.js"></script>
È»ºóÔÚÒ³ÃæÖе÷ÓÃsetday0.jsÎļþÖеķ½·¨ÍùÍù»á³ö´í£¡µ«ÊÇÄãÈç¹û°Ñsetday0.jsÎļþµÄÄÚÈÝÖ±½Ó·Åµ½¸ÃÒ³ÃæÖÐÀ´ÓÖÒ»µãÎÊÌâҲûÓС£Õâ¸öÎÊÌâÀ§»óÁËÎҺܾã¬ÔÚ1.1µÄʱºò¾ÍÓöµ½Á˵±Ê±Ã»°ì·¨¾ÍÔÚÒ³ÃæÖÐÖØдjs´úÂë¡£½ñÌ ......

ASP.NETÓ¦ÓóÌÐòÁ¬½ÓOracleµÄÎÊÌâ

ÔÙWindows XPÉÏдºÃµÄASP.NETÓ¦ÓóÌÐò²¿Êðµ½IISÉÏ,Á¬½Ó²»ÉÏOracle10gÊý¾Ý¿â,Ìáʾ£º
System.Data.OracleClient Requires oracle client software version 8.1.7 or greater¡£
ÒòΪÔÚµ÷ÊÔ»·¾³ÊÇ¿ÉÒÔÁ¬½ÓÉϵÄ,ËùÒÔ¿¼ÂÇ¿ÉÄÜÊÇIISȨÏÞÉèÖÃÎÊÌâ¡£
ÊÔ׎«ASP.NETÓû§Ìí¼Óµ½ÁËAdministrator×éÖС£½á¹ûÁ¬½Ó³É¹¦¡£ ......

ASP.NET ÉÏ´«Í¼Æ¬ÖÁÊý¾Ý¿â²¢¶ÁȡͼƬÏÔʾ

1£ºÉÏ´«Í¼Æ¬µÄÏà¶Ô·¾¶µ½Êý¾Ý¿âÖÐÏàÓ¦×Ö¶ÎÀ¶ÁÈ¡ÏÔʾʱ£¬½«¿Ø¼þ£¨¼ÙÉèÓõÄÊÇImage¿Ø¼þ£©µÄImageUrlÊôÐÔÖ¸Ïò¸ÃÏà¶Ô·¾¶¼´¿É¡£
2£º½«Í¼Æ¬ÒÔ¶þ½øÖÆÁ÷µÄ·½Ê½ÕûÌåÉÏ´«µ½Êý¾Ý¿âÀ¶ÁÈ¡ÏÔʾʱ£¬ÒÔ¶þ½øÖÆÁ÷µÄ·½Ê½ÕûÌå¶Á³ö¡£ÕâÖÖ·½·¨ÉÔ΢Âé·³Ò»µã£¬µ«±£´æµÄÊÇͼƬÕûÌåµ½Êý¾Ý¿âÀï¡£
µÚÒ»ÖÖ·½·¨£¬ÊµÏÖÆðÀ´±È½Ï¼òµ¥£¬ÒòΪ´æÈëÊý¾Ý¿ ......

¾­µäµÄAsp.netÈý²ãÉè¼Æ

Èý²ãµÄ»®·Ö:
        Ä¿µÄ£º¸ßÄÚ¾Û£¬µÍñîºÏ£¬Îª¸üºÃµÄʵÏÖ·Ö²¼Ê½¿ª·¢ºÍά»¤¡£
        Óû§½çÃæ²ã: Ò³Ãæ,Óû§¿Ø¼þ,ͼƬ£¬Ñùʽ±í
        ÒµÎñÂß¼­²ã:ÒµÎñ½Ó¿Ú( BusinessInterface ), ÒµÎñʵÌå( BusinessEntity),ÒµÎñÂß¼­(BusinessLogic)
    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ