C#获取当前程序集Assembly的文件名
C#获取当前程序集Assembly的文件名
C# Code:
string codeBase = Assembly.GetExecutingAssembly().GetName().CodeBase;
返回结果:"file:///c:/users/administrator/documents/visual studio 2015/Projects/WindowsFormsApplication4/WindowsFormsApplication4/bin/Debug/WindowsFormsApplication4.EXE"
string file = Assembly.GetExecutingAssembly().GetName().Name;
返回结果:"WindowsFormsApplication4"
string location = Assembly.GetExecutingAssembly().Location;
返回结果:"c:\\users\\administrator\\documents\\visual studio 2015\\Projects\\WindowsFormsApplication4\\WindowsFormsApplication4\\bin\\Debug\\WindowsFormsApplication4.exe"
string fileName = Path.GetFileName(Assembly.GetExecutingAssembly().Location);
返回结果:"WindowsFormsApplication4.exe"
//来源:C/S框架网(www.csframework.com) QQ:23404761
string codeBase = Assembly.GetExecutingAssembly().GetName().CodeBase;
返回结果:"file:///c:/users/administrator/documents/visual studio 2015/Projects/WindowsFormsApplication4/WindowsFormsApplication4/bin/Debug/WindowsFormsApplication4.EXE"
string file = Assembly.GetExecutingAssembly().GetName().Name;
返回结果:"WindowsFormsApplication4"
string location = Assembly.GetExecutingAssembly().Location;
返回结果:"c:\\users\\administrator\\documents\\visual studio 2015\\Projects\\WindowsFormsApplication4\\WindowsFormsApplication4\\bin\\Debug\\WindowsFormsApplication4.exe"
string fileName = Path.GetFileName(Assembly.GetExecutingAssembly().Location);
返回结果:"WindowsFormsApplication4.exe"
//来源:C/S框架网(www.csframework.com) QQ:23404761
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网