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

¹é½áÒ»ÏÂ×Ó:C#Ïß³Ìͬ²½µÄ¼¸ÖÖ²½Öè

ÎÒÃÇÔÚ±à³ÌµÄʱ·Ö£¬ÓÐʱ»áÔËÓöàÏß³ÌÀ´½â¾öÎÊÌ⣬ÀýÈçÄãµÄ³ÌÐò¼±ÐèÔÚºǫ́ÀÏ°å´¦ÖÃÒ»´ó¶ÑÊý¾Ý£¬µ«»¹ÒªÊ©Óû§½çÃæ¾ÓÓڿɲÙ×÷״̬£»»òÐíÄãµÄ³ÌÐòؽÐè·ÃÎÊһЩÍⲿ×ÊԴϤÊý¾Ý¿â»òÍøÂç×ÊÁϵȡ£ÕâЩ¾°¿öÄ㶼¿ÉÒÔ´´ÉèÒ»¸öÍ·Ïß³ÌÈ¥´¦Öã¬È»Ôò£¬¶àÏ̲߳»¿ÉÄæתµØ»á´ø»ØÒ»¸öÎÊÌ⣬ÄËÊÇÏß³Ìͬ²½µÄÎÊÌâ¡£ÈçÆäÕâ¸öÎÊÌâ´¦ÖÃÔã¸â£¬ÎÒÃǾͻáʧȥһЩ·ÇÔ¤ÆڵĽá¹û¡£
¡¡¡¡ÔÚÍøÉÏÒ²¿´¹ýһЩÖÁÓÚÏß³Ìͬ²½µÄ¸å¼þ£¬ÊµÔòÏß³Ìͬ²½Óкü¸ÖÖ²½Ö裬ϲ¿ÎÒ¾ÍÈÝÒ×µÄ×öÒ»ÏÂ×Ó¹é½á¡£
¡¡¡¡1¡¢volatile¹Ø¼ü×Ö
¡¡¡¡volatileÊÇ×îÈÝÒ×µÄÒ»ÖÖͬ²½²½Ö裬µ±È»ÈÝÒ×ÊÇÒª¸¶³ö´ú¼ÛµÄ¡£ËüÖ»ºÃÔÚ±äÁ¿Ò»¼¶×öͬ²½£¬volatileµÄº¬ÒâÄËÊǸæËß΢´¦ÀíÆ÷£¬ ²»Óý«ÎÒ·ÅÈ빤×÷ÄÚ´æ´¢Æ÷£¬ ÇëÖ±½ÓÔÚÖ÷´æ²Ù×÷ÎÒ¡££¨¡¾×ª×Ôwww.bitsCN.com ¡¿£©Òò¶ø£¬Ó¦¶àÏß³ÌÓë´Ëͬʱ·ÃÎʸñäÁ¿Ê±£¬¶¼½«Ö±½Ó²Ù×÷Ö÷´æ£¬´Ó±¾ÖÊÉÏ×÷µ½Á˱äÁ¿¹²Ïí¡£
¡¡¡¡Äܹ»±»±êʶΪvolatileµÄÎñ±ØÊÇÒԴμ¸Àà±ðÐÍ£º£¨Õª×ÔMSDN£©
•Any reference type.
•Any pointer type (in an unsafe context).
•The types sbyte, byte, short, ushort, int, uint, char, float, bool.
•An enum type with an enum base type of byte, sbyte, short, ushort, int, or uint.
¡¡¡¡È磺
Code
public class A
{
private volatile int _i;
public int I
{
get { return _i; }
set { _i = value; }
}
}
¡¡¡¡µ«volatile²¢²»ÄÜʵÏÖÕæ¸öµÄͬ²½£¬ÓÉÓÚËüµÄ²Ù×÷¼¶±ðֻͣÁôÔÚ±äÁ¿¼¶±ð£¬¶ø²»ÊÇÔ­×Ó¼¶±ð¡£Èç¹ûÊÇÔÚµ¥Î¢´¦ÀíÆ÷ϵͳÖУ¬ÊÇûÈκÎÎÊÌâµÄ£¬±äÁ¿ÔÚÖ÷´æÖÐûÓлú»á±»ÆäËûÈËÅú¸Ä£¬ÓÉÓÚΨÓÐÒ»¸ö΢´¦ÀíÆ÷£¬Õâ¾Í½Ð×öprocessor Self-Consistency¡£µ«ÔڶദÀíÆ÷ϵͳÖУ¬»òÕ߾ͻáÓÐÎÊÌâ¡£ ÿ¸ö΢´¦ÀíÆ÷¶¼ÓÐ×Ô¸ö¶ùµÄdata cach£¬²¢ÇÒ±»¸üеÄÊý¾ÝҲδ¼ûµÃ»áÁ¢Âíд»ØÀ´Ö÷´æ¡£Ö®ËùÒÔ¿ÉÄÜ»á´Ù³É²»Í¬²½£¬µ«ÕâÖÖ¾°¿öºÜÄÑ·¢×÷£¬ÓÉÓÚcachµÄ¶ÁдËٶȶԵȿ죬flushµÄƵ´ÎÒ²¶ÔµÈ¸ß£¬Î¨ÓÐÔÚѹÁ¦²âÊÔµÄʱ·Ö²ÅÓпÉÄÜ·¢Éú£¬²¢ÇÒ¼¸ÂÊÊ®·ÖÊ®·ÖС¡£
¡¡¡¡2¡¢lock¹Ø¼ü×Ö
¡¡¡¡lockÊÇÒ»ÖֱȽϺÃÓõÄÈÝÒ×µÄÏß³Ìͬ²½Ä£Ê½£¬ËüÊÇ͸¹ýΪ¸ø¶¨¶ÔÏó»ñÈ¡»¥³âËøÀ´¶ÒÏÖͬ²½µÄ¡£Ëü¿ÉÒÔ±£Ö¤Êéµ±Ò»¸öÏß³ÌÔÚÒªº¦´úÂë¶ÎµÄʱ·Ö£¬ÁíÒ»¸öÏ̲߳»»á½øÈ¥£¬ËüΨÆäÈç´ËµÈºò£¬´ýµ½ÄǸöÏ̶߳ÔÏ󱻿ªÊÍ£¬ÇÒ²»ËµÏ̳߳öÁËÁÙ½çÇø¡£Ó÷¨£º ¡¡¡¡lockµÄ²ÎÊýÎñ±ØÊÇ»ùÓÚÒýÊöÃÅÀàµÄ¶ÔÏ󣬲»ÓÃÊǸù±¾²¿ÀàÏñbool,intʲôµÄ£¬Õâô»ù±¾²»ÄÜͬ²½£¬Ô­ÒòÊÇlockµÄ²ÎÊýÒªÇóÊǶÔÏó£¬ÈçÈô´«µ½int£¬×¼¶¨Òª


Ïà¹ØÎĵµ£º

c#(asp.net) updatepanel ¾Ö²¿Ë¢ÐÂʵÀýÊÕ²Ø

1
<asp:UpdatePanelID="UpdatePanel1"
        UpdateMode="Conditional"
        runat="server">
    <ContentTemplate>
        <asp:Button ID="Button1"
      ......

C#ÓëC/C++µÄÇø±ðµÄµØ·½


±àÒ룺C³ÌÐòÖ±½Ó±àÒë³É±ê×¼µÄ¶þ½øÖÆ¿ÉÖ´ÐеĴúÂ룬µ«C#µÄÔ´³ÌÐò²¢²»ÊDZ»±àÒë³É¶þ½øÖÆ¿ÉÖ´ÐеÄÐÎʽ£¬¶øÊÇÒ»ÖÖÖмäÓïÑÔ£¨MSIL£©£¬ÀàËÆJAVAÖеÄ×Ö½ÚÂë
½á¹¹Ì壺C#µÄ½á¹¹ÌåÓëC++µÄ½á¹¹ÌåÏàËÆ¡£µ«ÊÇC#µÄ½á¹¹ÌåÓëÀàÊDz»Í¬µÄ£¬¶øÇÒ²»Ö§³Ö¼Ì³Ð¡£
Ô¤±àÒ룺C#ÖдæÔÚÔ¤±àÒëµÄÖ¸ÁîÖ§³ÖÌõ¼þ±àÒ룬¾¯¸æ£¬´íÎ󱨸æºÍ±àÒëÐпØÖÆ¡£ÆäÖ¸Áî ......

[HTML±à¼­Æ÷]C#±àдµÄHTML±à¼­Æ÷£ºÔ­Àíƪ

×÷Õߣº¹â½ÅѾ˼¿¼ ʱ¼ä£º12/23/2009 1:51:00 PM
Ò»¿ªÊ¼¾Í¾õµÃHTML±à¼­Æ÷ÕâÍæÒâÓ¦¸ÃÊǺܸßÉîĪ²âµÄ¡£ËæËæ±ã±ã¾ÍÏëÕûÒ»¸öÓ¦¸Ã²»ÊÇÒ»¼þÈÝÒ×µÄÊÂÇé¡£ºóÀ´¶ÔWebBrowser¿Ø¼þÓÐÁËһЩÁ˽⣬²»¹ý¶¼ÊǺܷôdzµÄÁ˽⡣ֻ֪µÀÓÃÕâ¸ö¿Ø¼þ¾ÍÄܹ»ÔÚ×Ô¼ºµÄ³ÌÐòÖиãÒ»¸öWEBä¯ÀÀÆ÷Ö®ÀàµÄ¶«Î÷£¬´ÓÀ´Ã»ÓÐÏë¹ýHTML±à¼­Æ÷Ò²¿ÉÒÔʹÓÃÕâ¸ö¿Ø¼þÀ´ÊµÏ ......

C#СTip£ºXml²Ù×÷¼òÃ÷ÊÖ²á 2


2£©ÈçºÎ´´½¨Ò»¸öxmlÎĵµ
ÓÉÓÚxmlʵÖÊÒ²Ö»ÊÇÒ»¸öÎı¾Îļþ£¬ËùÒÔ×î¼òµ¥Äã¿ÉÒÔÖ±½ÓʹÓÃSystem.IOϵÄÀàÉú³ÉÒ»¸öÎļþ£¬²¢´æ´¢³ÉxmlÎļþ£¬µ±È»£¬ÄãÐèÒªÊÖ¶¯±£Ö¤¸ÃÎļþÐÎʽÁ¼ºÃ£¬±ÈÈç±ØÐëÓиùÔªËØ¡¢±ØÐëÓйرձêÇ©¡¢±ØÐëÕýȷǶÌ׵ȵȡ£
 
Èç¹ûÄãÀÁµÃ×Ô¼ºÈ¥ÏëÎļþµÄÐÎʽ£¬¿ÉÒÔʹÓÃSystem.XmlϵÄÀà¡£
 
Code
Xml ......

c# Ö§³ÖXMLÐòÁл¯µÄ·ºÐÍ Dictionary

/// <summary>
/// Ö§³ÖXMLÐòÁл¯µÄ·ºÐÍ Dictionary
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
[XmlRoot("SerializableDictionary")]
public class SerializableDictionary<TKey, TValue& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ