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

c# primer note I

------------------------
¡ï
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 < nVisited.GetLength(0); i++ )
for( int j = 0; j < nVisited.GetLength( 1 ); j++ )
Debug.WriteLine( nVisited[i,j].ToString() );
// Use "foreach" to loop two-dimension array
foreach( int i in nVisited )
Debug.WriteLine( i.ToString() );
3¡¢foreachÀàÐÍת»»
// Init an arraylist object
int[] nArray = new int[100];
ArrayList arrInt = new ArrayList();
arrInt.AddRange( nArray );
// Use "foreach" to loop an arraylist
foreach( int i in arrInt )
Debug.WriteLine( i.ToString() );
// Use "for" to loop an arraylist
for( int i = 0; i < arrInt.Count; i++ )
{
int n = ( int ) arrInt[i];
Debug.WriteLine( n.ToString() );
}
Á½¸öÏÞÖÆ
ÔÚforeach²»ÄÜÐÞ¸Äö¾Ù³ÉÔ±£¬Æä´Î²»Òª¶Ô¼¯ºÏ½øÐÐɾ³ý²Ù×÷¡£
// Use "foreach" to loop an arraylist
foreach( int i in arrInt )
{
i++;//Can't be compiled
Debug.WriteLine( i.ToString() );
}
// Use "foreach" to loop an arraylist
foreach( int i in arrInt )
{
arrInt.Remove( i );//It will generate error in run-time
Debug.WriteLine( i.ToString() );
}
¸½--¶ÔÓڼǼ¼¯µÄ¶àÌõÊý¾Ýɾ³ý
¿ÉÒÔÓÃforÀ´ÊµÏÖ£¬ÓÉÓÚÔÚһЩ¼Ç¼¼¯ÖнøÐÐɾ³ýµÄʱºò£¬ÔÚɾ³ý²Ù×÷Ö®ºóÏàÓ¦µÄË÷ÒýÒ²·¢ÉúÁ˱仯£¬ÕâʱºòµÄɾ³ýÒª·´¹ýÀ´½øÐÐɾ³ý
// Use "for" to loop an arraylist
for( int i = arrInt.Count - 1; i >=0; i-- )
{
int n = ( int ) arrInt[i];
if( n == 5 )
arrInt.RemoveAt( i ); // Remove data here
Debug.WriteLine( n.ToString() );
}
http://blog.csdn.net/huang7914/archive/2008/04/16/2296176.aspx

------------------------
¡ï
------------------------
¡ï
------------------------
¡ï
------------------------
¡ï
------------------------
¡ï
------------------------
¡ï
------------------------
¡ï
---------------------


Ïà¹ØÎĵµ£º

΢ÐÍORM——ÓÃVBºÍC#±àдµÄ¶¯Ì¬ÀàÐÍORM

      ½üÀ´ORM±äµÃÔ½À´Ô½Æձ飬Õⶼ¹éÓÚÒ»Öֺܾß˵·þÁ¦µÄÔ­Òò£»Ëü¿ÉÒÔʹ¿ª·¢Êý¾Ý¿âÇý¶¯µÄÓ¦ÓóÌÐò±äµÃ¸ü¿ì¡¢¸üÊ¡Á¦¡£µ«ÊÇORM¿ò¼Ü¶¼Óе㓹ÌÖ´¼º¼û”£¬ËûÃÇÆÚÍû¿ª·¢Õß×ñ´ÓÌض¨µÄ¹æÔò£¬µ±¹æÔò±»´òÆƵÄʱºò¾Í·Ç³£ÄÑÒÔʹÓá£×îͨ³£µÄ¹æÔòÖ®Ò»¾ÍÊÇ£¬´æ´¢¹ý³Ì±ØÐë×ÜÊÇ·µ»Øµ¥¶ÀµÄ½á¹û¼¯£¬ÆäÖд ......

½«TXTÎĵµÖÐÊý¾Ýµ¼ÈëXMLÎļþÖÐ C#

¶ÔÓÚ½«TXTÎĵµÖÐÊý¾Ýµ¼ÈëXMLÖеijÌÐòÍøÉϲ»¶à£¬µ«ÊÇÓкܶàÊÇÏȽ«TXTµ¼Èëµ½DataSetÖУ¬ÔÚÓÃXML½øÐд«Êä¡£ËùÒÔ±¾È˾ÍÔÚÕâÀïÓë´ó¼Ò·ÖÏíÒ»ÏÂÖ±½Óµ¼ÈëµÄÕâÖÖ·½Ê½¡£
±¾³ÌÐòÒ²¿ÉÒÔÓ¦ÓÃÓÚASP.NETÖУ¬ÄÇôÏÂÃæµÄÃüÃû¿Õ¼ä¼°Ò»Ð©µØ·½¾ÍµÃ¸Ä¸ÄÁË£¬»¹ÓÐÒª½«³ÌÐò¶¼·ÅÓÚPage_LoadÖС£
using System;
using System.Collections.Generic; ......

c# Îļþ´«Êä

send :
string path = "E:\\c#\\convey_file\\convey_file\\Form1.cs"; //Òª´«ÊäµÄÎļþ
TcpClient client = new TcpClient();
client.Connect(IPAddress.Parse("192.168.0.52"),9999);
FileStream file = new FileStream(path,FileMode.Open,FileAccess.Read); // ......

c# using ¹Ø¼ü×ÖµÄÓ÷¨


ÔÚnetÖÐÓÐÒ»¸öÖÁ¹ØÖØÒªµÄ¹Ø¼ü×Ö£¬ÄǾÍÊÇusing
usingÒ»°ãÓÐ×ÅÒÔϼ¸ÖÖÓ÷¨£º
1¡¢Ö±½ÓÒýÈëÃüÃû¿Õ¼ä
a¡¢using System £¬Õâ¸öÊÇ×î³£Óõģ¬¾ÍÊÇusing+ÃüÃû¿Õ¼ä£¬ÕâÑù¾Í¿ÉÒÔÖ±½ÓʹÓÃÃüÃû¿Õ¼äÖеÄÀàÐÍ£¬¶øÃâÈ¥ÁËʹÓÃÏêϸµÄÃüÃû¿Õ¼ä
b¡¢Ê¹ÓÃÈ«ÏÞ¶¨Ãû
²»ÓÃʹÓÃusing System;Ö±½ÓÔÚ³ÌÐòÖе÷ÓÃSystem.Console.WriteLine("Hello ......

c#ÀûÓÃwinapi±éÀú×ÀÃæ¿Ø¼þËã·¨

public enum GUIInfoType
{
     guiText.
     guiTextClass,
     guiTextParent,
     guiTextClassParent,
}
private static int level=0
public static int FindGUILike(ref int hWndArray,int hWndStart,ref string window ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ