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()¶ÔÏó //Ë
Ïà¹ØÎĵµ£º
ÒÑÖªÓÐÒ»¸öXMLÎļþ£¨bookstore.xml£©ÈçÏ£º
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
&nb ......
ÔÚnetÖÐÓÐÒ»¸öÖÁ¹ØÖØÒªµÄ¹Ø¼ü×Ö£¬ÄǾÍÊÇusing
usingÒ»°ãÓÐ×ÅÒÔϼ¸ÖÖÓ÷¨£º
1¡¢Ö±½ÓÒýÈëÃüÃû¿Õ¼ä
a¡¢using System £¬Õâ¸öÊÇ×î³£Óõģ¬¾ÍÊÇusing+ÃüÃû¿Õ¼ä£¬ÕâÑù¾Í¿ÉÒÔÖ±½ÓʹÓÃÃüÃû¿Õ¼äÖеÄÀàÐÍ£¬¶øÃâÈ¥ÁËʹÓÃÏêϸµÄÃüÃû¿Õ¼ä
b¡¢Ê¹ÓÃÈ«ÏÞ¶¨Ãû
²»ÓÃʹÓÃusing System;Ö±½ÓÔÚ³ÌÐòÖе÷ÓÃSystem.Console.WriteLine("Hello ......
public enum GUIInfoType
{
guiText.
guiTextClass,
guiTextParent,
guiTextClassParent,
}
private static int level=0
public static int FindGUILike(ref int hWndArray,int hWndStart,ref string window ......
C#Windows·þÎñ³ÌÐòµÄ¿ìËÙ¿ª·¢ÏòÄã½éÉÜÁËÔںܶàÓ¦ÓÃÖÐÐèÒª×öwindows·þÎñÀ´²Ù×÷Êý¾Ý¿âµÈ²Ù×÷£¬Ï£Íû¶ÔÄãÁ˽âC#Windows·þÎñ³ÌÐòµÄ¿ª·¢ÓÐËù°ïÖú¡£
C#Windows·þÎñ³ÌÐòµÄ¿ìËÙ¿ª·¢£ºÔںܶàÓ¦ÓÃÖÐÐèÒª×öwindows·þÎñÀ´²Ù×÷Êý¾Ý¿âµÈ²Ù×÷£¬±ÈÈç
£¨1£©Ò»Ð©·Ç³£ÂýµÄÊý¾Ý¿â²Ù×÷£¬²»ÏëÒ»´ÎÐÔÈ¥×ö£¬ÏëÂýÂýµÄͨ¹ý·þÎñ¶¨Ê±È¥×ö£¬±ÈÈ綨ʱΪ ......
¼Ì³ÐÊÇÅÉÉúÀࣨ×ÓÀࣩȥʵÏÖ£¨ÖØд<override>¡¢Öع¹<new>£©»ùÀࣨ¸¸ÀࣩµÄ·½·¨»òÊôÐÔ¡£´Ó¶ø»ñÈ¡ÔÚÅÉÉúÀàÖÐҪʵÏֵŦÄÜ¡£
×ÓÀàµ÷Óø¸À๹Ôì·½·¨£¬ÔÚ¸¸ÀàÖÐÓиöʵÏÖÐÕÃûºÍÄêÁäµÄ¹¹Ôì·½·¨µ«ÊÇÖÐ×ÓÀàҲҪʵÏÖÕâÑùµÄ¹¦ÄÜÕâʱ×ÓÀ಻ÓÃÔÙ´ÎȥдÕâ¸ö¹¦ÄÜֻҪȥµ÷Óø¸ÀàµÄ¹¦Äܼ´¿É¡£
public class Person
& ......