Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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


Ïà¹ØÎĵµ£º

asp.net(c#) ÏÂSQL´æ´¢¹ý³ÌʹÓÃÏêϸʵÀý

¼ÇÈ¡¼Ç¼¼¯
create procedure getArticle
as
select * from Article_Content
GO
asp.net µ÷Ó÷½·¨
  SqlConnection Conn = new SqlConnection();
        Conn.ConnectionString = Data.Connstr();
        Conn.Open();
  ......

ÀûÓÃvs.net¿ìËÙ¿ª·¢windows·þÎñ(c#)

ÔںܶàÓ¦ÓÃÖÐÐèÒª×öwindows·þÎñÀ´²Ù×÷Êý¾Ý¿âµÈ²Ù×÷£¬±ÈÈç
£¨1£©Ò»Ð©·Ç³£ÂýµÄÊý¾Ý¿â²Ù×÷£¬²»ÏëÒ»´ÎÐÔÈ¥×ö£¬ÏëÂýÂýµÄͨ¹ý·þÎñ¶¨Ê±È¥×ö£¬±ÈÈ綨ʱΪÊý¾Ý¿â±¸·ÝµÈ
£¨2£©ÔÚ.net RemotingÖÐÀûÓÃwindows·þÎñÀ´×öHost
ÀûÓÃvs.netÎÒÃÇ¿ÉÒÔÔÚ¼¸·ÖÖÓÖ®ÄÚ½¨Á¢Æäwindows·þÎñ£¬·Ç³£¼òµ¥
ÏÂÃæËµÒ»Ï²½Öè
1. н¨Ò»¸öÏîÄ¿
2. ´ÓÒ»¸ö¿É ......

C#ÀûÓÃwebrequest¼ÆËã´ýÏÂÔØµÄÎļþ´óС

C#ÀûÓÃwebrequest¼ÆËã´ýÏÂÔØµÄÎļþ´óС
string URL = textBox1.Text;
string filetype = URL.Substring(URL.LastIndexOf(".") + 1, (URL.Length - URL.LastIndexOf(".") - 1));
filetypevalue.Text = filetype.ToUpper();
string filename = URL.Substring(URL.LastIn ......

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


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

³£¼ûËã·¨C#ÃèÊö

ðÅÝÅÅÐò
using System;
class Program
{
public static void Main()
{
int[] a = new int[10];
Random rand = new Random();
for (int i = 0; i < 10; i++)
{
a[i] = rand.Next(10);//Éú³ÉËæ»úÊý¸øÊý×鸳ֵ
}
for (int i = 0; i < ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ