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

C#»ñÈ¡µ±Ç°Â·¾¶µÄ·½·¨

//»ñÈ¡°üº¬Çåµ¥µÄÒѼÓÔØÎļþµÄ·¾¶»ò UNC λÖá£
public static string sApplicationPath = Assembly.GetExecutingAssembly ( ).Location;
//result: X:\xxx\xxx\xxx.dll (.dllÎļþËùÔÚµÄĿ¼+.dllÎļþÃû)
//»ñÈ¡µ±Ç°½ø³ÌµÄÍêÕû·¾¶£¬°üº¬ÎļþÃû(½ø³ÌÃû)¡£
string str = this.GetType ( ).Assembly.Location;
//result: X:\xxx\xxx\xxx.exe (.exeÎļþËùÔÚµÄĿ¼+.exeÎļþÃû)
//»ñÈ¡Ð嵀 Process ×é¼þ²¢½«ÆäÓ뵱ǰ»î¶¯µÄ½ø³Ì¹ØÁªµÄÖ÷Ä£¿éµÄÍêÕû·¾¶£¬°üº¬ÎļþÃû(½ø³ÌÃû)¡£
string str = System.Diagnostics.Process.GetCurrentProcess ( ).MainModule.FileName;
//result: X:\xxx\xxx\xxx.exe (.exeÎļþËùÔÚµÄĿ¼+.exeÎļþÃû)
//»ñÈ¡ºÍÉèÖõ±Ç°Ä¿Â¼£¨¼´¸Ã½ø³Ì´ÓÖÐÆô¶¯µÄĿ¼£©µÄÍêÈ«ÏÞ¶¨Â·¾¶¡£
string str = System.Environment.CurrentDirectory;
//result: X:\xxx\xxx (.exeÎļþËùÔÚµÄĿ¼)
//»ñÈ¡µ±Ç° Thread µÄµ±Ç°Ó¦ÓóÌÐòÓòµÄ»ùĿ¼£¬ËüÓɳÌÐò¼¯³åÍ»½â¾ö³ÌÐòÓÃÀ´Ì½²â³ÌÐò¼¯¡£
string str = System.AppDomain.CurrentDomain.BaseDirectory;
//result: X:\xxx\xxx\ (.exeÎļþËùÔÚµÄĿ¼+"\")
//»ñÈ¡ºÍÉèÖðüº¬¸ÃÓ¦ÓóÌÐòµÄĿ¼µÄÃû³Æ¡£
string str = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
//result: X:\xxx\xxx\ (.exeÎļþËùÔÚµÄĿ¼+"\")
//»ñÈ¡Æô¶¯ÁËÓ¦ÓóÌÐòµÄ¿ÉÖ´ÐÐÎļþµÄ·¾¶£¬²»°üÀ¨¿ÉÖ´ÐÐÎļþµÄÃû³Æ¡£
string str = System.Windows.Forms.Application.StartupPath;
//result: X:\xxx\xxx (.exeÎļþËùÔÚµÄĿ¼)
//»ñÈ¡Æô¶¯ÁËÓ¦ÓóÌÐòµÄ¿ÉÖ´ÐÐÎļþµÄ·¾¶£¬°üÀ¨¿ÉÖ´ÐÐÎļþµÄÃû³Æ¡£
string str = System.Windows.Forms.Application.ExecutablePath;
//result: X:\xxx\xxx\xxx.exe (.exeÎļþËùÔÚµÄĿ¼+.exeÎļþÃû)
//»ñÈ¡Ó¦ÓóÌÐòµÄµ±Ç°¹¤×÷Ŀ¼(²»¿É¿¿)¡£
string str = System.IO.Directory.GetCurrentDirectory ( );
//result: X:\xxx\xxx (.exeÎļþËùÔÚµÄĿ¼)
//ÔÚϵͳ·þÎñÖÐ×îºÃÓÃÕâ¸ö·½Ê½È¥È¡Â·¾¶
string stmp = Assembly.GetExecutingAssembly ( ).Location;
stmp = stmp.Substring ( 0 , stmp.LastIndexOf ( '\\' ) );//ɾ³ýÎļþÃû
if ( pathType == 1 )
return stmp + @"\inputLog.xml";
else if ( pathType == 2 )
return stmp + @"\MiddleDB.xml";
else
return stmp + @"\AppNo.xml";
using System.IO;
string path = "d:asdfasdf.bmp";
string fileNam


Ïà¹ØÎĵµ£º

C#²Ù×÷xml

ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
ÐèÒªÌí¼ÓµÄÃüÃû¿Õ¼ä£º
using System.Xml;
¶¨Ò弸¸ö¹«¹²¶ÔÏó£º
XmlDocument xmldoc ;
XmlNode xmlnode ;
XmlElement xmlelem ;
1£¬´´½¨µ½·þÎñÆ÷ͬÃûĿ¼ÏµÄxmlÎļþ£º
·½·¨Ò»£º
xmldoc = new XmlDocument ( ) ;
//¼ÓÈëXMLµÄÉùÃ÷¶ÎÂä
xmlnode = xmldoc.CreateNode ( XmlNodeType.XmlDeclara ......

C#½çÃæÃÀ»¯ÍƼöDotNetBar

DotNetBarÕýʽ°æ8.4.0.2£¬Í¨¹ýÖйú¿Ø¼þÍø²É¹º¡£ÓëÊÔÓðæÓÐÃ÷ÏÔµÄÇø±ð¡£Ö÷ÒªÊÇÆô¶¯Ëٶȣ¬Õýʽ°æÆô¶¯ËٶȺܿ졣ÁíÍâÓиöÎÊÌâÌáÐÑ´ó¼Ò¡£
1¡¢ÔÚ¹¤¾ßÀ¸ÖÐÌí¼ÓÊúÌõ£¬ÔÚDotNetBarÖÐÖ»Ð轫ÐèÒªÌí¼ÓÕâ¸öÊúÌõºóÃæµÄ¿Ø¼þµÄBeginGroupÊôÐÔΪtrue¼´¿É¡£
2¡¢ComboBoxItem£¬Ê¹Óᣵ±DropDownStyleΪDropDownʱ£¬²»ÄÜÔÚÉè¼Æ½çÃæÌí¼Óitem·ñ ......

C#¶àÏß³ÌÓëUIÏìÓ¦

Èí¼þ½çÃæµÄÏìÓ¦ÌØÐÔÊÇÅжÏÒ»¿îÈí¼þµÄ·Ç³£ÖØÒªµÄ·½Ãæ¡£Ò»°ãÀ´Ëµ£¬²»¹ÜÄãÈí¼þ¹¦ÄÜ×öµÃÓжàôÆæÃÈç¹ûÈí¼þÓÐÒ»µãµãËÀ»úµÄ¸Ð¾õ¶¼»áÈÃÓû§¸Ðµ½ºÜÌÖÑᣬÉõÖÁ»³ÒÉÄãÈí¼þÀïÊÇ·ñ²ØÓиü´óµÄÎÊÌâ¡£
ÒªÌá¸ß½çÃæµÄÏìÓ¦ÌØÐÔ£¬×îºÃµÄ°ì·¨Äª¹ýÓÚʹÓöàỊ̈߳¬²¢°Ñ³ÊÏÖ½çÃæµÄÏ̶߳ÀÁ¢³öÀ´¡£ÒÔÇ°Ö»ÓÐʹÓÃC++²ÅÄÜʵÏֵĶàÏ̹߳¦ÄÜ£¬ÏÖÔÚÔÚ.Ne ......

ÔÚC#.netÖÐÈçºÎ²Ù×÷XML


ÔÚC#.netÖÐÈçºÎ²Ù×÷XML
¿ÉÄܺܶàÅóÓÑ»¹Ã»ÓнøÐйýXML²Ù×÷,Ï£ÍûÏÂÃæÕâƪÎÄÕÂÄܶԴó¼ÒÓаïÖú.»òÕß×Ô¼º¸´ÖÆһϴúÂëÊÔÒ»ÏÂ.ÕâƪÎÄÕ²»ÊÇÎÒдµÄ.ÎÒÖ»ÊÇת¹ýÀ´.¾õµÃ²»´í.
ÐèÒªÌí¼ÓµÄÃüÃû¿Õ¼ä£º
using System.Xml;
¶¨Ò弸¸ö¹«¹²¶ÔÏó£º
XmlDocument xmldoc ;
XmlNode xmlnode ;
XmlElement xmlelem ;
1£¬´´½¨µ½·þÎñÆ÷ͬà ......

C#×Ö·û´®Ç³Îö

    ¸Õ¿ª²©²»¾Ã,¾ÍºÜÏëдµã¶«Î÷,µ«ÊdzöÓÚÖÖÖÖÔ­Òò¶¼Ã»¶¯ÊÖ¡£ÓÐÁ˲©¿Í×ܲ»ÄÜ¿Õ×Å£¬¾ÍÔÚ×ÁÄ¥×ÅдЩʲô¡£¸ÕºÃѧϰÁË×Ö·û´®µÄһЩ¶«Î÷£¬×öÁËϱʼǸоõ»¹²»´í£¬ÄóöÀ´É¹É¹...
    ÏÈ˵˵×Ö·û´®²Ù×÷µÄÐÔÄÜÎÊÌâ¡£C#ÖеÄ×Ö·û´®²Ù×÷£¬ÓõÃÒ²±È½Ï¶à£¬´ó¼Ò¶¼²»Ä°Éú¡£·´Õý¾ÍÊÇÉùÃ÷Ò»¸ö×Ö·û´®±äÁ¿£¬È»º ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ