C#ÖÐrefºÍoutµÄÇø±ð
¿´Á˺ܶà.°´ÕÕ ×Ô¼ºÃ÷°×½âÊÍһϠ.NET RefºÍOut¹Ø¼ü×Ö ¶ÔÓÚÖµÀàÐÍ¡£ Èç¹û²»Ê¹ÓÃref /outÔò´«µÝµÄÖ»ÊÇÕâЩֵµÄCOPY, ʹÓÃÁËRefºÍOutµÄЧ¹û¾Í¼¸ºõºÍCÖÐʹÓÃÁËÖ¸Õë±äÁ¿Ò»Ñù¡£(´«µÝµÄ¾ÍÊÇÔÖµ),ËüÄܹ»ÈÃÄãÖ±½Ó¶ÔÔÊý½øÐвÙ×÷£¬¶ø²»ÊǶÔÄǸöÔÊýµÄCopy½øÐвÙ×÷ ¶ÔÓÚÒýÓÃÀàÐÍ: Èç¹û²»Ê¹ÓÃref /out,ÒòΪ´«µÝµÄÊÇÒýÓÃÀàÐ͵ĵØÖ·Öµ,Ôò½«´«µÝÒýÓÃÀàÐ͵ĵØÖ·ÖµµÄÒ»¸öCOPY(--Õë¶ÔµØÖ·ÖµµÄ½Ç¶È»¹ÊÇÖµÀàÐÍ´«µÝ),ʵ¼ÊÉϾÍÊÇпªÒ»¸ö²»Í¬µÄÄÚ´æ±äÁ¿À´´æ´¢Õâ¸öµØÖ·ÖµµÄ¿½±´ ¶øʹÓÃref /out,´«µÝµÄ»¹ÊÇÒýÓÃÀàÐ͵ĵØÖ·Öµ,µ«ÊÇ´«µÝµÄ¾Í²»ÊÇÒ»¸öбäÁ¿À´´æ¿½±´,¶øÊǾÍÊÇ´«ÔÀ´µÄÄǸöÓ¦ÓÃÀàÐ͵ĵØÖ·Öµ /////////////////×¢ÒâlistµÄ´¦Àí////////²»ÓùØÐÄ,Òì²½,´úÀíίÍÐÕâЩ;¿ÉÒÔºÍʹÓÃͬ²½·½·¨Ò»ÑùÀí½â£»Ö»ÊÇÕýºÃÓöµ½ÁËÕâ¸öÀý////////////////////////////////////////////////×ÓËùÒÔÄÃÀ´Óã» public delegate string DelegateWithParameters(string param1, int param2, ArrayList list); private void CallFooWithParameters() { // create the paramets to pass to the function string strParam1 = "Param1"; int intValue = 100; ArrayList list = new ArrayList(); list.Add("Item1"); // create the delegate DelegateWithParameters delFoo = new DelegateWithParameters(FooWithParameters); // call FooWithParameters(string param1,int param2, ArrayList list) // ʵ¼ÊÉÏlistµÄÒýÓõØÖ·×÷ΪֵÀàÐÍ´«µÝ,½øÈë·½·¨Ê±,ÓÃÒ»¸öÐÂÄÚ´æ±äÁ¿´æ´¢Õâ¸öÒýÓõĵØÖ· //ËùÒÔÔÚº¯ÊýÄÚ²¿¶à¸ÃÐÂÄÚ´æ±äÁ¿µØÖ·ÐÞ¸Ä.Ö»ÊÇÈøÃÐÂÄÚ´æ±äÁ¿Ö¸ÏòÁËÁíÍâÒ»¸ölist IAsyncResult tag = delFoo.BeginInvoke(strParam1, intValue, list, null, null); // normally control is returned right away, // so you can do other work here... // calling end invoke to get the return value string strResult = delFoo.EndInvoke(tag); // write down the parameters: Trace.WriteLine("param1: " + strParam1); Trace.WriteLine("param2: " + intValue); Trace.WriteLine("ArrayList count: " + list.Count); } private string FooWithParameters(string param1, int param2, ArrayList list) { // lets modify the data! param1 = "Modify Value for param1"; param2 = 200; list = new ArrayList(); //listÊÇ´«½øÀ´µÄÄǸöµØÖ·µÄ¿½±´;ËùÒÔÖ»ÊÇ°ÑÕâ¸öеĿ½±´Ö¸ÏòÁËÒ»¸öеÄnew ArralyList()¶ÔÏó //Ë
Ïà¹ØÎĵµ£º
C#ÓëFlash½»»¥ £¨×ª×ÔСÀÚÔÚÏߣ©
C#ÓëFlash½»»¥
Ç°¶ÎÈÕ×Ó¹«Ë¾ÒªÇó×öÒ»¸öC#ÓëFlash½»»¥µÄ¶«Î÷£¬ÓÃÀ´C#Óë¶ÌÐÅèͨѶ½«Êý¾Ý´«µ½FlashÉÏÏÔʾÓë²Ù×÷µÄÓ¦Óá£
µÚÒ»²½C#Ìí¼Ó×é¼þ
´ò¿ªVS2005-¹¤¾ß-Ñ¡Ôñ¹¤¾ßÏäÏî-COM×é¼þ-Ñ¡ÔñShockwave Flash Object-È·¶¨
Ìí¼ÓºÃ×é¼þÍù³¡¾°ÉÏÍÏ·Å£¬Èç¹ûÌáʾע²áÐèÇó×¢²á
c# ×¢²á¿Ø¼þ-ÔÚÔËÐÐÊä ......
private static int level=0
public static int FindGUILike(ref int hWndArray,int hWndStart,ref string windowText,ref string className,ref string parentText)
{
int hwnd=0;
int r=0;
StringBuilder sWindowText=new StringBuilder();
StringBuilder sClassname=new StringBuilder();
StringBuilder sParentT ......
------------------------
¡ï
Foreach £º
Óŵ㣺
1¡¢²»Óÿ¼ÂÇÊý×éÆðʼË÷ÒýÊǼ¸
int[] nArray = new int[100];
// Use "foreach" to loop array
foreach( int i in nArray )
2¡¢¶ÔÓÚ¶àάÊý×é²Ù×÷ÓÃforeach·Ç³£¼ò±ã
int[,] nVisited = new int[8,8];
// Use "for" to loop two-dimension array
for( int i = 0; i ......
public struct POINTAPI
{
public int x;
public int y;
}
public static void GetWindowfromPoint(ref int hwnd,ref StringBuilder winText,ref StringBuilder clsName,ref StringBuilder pText)
{
int parentHandle=0;
int maxLen=128;
POINTAPI pnt = new ......