¹ØÓÚC#ÖÐtimerÀà ÔÚC#Àï¹ØÓÚ¶¨Ê±Æ÷Àà¾ÍÓÐ3¸ö
1.¶¨ÒåÔÚSystem.Windows.FormsÀï
2.¶¨ÒåÔÚSystem.Threading.TimerÀàÀï
3.¶¨ÒåÔÚSystem.Timers.TimerÀàÀï
System.Windows.Forms.TimerÊÇÓ¦ÓÃÓÚWinFormÖеģ¬ËüÊÇͨ¹ýWindowsÏûÏ¢»úÖÆʵÏֵģ¬ÀàËÆÓÚVB»òDelphiÖеÄTimer¿Ø¼þ£¬ÄÚ²¿Ê¹ÓÃAPI SetTimerʵÏֵġ£ËüµÄÖ÷ҪȱµãÊǼÆʱ²»¾«È·£¬¶øÇÒ±ØÐëÓÐÏûϢѻ·£¬Console Application(¿ØÖÆ̨ӦÓóÌÐò)ÎÞ·¨Ê¹Óá£
System.Timers.TimerºÍSystem.Threading.Timer·Ç³£ÀàËÆ£¬ËüÃÇÊÇͨ¹ý.NET Thread PoolʵÏֵģ¬ÇáÁ¿£¬¼Æʱ¾«È·£¬¶ÔÓ¦ÓóÌÐò¡¢ÏûϢûÓÐÌرðµÄÒªÇó¡£System.Timers.Timer»¹¿ÉÒÔÓ¦ÓÃÓÚWinForm£¬ÍêÈ«È¡´úÉÏÃæµÄTimer¿Ø¼þ¡£ËüÃǵÄȱµãÊDz»Ö§³ÖÖ±½ÓµÄÍÏ·Å£¬ÐèÒªÊÖ¹¤±àÂë¡£
Àý£º
ʹÓÃSystem.Timers.TimerÀà
System.Timers.Timer t = new System.Timers.Timer(10000);//ʵÀý»¯TimerÀ࣬ÉèÖüä¸ôʱ¼äΪ10000ºÁÃ룻
t.Elapsed += new System.Timers ......
´ÓʱàÂë7Äê¶àÁË
¶ÔÓÚjava ºÍc# ÎÒÓÐ×Å×Ô¼ºµÄÀí½â
ÔÚ2009ÄêµÄ9ÔÂÕâ¸öʱ¼äµãÎÒ¿´À´java c#ÊÇÐÂʽÓïÑԵĴú±í
{ÒòΪÎÒÈÏΪ¼ÆËã»úµÄ·¢Õ¹Àú³ÌÊÇ
µÚÒ»½×¶Î ´ò¿×»ú(¶þ½øÖÆ),
µÚ2½×¶Î »ã±à, (±È¶þ½øÖÆ·½±ãµÄÓïÑÔ),
µÚ3½×¶Î c (¸üÒ×ÓÚ¿´Ã÷°×µÄ¸ß¼¶ÓïÑÔ),
µÚ4½×¶ÎµÚ1²ã c++ (´Ó¶ÔÏó½Ç¶ÈÀí½âµÄ¸ß¼¶ÓïÑÔ),
µÚ4½×¶ÎµÚ2²ã java (´Ó¶ÔÏó½Ç¶ÈÀí½âµÄ¸ß¼¶ÓïÑÔ),
µÚ4½×¶ÎµÚ3²ã c# (´Ó¶ÔÏó½Ç¶ÈÀí½âµÄ¸ß¼¶ÓïÑÔ),
¸ù¾ÝµÄÊDZàÂëµÄ·½±ãÐÔ}
¶àƽ̨ÐÔ ²»ÊÇjavaºÍc#×îÖ÷ÒªµÄÁ½¸ö¿´µã
¿´µã1
Ó¦¸ÃÊÇ ´Ó¿ªÊ¼Éè¼Æ,¿ª·¢µ½³ö³ÉÆ· Õâ¸öÖÜÆÚµÄʱ¼ä³¤¶Ì.
ÉèÏëһϠA¹«Ë¾ºÍB¹«Ë¾¾ºÕùÒ»¸öÏîÄ¿
AÓÃjavaÓïÑÔÓÃÁË30Ìì BÓÃC#ÓïÑÔÓÃÁË29Ìì
ÄÄÒ»¸ö¹«Ë¾ÓÐÓÅÊÆ?
¿´µã2 ÊÊÓÃÐÔºÍËÙ¶È
¿¼Âǵ½windowƽ̨ĿǰÔÚÉç»áÉÏÓ¦ÓÃÉϵĹ㷺ÐÔ
java ÔÚ½çÃæºÍµ×²ãÏûÏ¢´¦ÀíÉϵÄÁÓÊƲ»ÈݺöÊÓ
c#ÎÞÒÉÊÇÄ¿Ç°×î¼ÑµÄÑ¡Ôñ(½ö´Ó¿ª·¢window³ÌÐò¶øÑÔ)
Èç¹ûlinux ƽ̨ÉÏÄܹ»Óиü¶àµÄÓÎÏ·Èí¼þ
ÎÒÏëjavaÒ²Ðí¿ÉÒÔÍƹãµÄ¸üºÃһЩ
×îºóÎÒҪ˵µÄÊÇ Êг¡¾ö¶¨Á˹«Ë¾µÄÃüÔË
¹«Ë¾ÓÖ¾ö¶¨×ųÌÐòÔ±µÄÃüÔË
ºó»°
µ±È»¶à½Ó´¥Ð©±à³ÌÓïÑÔ»¹ÊǺõÄ
ÎÒ±¾È˾ÍÊìϤ vb ,delphi ,c,java,c#,asp,jsp ,c#,tsql,pl ......
´ÓʱàÂë7Äê¶àÁË
¶ÔÓÚjava ºÍc# ÎÒÓÐ×Å×Ô¼ºµÄÀí½â
ÔÚ2009ÄêµÄ9ÔÂÕâ¸öʱ¼äµãÎÒ¿´À´java c#ÊÇÐÂʽÓïÑԵĴú±í
{ÒòΪÎÒÈÏΪ¼ÆËã»úµÄ·¢Õ¹Àú³ÌÊÇ
µÚÒ»½×¶Î ´ò¿×»ú(¶þ½øÖÆ),
µÚ2½×¶Î »ã±à, (±È¶þ½øÖÆ·½±ãµÄÓïÑÔ),
µÚ3½×¶Î c (¸üÒ×ÓÚ¿´Ã÷°×µÄ¸ß¼¶ÓïÑÔ),
µÚ4½×¶ÎµÚ1²ã c++ (´Ó¶ÔÏó½Ç¶ÈÀí½âµÄ¸ß¼¶ÓïÑÔ),
µÚ4½×¶ÎµÚ2²ã java (´Ó¶ÔÏó½Ç¶ÈÀí½âµÄ¸ß¼¶ÓïÑÔ),
µÚ4½×¶ÎµÚ3²ã c# (´Ó¶ÔÏó½Ç¶ÈÀí½âµÄ¸ß¼¶ÓïÑÔ),
¸ù¾ÝµÄÊDZàÂëµÄ·½±ãÐÔ}
¶àƽ̨ÐÔ ²»ÊÇjavaºÍc#×îÖ÷ÒªµÄÁ½¸ö¿´µã
¿´µã1
Ó¦¸ÃÊÇ ´Ó¿ªÊ¼Éè¼Æ,¿ª·¢µ½³ö³ÉÆ· Õâ¸öÖÜÆÚµÄʱ¼ä³¤¶Ì.
ÉèÏëһϠA¹«Ë¾ºÍB¹«Ë¾¾ºÕùÒ»¸öÏîÄ¿
AÓÃjavaÓïÑÔÓÃÁË30Ìì BÓÃC#ÓïÑÔÓÃÁË29Ìì
ÄÄÒ»¸ö¹«Ë¾ÓÐÓÅÊÆ?
¿´µã2 ÊÊÓÃÐÔºÍËÙ¶È
¿¼Âǵ½windowƽ̨ĿǰÔÚÉç»áÉÏÓ¦ÓÃÉϵĹ㷺ÐÔ
java ÔÚ½çÃæºÍµ×²ãÏûÏ¢´¦ÀíÉϵÄÁÓÊƲ»ÈݺöÊÓ
c#ÎÞÒÉÊÇÄ¿Ç°×î¼ÑµÄÑ¡Ôñ(½ö´Ó¿ª·¢window³ÌÐò¶øÑÔ)
Èç¹ûlinux ƽ̨ÉÏÄܹ»Óиü¶àµÄÓÎÏ·Èí¼þ
ÎÒÏëjavaÒ²Ðí¿ÉÒÔÍƹãµÄ¸üºÃһЩ
×îºóÎÒҪ˵µÄÊÇ Êг¡¾ö¶¨Á˹«Ë¾µÄÃüÔË
¹«Ë¾ÓÖ¾ö¶¨×ųÌÐòÔ±µÄÃüÔË
ºó»°
µ±È»¶à½Ó´¥Ð©±à³ÌÓïÑÔ»¹ÊǺõÄ
ÎÒ±¾È˾ÍÊìϤ vb ,delphi ,c,java,c#,asp,jsp ,c#,tsql,pl ......
#(¶Á×ö "C sharp")ÊÇ΢Èí¹«Ë¾ÔÚÈ¥ÄêÁùÔ·¢²¼µÄÒ»ÖÖеıà³ÌÓïÑÔ,²¢¶¨ÓÚÔÚ΢ÈíÖ°Òµ¿ª·¢ÕßÂÛ̳(PDC)ÉϵÇ̨ÁÁÏà.C#ÊÇ΢Èí¹«Ë¾Ñо¿Ô±Anders HejlsbergµÄ×îгɹû.C#¿´ÆðÀ´ÓëJavaÓÐמªÈ˵ÄÏàËÆ;Ëü°üÀ¨ÁËÖîÈçµ¥Ò»¼Ì³Ð,½çÃæ,ÓëJava¼¸ºõͬÑùµÄÓï·¨,ºÍ±àÒë³ÉÖмä´úÂëÔÙÔËÐеĹý³Ì.µ«ÊÇC#ÓëJavaÓÐ×ÅÃ÷ÏԵIJ»Í¬,Ëü½è¼øÁËDelphiµÄÒ»¸öÌصã,ÓëCOM(×é¼þ¶ÔÏóÄ£ÐÍ)ÊÇÖ±½Ó¼¯³ÉµÄ,¶øÇÒËüÊÇ΢Èí¹«Ë¾.NET windowsÍøÂç¿ò¼ÜµÄÖ÷½Ç.
¡¡¡¡Î¢Èíc#ÓïÑÔ¶¨ÒåÖ÷ÒªÊÇ´ÓCºÍC++¼Ì³Ð¶øÀ´µÄ,¶øÇÒÓïÑÔÖеÄÐí¶àÔªËØÒ²·´Ó³ÁËÕâÒ»µã.C#ÔÚÉè¼ÆÕß´ÓC++¼Ì³ÐµÄ¿ÉÑ¡Ñ¡Ïî·½Ãæ±ÈJavaÒª¹ã·ºÒ»Ð©(±ÈÈç˵structs),Ëü»¹Ôö¼ÓÁË×Ô¼ºÐµÄÌصã(±È·½ËµÔ´´úÂë°æ±¾¶¨Òå).µ«Ëü»¹Ì«²»³ÉÊì,²»¿ÉÄܼ·¿åJava.C#»¹ÐèÒª½ø»¯³ÉÒ»ÖÖ¿ª·¢ÕßÄܹ»½ÓÊܺͲÉÓõÄÓïÑÔ.¶ø΢Èíµ±Ç°ÎªËüµÄÕâÖÖÐÂÓïÑÔ´óÔìÉùÊÆÒ²ÊÇÖµµÃ×¢ÒâµÄ.Ä¿Ç°´ó¼ÒµÄ·´Ó¦ÊÇ:"ÕâÊǶÔJavaµÄ·´»÷."
¡¡¡¡C#¸üÏóJavaһЩ,ËäȻ΢ÈíÔÚÕâ¸öÎÊÌâÉϱ£³Ö³ÁĬ.ÕâÒ²ÊÇÒâÁÏÖеÄÊÂÇé,ÎÒ¾õµÃ,ÒòΪJava½üÀ´ºÜ³É¹¦¶øʹÓÃJavaµÄ¹«Ë¾¶¼±¨¸æ˵ËüÃÇÔÚÉú²úЧÂÊÉϱÈC++»ñµÃÁËÌá¸ß.
¡¡¡¡JavaËù´øÀ´µÄ¾Þ´óÓ°ÏìºÍ´ó¼Ò¶ÔËüµÄ¹ã·º½ÓÊÜÒѾÓɹ¤×÷ÓÚÕâÖÖÓïÑÔºÍƽ̨֮ÉϵijÌÐòÔ±ÊýÁ¿Ã÷ÏÔµÄ˵Ã÷ÁË(¹À¼ÆÊÀ½ç·¶Î§ÄÚ¹²ÓÐ ......
#(¶Á×ö "C sharp")ÊÇ΢Èí¹«Ë¾ÔÚÈ¥ÄêÁùÔ·¢²¼µÄÒ»ÖÖеıà³ÌÓïÑÔ,²¢¶¨ÓÚÔÚ΢ÈíÖ°Òµ¿ª·¢ÕßÂÛ̳(PDC)ÉϵÇ̨ÁÁÏà.C#ÊÇ΢Èí¹«Ë¾Ñо¿Ô±Anders HejlsbergµÄ×îгɹû.C#¿´ÆðÀ´ÓëJavaÓÐמªÈ˵ÄÏàËÆ;Ëü°üÀ¨ÁËÖîÈçµ¥Ò»¼Ì³Ð,½çÃæ,ÓëJava¼¸ºõͬÑùµÄÓï·¨,ºÍ±àÒë³ÉÖмä´úÂëÔÙÔËÐеĹý³Ì.µ«ÊÇC#ÓëJavaÓÐ×ÅÃ÷ÏԵIJ»Í¬,Ëü½è¼øÁËDelphiµÄÒ»¸öÌصã,ÓëCOM(×é¼þ¶ÔÏóÄ£ÐÍ)ÊÇÖ±½Ó¼¯³ÉµÄ,¶øÇÒËüÊÇ΢Èí¹«Ë¾.NET windowsÍøÂç¿ò¼ÜµÄÖ÷½Ç.
¡¡¡¡Î¢Èíc#ÓïÑÔ¶¨ÒåÖ÷ÒªÊÇ´ÓCºÍC++¼Ì³Ð¶øÀ´µÄ,¶øÇÒÓïÑÔÖеÄÐí¶àÔªËØÒ²·´Ó³ÁËÕâÒ»µã.C#ÔÚÉè¼ÆÕß´ÓC++¼Ì³ÐµÄ¿ÉÑ¡Ñ¡Ïî·½Ãæ±ÈJavaÒª¹ã·ºÒ»Ð©(±ÈÈç˵structs),Ëü»¹Ôö¼ÓÁË×Ô¼ºÐµÄÌصã(±È·½ËµÔ´´úÂë°æ±¾¶¨Òå).µ«Ëü»¹Ì«²»³ÉÊì,²»¿ÉÄܼ·¿åJava.C#»¹ÐèÒª½ø»¯³ÉÒ»ÖÖ¿ª·¢ÕßÄܹ»½ÓÊܺͲÉÓõÄÓïÑÔ.¶ø΢Èíµ±Ç°ÎªËüµÄÕâÖÖÐÂÓïÑÔ´óÔìÉùÊÆÒ²ÊÇÖµµÃ×¢ÒâµÄ.Ä¿Ç°´ó¼ÒµÄ·´Ó¦ÊÇ:"ÕâÊǶÔJavaµÄ·´»÷."
¡¡¡¡C#¸üÏóJavaһЩ,ËäȻ΢ÈíÔÚÕâ¸öÎÊÌâÉϱ£³Ö³ÁĬ.ÕâÒ²ÊÇÒâÁÏÖеÄÊÂÇé,ÎÒ¾õµÃ,ÒòΪJava½üÀ´ºÜ³É¹¦¶øʹÓÃJavaµÄ¹«Ë¾¶¼±¨¸æ˵ËüÃÇÔÚÉú²úЧÂÊÉϱÈC++»ñµÃÁËÌá¸ß.
¡¡¡¡JavaËù´øÀ´µÄ¾Þ´óÓ°ÏìºÍ´ó¼Ò¶ÔËüµÄ¹ã·º½ÓÊÜÒѾÓɹ¤×÷ÓÚÕâÖÖÓïÑÔºÍƽ̨֮ÉϵijÌÐòÔ±ÊýÁ¿Ã÷ÏÔµÄ˵Ã÷ÁË(¹À¼ÆÊÀ½ç·¶Î§ÄÚ¹²ÓÐ ......
#(¶Á×ö "C sharp")ÊÇ΢Èí¹«Ë¾ÔÚÈ¥ÄêÁùÔ·¢²¼µÄÒ»ÖÖеıà³ÌÓïÑÔ,²¢¶¨ÓÚÔÚ΢ÈíÖ°Òµ¿ª·¢ÕßÂÛ̳(PDC)ÉϵÇ̨ÁÁÏà.C#ÊÇ΢Èí¹«Ë¾Ñо¿Ô±Anders HejlsbergµÄ×îгɹû.C#¿´ÆðÀ´ÓëJavaÓÐמªÈ˵ÄÏàËÆ;Ëü°üÀ¨ÁËÖîÈçµ¥Ò»¼Ì³Ð,½çÃæ,ÓëJava¼¸ºõͬÑùµÄÓï·¨,ºÍ±àÒë³ÉÖмä´úÂëÔÙÔËÐеĹý³Ì.µ«ÊÇC#ÓëJavaÓÐ×ÅÃ÷ÏԵIJ»Í¬,Ëü½è¼øÁËDelphiµÄÒ»¸öÌصã,ÓëCOM(×é¼þ¶ÔÏóÄ£ÐÍ)ÊÇÖ±½Ó¼¯³ÉµÄ,¶øÇÒËüÊÇ΢Èí¹«Ë¾.NET windowsÍøÂç¿ò¼ÜµÄÖ÷½Ç.
¡¡¡¡Î¢Èíc#ÓïÑÔ¶¨ÒåÖ÷ÒªÊÇ´ÓCºÍC++¼Ì³Ð¶øÀ´µÄ,¶øÇÒÓïÑÔÖеÄÐí¶àÔªËØÒ²·´Ó³ÁËÕâÒ»µã.C#ÔÚÉè¼ÆÕß´ÓC++¼Ì³ÐµÄ¿ÉÑ¡Ñ¡Ïî·½Ãæ±ÈJavaÒª¹ã·ºÒ»Ð©(±ÈÈç˵structs),Ëü»¹Ôö¼ÓÁË×Ô¼ºÐµÄÌصã(±È·½ËµÔ´´úÂë°æ±¾¶¨Òå).µ«Ëü»¹Ì«²»³ÉÊì,²»¿ÉÄܼ·¿åJava.C#»¹ÐèÒª½ø»¯³ÉÒ»ÖÖ¿ª·¢ÕßÄܹ»½ÓÊܺͲÉÓõÄÓïÑÔ.¶ø΢Èíµ±Ç°ÎªËüµÄÕâÖÖÐÂÓïÑÔ´óÔìÉùÊÆÒ²ÊÇÖµµÃ×¢ÒâµÄ.Ä¿Ç°´ó¼ÒµÄ·´Ó¦ÊÇ:"ÕâÊǶÔJavaµÄ·´»÷."
¡¡¡¡C#¸üÏóJavaһЩ,ËäȻ΢ÈíÔÚÕâ¸öÎÊÌâÉϱ£³Ö³ÁĬ.ÕâÒ²ÊÇÒâÁÏÖеÄÊÂÇé,ÎÒ¾õµÃ,ÒòΪJava½üÀ´ºÜ³É¹¦¶øʹÓÃJavaµÄ¹«Ë¾¶¼±¨¸æ˵ËüÃÇÔÚÉú²úЧÂÊÉϱÈC++»ñµÃÁËÌá¸ß.
¡¡¡¡JavaËù´øÀ´µÄ¾Þ´óÓ°ÏìºÍ´ó¼Ò¶ÔËüµÄ¹ã·º½ÓÊÜÒѾÓɹ¤×÷ÓÚÕâÖÖÓïÑÔºÍƽ̨֮ÉϵijÌÐòÔ±ÊýÁ¿Ã÷ÏÔµÄ˵Ã÷ÁË(¹À¼ÆÊÀ½ç·¶Î§ÄÚ¹²ÓÐ ......
#(¶Á×ö "C sharp")ÊÇ΢Èí¹«Ë¾ÔÚÈ¥ÄêÁùÔ·¢²¼µÄÒ»ÖÖеıà³ÌÓïÑÔ,²¢¶¨ÓÚÔÚ΢ÈíÖ°Òµ¿ª·¢ÕßÂÛ̳(PDC)ÉϵÇ̨ÁÁÏà.C#ÊÇ΢Èí¹«Ë¾Ñо¿Ô±Anders HejlsbergµÄ×îгɹû.C#¿´ÆðÀ´ÓëJavaÓÐמªÈ˵ÄÏàËÆ;Ëü°üÀ¨ÁËÖîÈçµ¥Ò»¼Ì³Ð,½çÃæ,ÓëJava¼¸ºõͬÑùµÄÓï·¨,ºÍ±àÒë³ÉÖмä´úÂëÔÙÔËÐеĹý³Ì.µ«ÊÇC#ÓëJavaÓÐ×ÅÃ÷ÏԵIJ»Í¬,Ëü½è¼øÁËDelphiµÄÒ»¸öÌصã,ÓëCOM(×é¼þ¶ÔÏóÄ£ÐÍ)ÊÇÖ±½Ó¼¯³ÉµÄ,¶øÇÒËüÊÇ΢Èí¹«Ë¾.NET windowsÍøÂç¿ò¼ÜµÄÖ÷½Ç.
¡¡¡¡Î¢Èíc#ÓïÑÔ¶¨ÒåÖ÷ÒªÊÇ´ÓCºÍC++¼Ì³Ð¶øÀ´µÄ,¶øÇÒÓïÑÔÖеÄÐí¶àÔªËØÒ²·´Ó³ÁËÕâÒ»µã.C#ÔÚÉè¼ÆÕß´ÓC++¼Ì³ÐµÄ¿ÉÑ¡Ñ¡Ïî·½Ãæ±ÈJavaÒª¹ã·ºÒ»Ð©(±ÈÈç˵structs),Ëü»¹Ôö¼ÓÁË×Ô¼ºÐµÄÌصã(±È·½ËµÔ´´úÂë°æ±¾¶¨Òå).µ«Ëü»¹Ì«²»³ÉÊì,²»¿ÉÄܼ·¿åJava.C#»¹ÐèÒª½ø»¯³ÉÒ»ÖÖ¿ª·¢ÕßÄܹ»½ÓÊܺͲÉÓõÄÓïÑÔ.¶ø΢Èíµ±Ç°ÎªËüµÄÕâÖÖÐÂÓïÑÔ´óÔìÉùÊÆÒ²ÊÇÖµµÃ×¢ÒâµÄ.Ä¿Ç°´ó¼ÒµÄ·´Ó¦ÊÇ:"ÕâÊǶÔJavaµÄ·´»÷."
¡¡¡¡C#¸üÏóJavaһЩ,ËäȻ΢ÈíÔÚÕâ¸öÎÊÌâÉϱ£³Ö³ÁĬ.ÕâÒ²ÊÇÒâÁÏÖеÄÊÂÇé,ÎÒ¾õµÃ,ÒòΪJava½üÀ´ºÜ³É¹¦¶øʹÓÃJavaµÄ¹«Ë¾¶¼±¨¸æ˵ËüÃÇÔÚÉú²úЧÂÊÉϱÈC++»ñµÃÁËÌá¸ß.
¡¡¡¡JavaËù´øÀ´µÄ¾Þ´óÓ°ÏìºÍ´ó¼Ò¶ÔËüµÄ¹ã·º½ÓÊÜÒѾÓɹ¤×÷ÓÚÕâÖÖÓïÑÔºÍƽ̨֮ÉϵijÌÐòÔ±ÊýÁ¿Ã÷ÏÔµÄ˵Ã÷ÁË(¹À¼ÆÊÀ½ç·¶Î§ÄÚ¹²ÓÐ ......
ÎÄ / À£¨¹âÓî¹ãÕ꣩
·½·¨¶à̬ÓëÀàÐͶà̬
Á˽â OOP µÄͬѧ¶ÔÀàÐͶà̬¶¼ºÜÊìϤÁË¡£»°Ëµ£¬ÀàÐͶà̬֮¶à̬±ãÌåÏÖÔÚ·½·¨ÉÏ£¬ÄÇ·½·¨¶à̬ÓÖÊÇÂïÍæ¶ù£¿ÀàÐͶà̬֮ÀàÐÍÖ¸µÄÊǶÔÏñµÄÀàÐÍ£¬Æä·½·¨ÊÇÊܶÔÏñÔ¼ÊøµÄ¡£·½·¨¶à̬±ãÊDz»ÊܶÔÏñÀàÐÍÔ¼ÊøµÄ¶à̬¡£¾ßÌåÇø±ðÔÚ£º
·½·¨¶à̬ÎÞÐè¼Ì³Ð£»ÀàÐͶà̬±ØÐëʵÏÖ½Ó¿Ú»òÀà¼Ì³Ð¡£
·½·¨¶à̬²»¹ÜÄãÊÇË£¬Ö»ÔÚºõÄãÄܸÉÂÀàÐͶà̬½²¾¿Äã³ö×ÔºÎÃźÎÅÉ¡£
·½·¨¶à̬µÄ¶ÔÏñ¼æÈÝÐÔÖ»ÐèÆäʵÏÖÔËÐÐÆÚ±»Êµ¼Êµ÷Óõķ½·¨²¿·Ö£»ÀàÐͶà̬µÄ¶ÔÏñ¼æÈÝÐÔÒªÇó A is-a B£¬Ò²¼´²»¹ÜÓõÃ×ÅÓò»×Å£¬Ö»ÒªÄã°ÝÁËʦ¸µ£¬¾ÍµÃÈ«²¿ÊµÏÖ¡£
Duck typing Óë·½·¨¶à̬
Duck typing ÊÇÖÖ¶¯Ì¬ÓïÑԵijÌÐòÉè¼Æ·ç¸ñ£¬ÓÃÒÔʵ¼ù·½·¨¶à̬¡£¸ÅÄîÌá³öÕß James Whitcomb Riley ͬѧÈçÊÇ˵£º
µ±¿´µ½Ò»Ö»Äñ×ßÆðÀ´ÏñѼ×Ó£¬ÓÎÆðÓ¾À´ÏñѼ×Ó£¬½ÐÆðÀ´Ò²ÏñѼ×Ó£¬ÄÇÕâÖ»Äñ¾Í¿ÉÒÔ±»µ±×öѼ×Ó¡£
Duck typing ²¢²»¹Ø×¢¶ÔÏñµÄÀàÐÍ£¬¶øÊǹØ×¢Æä±íÏÖ¡£ÎÒÃÇÈÃij¸ö¶ÔÏñÈ¥“×ßÁ½²½¶ù”£¬È¥“ÓÎÁ½Ï”£¬È¥“½ ......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
using System.Net;
/// <summary>
/// EmailPost µÄժҪ˵Ã÷
/// </summary>
public class EmailPost
{
public EmailPost()
{
//
// TODO: ÔÚ´Ë´¦Ìí¼Ó¹¹Ô캯ÊýÂß¼
//
}
public static string PostEmail(string MailTitle,string MailBody,string RequestEmail)
{
string Poster = "****@163.com"; //·¢ËÍÕßÓÊÏäµØÖ·
string PosterPwd = "********";//·¢ËÍÕßÓÊÏäÃÜÂë
......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
using System.Net;
/// <summary>
/// EmailPost µÄժҪ˵Ã÷
/// </summary>
public class EmailPost
{
public EmailPost()
{
//
// TODO: ÔÚ´Ë´¦Ìí¼Ó¹¹Ô캯ÊýÂß¼
//
}
public static string PostEmail(string MailTitle,string MailBody,string RequestEmail)
{
string Poster = "****@163.com"; //·¢ËÍÕßÓÊÏäµØÖ·
string PosterPwd = "********";//·¢ËÍÕßÓÊÏäÃÜÂë
......
protected void Button6_Click(object sender, EventArgs e)
{
this.Label11.Text = HtmlEncode(this.TextBox3.Text);
}
protected static string HtmlEncode(string the)
{
the = the.Replace("<", "<");
the = the.Replace(" ", " ");
the = the.Replace("\"", """);
the = the.Replace("\'", "'");
the = the.Replace("\n", "<br/> ");
return the;
}
ͨ¹ýÔÚ Page Ö¸Áî»ò ÅäÖýÚÖÐÉèÖà validateRequest=false
¾ÍÊÇÔÚÒ³ÃæÖмÓÈë
<%@page validateRequest=false %> ......
protected void Button6_Click(object sender, EventArgs e)
{
this.Label11.Text = HtmlEncode(this.TextBox3.Text);
}
protected static string HtmlEncode(string the)
{
the = the.Replace("<", "<");
the = the.Replace(" ", " ");
the = the.Replace("\"", """);
the = the.Replace("\'", "'");
the = the.Replace("\n", "<br/> ");
return the;
}
ͨ¹ýÔÚ Page Ö¸Áî»ò ÅäÖýÚÖÐÉèÖà validateRequest=false
¾ÍÊÇÔÚÒ³ÃæÖмÓÈë
<%@page validateRequest=false %> ......