C#³ÌÐòʵÏÖ¶¯Ì¬µ÷ÓÃDLLµÄÑо¿
¡¾ÆªÊ×Óï¡¿Æäʵ±¾ÎĽéÉܵķ½·¨ÊÇÒ»¸ö˼·£¬µ«ÊÇÎҸоõ°ÉÎÊÌâ¸ã¸´ÔÓÁË¡£ÀÏÍâµÄÕâ¸öC#µ÷ÓÃC++µÄdll·½Ê½Í¦ºÃµÄ£¬Ò²ºÜÎȶ¨£¬¿ÉÒÔ¿´¿´http://www.codeproject.com/KB/cs/DynamicInvokeCSharp.aspx¡£
Õª Òª£ºÔÚ¡¶csdn¿ª·¢¸ßÊÖ¡·2004ÄêµÚ03ÆÚÖеġ¶»¯¹¦´ó·¨ ——½«DLLǶÈëEXE¡·Ò»ÎÄ£¬½éÉÜÁËÈçºÎ°ÑÒ»¸ö¶¯Ì¬Á´½Ó¿â×÷Ϊһ¸ö×ÊԴǶÈëµ½¿ÉÖ´ÐÐÎļþ£¬ÔÚ¿ÉÖ´ÐÐÎļþÔËÐÐʱ£¬×Ô¶¯´Ó×ÊÔ´ÖÐÊͷųöÀ´£¬Í¨¹ý¾²Ì¬¼ÓÔØÑÓ³ÙʵÏ֣ģ̣̺¯ÊýµÄ¶¯Ì¬¼ÓÔØ£¬³ÌÐòÍ˳öºóʵÏÖÁÙʱÎļþµÄ×Ô¶¯É¾³ý£¬´Ó¶øΪ½â¾ö“DLL Hell”ÌṩÁËÒ»ÖÖ½â¾ö·½°¸¡£ÕâÊÇÒ»¸öºÜºÃµÄÉè¼Æ˼Ï룬¶øÇÒ¸Ã×÷ÕßÒ²ÓÃC++ʵÏÖÁË£¬ÔÚInternetÉÏÒ²ÓÐÏàËƵÄVB³ÌÐò£¬µ«ÔÚijһ¼¼ÊõÂÛ̳ÉÏÌáÆðÕâÖÖÉè¼Æ·½·¨Ê±£¬ÓÐÍøÓÑÌá³ö£º“ÕâÖÖ·½·¨ºÃÊǺ㬵«¾ÍÊÇÆô¶¯ËÙ¶ÈÌ«Âý”¡£ÕâÊÇÒòΪ³ÌÐòÆô¶¯Ê±ÊµÏÖDLLÊÍ·Å£¬È»ºóÔÙ¼ÓÔØÊͷųöÀ´µÄDLL£¬Õâ¸ö¹ý³Ì»áºÄ·ÑÒ»¶¨µÄʱ¼ä¡£¼øÓÚ´ËÎÊÌ⣬¾¹ý˼Ë÷£¬Ìá³öÁíÒ»¸öÉè¼Æ·½°¸£ºDLL×÷Ϊ×ÊÔ´ÎļþǶÈë³ÌÐò£¬µ«²»Ðè½øÐÐDLLÊͷż°ÆäÖØмÓÔØ¡£±¾ÎľÍÊǶԸÃÉè¼Æ·½°¸µÄÔÀí·ÖÎö¼°Ê¹ÓÃC#±à³ÌÀ´ÊµÏÖ¸ÃÉè¼Æ·½°¸¡£
¹Ø¼ü´Ê£º¶¯Ì¬µ÷ÓÃDLL£¬Ç¶ÈëDLL£¬C#
Õý ÎÄ£º
Ò»¡¢
DLL
ÓëÓ¦ÓóÌÐò
¶¯Ì¬Á´½Ó¿â£¨Ò²³ÆΪDLL£¬¼´Îª“Dynamic Link Library”µÄËõд£©ÊÇMicrosoft Windows×îÖØÒªµÄ×é³ÉÒªËØÖ®Ò»£¬´ò¿ªWindowsϵͳÎļþ¼Ð£¬Äã»á·¢ÏÖÎļþ¼ÐÖÐÓкܶàDLLÎļþ£¬Windows¾ÍÊǽ«Ò»Ð©Ö÷ÒªµÄϵͳ¹¦ÄÜÒÔDLLÄ£¿éµÄÐÎʽʵÏÖ¡£
¶¯Ì¬Á´½Ó¿âÊDz»ÄÜÖ±½ÓÖ´Ðеģ¬Ò²²»ÄܽÓÊÕÏûÏ¢£¬ËüÖ»ÊÇÒ»¸ö¶ÀÁ¢µÄÎļþ£¬ÆäÖаüº¬Äܱ»³ÌÐò»òÆäËüDLLµ÷ÓÃÀ´Íê³ÉÒ»¶¨²Ù×÷µÄº¯Êý(·½·¨¡£×¢£ºC#ÖÐÒ»°ã³ÆΪ“·½·¨”)£¬µ«ÕâЩº¯Êý²»ÊÇÖ´ÐгÌÐò±¾ÉíµÄÒ»²¿·Ö£¬¶øÊǸù¾Ý½ø³ÌµÄÐèÒª°´ÐèÔØÈ룬´Ëʱ²ÅÄÜ·¢»Ó×÷Óá£
DLLÖ»ÓÐÔÚÓ¦ÓóÌÐòÐèҪʱ²Å±»ÏµÍ³¼ÓÔص½½ø³ÌµÄÐéÄâ¿Õ¼äÖУ¬³ÉΪµ÷Óýø³ÌµÄÒ»²¿·Ö£¬´Ëʱ¸ÃDLLÒ²Ö»Äܱ»¸Ã½ø³ÌµÄÏ̷߳ÃÎÊ£¬ËüµÄ¾ä±ú¿ÉÒÔ±»µ÷Óýø³ÌËùʹÓ㬶øµ÷Óýø³ÌµÄ¾ä±úÒ²¿ÉÒÔ±»¸ÃDLLËùʹÓá£ÔÚÄÚ´æÖУ¬Ò»¸öDLLÖ»ÓÐÒ»¸öʵÀý£¬ÇÒËüµÄ±àÖÆÓë¾ßÌåµÄ±à³ÌÓïÑԺͱàÒëÆ÷¶¼Ã»ÓйØϵ£¬ËùÒÔ¿ÉÒÔͨ¹ýDLLÀ´ÊµÏÖ»ìºÏÓïÑÔ±à³Ì¡£DLLº¯ÊýÖеĴúÂëËù´´½¨µÄÈκζÔÏ󣨰üÀ¨±äÁ¿£©¶¼¹éµ÷ÓÃËüµÄÏ̻߳ò½ø³ÌËùÓС£
ÏÂÃæÁгöÁ˵±³ÌÐòʹÓà DLL ʱÌṩµÄһЩÓŵ㣺[1]
1)
ʹÓýÏÉÙµÄ×ÊÔ´
µ±¶à¸ö³ÌÐòʹÓÃͬһ¸öº¯Êý¿âʱ£¬DLL ¿ÉÒÔ¼õÉÙÔÚ´ÅÅ̺ÍÎïÀíÄÚ´æÖмÓÔصĴúÂëµÄÖظ´Á¿¡£Õâ²»½ö¿ÉÒÔ´ó´óÓ°ÏìÔÚǰ̨ÔËÐеijÌÐò£¬¶øÇÒ¿ÉÒÔ´
Ïà¹ØÎĵµ£º
½ñÌì×öÏîÄ¿µÄʱºò£¬½«null´«ÈëOracleµÄ±íÖУ¬¾ÍÊDz»³É¹¦
¾¹ý³¢ÊԵóöÁËÁ½¸ö½â¾ö·½°¸£º
1.´«ÈëOracleDateTime.NULL
2.Nullable<DateTime> optime = DBNull.Value; ´«Èëoptime(¿ªÊ¼ÍøÉÏÕҵĴð°¸ÊÇNullable<DateTime> optime = null·¢ÏÖ»¹Êǻᱨ´í) ......
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.Data.OleDb;
/// <summary>
/// Data ......
н¨Ò»¸öרÃÅÓÃÀ´´´½¨ÑéÖ¤ÂëͼƬµÄÒ³ÃæValidateCode.aspx
ËüµÄºǫ́csÎļþ´úÂëÈçÏ£º
PageLoad
private void Page_Load(object sender, System.EventArgs e)
{
string checkCode = CreateRandomCode(4);
Session["CheckCode"] = checkCode;
CreateImage(checkCode);
......
//ÒÔÏÂÀ´×Ô:http://msdn.microsoft.com/zh-cn/library/sf985hc5.aspx
abstract£¨C# ²Î¿¼£©
¸üУº2007 Äê 11 ÔÂ
abstract ÐÞÊηû¿ÉÒÔºÍÀà¡¢·½·¨¡¢ÊôÐÔ¡¢Ë÷ÒýÆ÷¼°Ê¼þÒ»ÆðʹÓá£ÔÚÀàÉùÃ÷ÖÐʹÓà abstract ÐÞÊηûÒÔָʾij¸öÀàÖ»ÄÜÊÇÆäËûÀàµÄ»ùÀà¡£±ê¼ÇΪ³éÏó»ò°üº¬ÔÚ³éÏóÀàÖеijÉÔ±±ØÐëͨ¹ý´Ó³éÏóÀàÅÉÉúµÄÀàÀ´ÊµÏÖ¡£
ʾÀý ......
±¾ÊéÊÇ΢Èí¼¼ÊõÅàѵͳ±à½Ì²ÄÖ®Ò»£¬¶Ô±à³ÌÓïÑÔC#½øÐÐÁËÏêϸµÄ½éÉÜ¡£ C#ÊÇ»ùÓÚ΢ÈíÏÂÒ»´ú²Ù×÷ƽ̨£®NETµÄȫеÄÃæÏò¶ÔÏóµÄ³ÌÐòÉè¼ÆÓïÑÔ¡£ËüÔÚ±£³ÖÁËC+ÖÐÊìϤµÄÓï·¨µÄͬʱ£¬Ìí¼ÓÁË´óÁ¿µÄ¸ßЧ´úÂëºÍÍêÈ«ÃæÏò¶ÔÏóÌØÐÔ£¬ÒÔ¼°¸ü¸ßµÄ¿É¿¿ÐԺͰ²È«ÐÔ¡£C#ÓïÑÔ½«ÔÚ±£³ÖC£¯C++Áé»îÐԵĻù´¡ÉÏΪ³ÌÐòÔ±´øÀ´¸ü¸ßЧµÄ¿ª·¢·½Ê½¡£Ëü²»½öÄÜÓÃÓ ......