通过脚本之家下载dll的朋友,可将下面的代罩汪码宽弊保存为“注册.bat“,放物巧仔到dll文件同级目录(只要在同一个文件夹里面有这两个文件即可),双击注册.bat,就会自动完成Microsoft.CSharp.dll注册(win98不支持)。
using Systemusing System.IO
class DirectoryCopyExample
{
static void Main()
{
DirectoryCopy(".", @".\temp", true)
}
private static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs)
{
DirectoryInfo dir = new DirectoryInfo(sourceDirName)
DirectoryInfo[] dirs = dir.GetDirectories()
if (!dir.Exists)
{
throw new DirectoryNotFoundException(
"Source directory does not exist or could not be found: 大茄袜"
+ sourceDirName)
}
if (!Directory.Exists(destDirName))
{
Directory.CreateDirectory(destDirName)
}
FileInfo[] files = dir.GetFiles()
foreach (FileInfo file in files)
{
string temppath = Path.Combine(destDirName, file.Name)
file.CopyTo(temppath, false)
}
if (copySubDirs)
{
foreach (DirectoryInfo subdir in dirs)
{
string temppath = Path.Combine(destDirName, subdir.Name)
纳侍 滚激 DirectoryCopy(subdir.FullName, temppath, copySubDirs)
}
}
}
}
这是MSDN上原原本本的代码示例。
原地址是 http://msdn.microsoft.com/EN-US/library/bb762914.aspx
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)