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
------------------------
¡ï
------------------------
¡ï
------------------------
¡ï
------------------------
¡ï
------------------------
¡ï
------------------------
¡ï
------------------------
¡ï
---------------------
Ïà¹ØÎĵµ£º
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;namespace md5
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(UserMd5("8"));
Console.WriteLine(GetMd5Str("8"));
}
/**//// <summary>
/// MD5 16λ¼ÓÃÜ
......
ÕâЩÌìÒòΪ¹¤×÷ÐèÒª£¬Òª½«Ò»Ð©htmlÎļþת»»ÎªchmÎļþ£¬µ±È»ÊÇÐèÒªºÍ³ÌÐò½áºÏÔÚÒ»Æð¡£
ºóÀ´ÕÒµ½NDoc£¬ÀïÍ·ÓÐÒ»¶Î´úÂëÊÇÏà¹ØµÄ£¬ÓÚÊÇ¿ªÊ¼·ÖÎö´úÂ룬дÍêÖ®ºó£¬×ܽ᣺Ö÷ÒªÊÇÀûÓÃ΢ÈíµÄhhc.exeÀ´±àÒëhtmlÎļþ£¬³ÌÐòÐèÒª½«¾ßÌåµÄÊý¾ÝдÈëhhpºÍhhcÎļþ¡£
Ö÷Òª´úÂëÈçÏ£º
¸´ÖÆC#´úÂë±£´æ´úÂëpublic void CompileProject()
{ ......
ÏÈ˵python
pythonµÄrandomÄ£¿éÌṩÁ˶à¸öÎ±Ëæ»úÊý·¢ÉúÆ÷£¬Ä¬È϶¼ÊÇÓõ±Ç°Ê±¼ä´ÁÎªËæ»úÊýÖÖ×Ó¡£
ÏÂÃæÊǸÃÄ£¿é¼¸¸ö×î³£Óõĺ¯Êý
random() Return the next random floating point number in the range [0.0, 1.0).
randint(a,b) Return a random integer N such that a <=
N <= b
randrange([star ......
Ò»¡¢»ù±¾ÔÀí¼°¹ý³Ì
Flashͨ¹ýExternalInterfaceÀàÓëÈÝÆ÷Ó¦ÓóÌÐò½øÐÐͨÐÅ¡£Îª´Ë£¬ExternalInterfaceÀàÌṩÁ½¸ö¾²Ì¬ÊôÐÔºÍÁ½¸ö¾²Ì¬·½·¨¡£
ExternalInterface.call(“º¯ÊýÃû”£¬[²ÎÊý…])·½·¨Ö´ÐÐÈÝÆ÷Ó¦ÓóÌÐòµÄ´úÂ룬¸Ã·½·¨ÖÁÉÙÐèÒªÒ»¸ö×Ö·û´®²ÎÊýÀ´Ö¸¶¨Òªµ÷Óõĺ¯ÊýÃû£¬ÆäËüÈκβÎÊý½«×÷Ϊ²ÎÊý±»´«µÝ¸ø± ......