亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

深入Ref,Out的理解及其使用

 更新時(shí)間:2013年06月09日 10:44:49   作者:  
本篇文章是對(duì)Ref與Out進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
復(fù)制代碼 代碼如下:

    class Program 
       { 
           //使用out后必須對(duì)變量賦值 
           public void TestOut(out int x, out int y) 
           { 
               x = 1; 
               y = 2; 
           } 
           //此時(shí)傳進(jìn)來的值分別為x1:10,y1:11,輸出之后的x1的值為2 

           public void TestRef(ref int x, ref int y) 
           { 
               //引用剪剪那句話傳進(jìn)來的是豬,出來的可能是頭牛(很精辟!) 
               x = 2; 

           } 
           static void Main(string[] args) 
           { 
               int x; 
               int y; 
               Program P1 = new Program(); 
               P1.TestOut(out x,out y); 
               Console.WriteLine("x={0},y={1}", x, y); 
               //在使用之前ref必須對(duì)變量賦值 
               int x1 = 10; 
               int Y1 = 11; 
               P1.TestRef(ref x1,ref Y1); 
               Console.WriteLine("x1={0},y1={1}", x1, Y1); 
           } 
       } 

相關(guān)文章

最新評(píng)論