本文整理汇总了C#中Test.List.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# Test.List.AddRange方法的具体用法?C# Test.List.AddRange怎么用?C# Test.List.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test.List
的用法示例。
在下文中一共展示了Test.List.AddRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CleanupExportFolder
/// <summary>
/// Delete all files in the folder except output
/// </summary>
/// <param name="outputFolder">Export folder path</param>
/// <param name="extension"> </param>
/// <param name="nameLike"> </param>
/// <param name="directory"> </param>
public static void CleanupExportFolder(string outputFolder, string extension, string nameLike, string directory)
{
//#if (DEBUG)
// return;
//#endif
List<string> lstExtn = new List<string>();
List<string> lstNamelike = new List<string>();
List<string> lstDirecorylike = new List<string>();
if (extension.Trim().Length > 0)
{
string[] extn = extension.Split(',');
lstExtn.AddRange(extn);
}
if (nameLike.Trim().Length > 0)
{
string[] name = nameLike.Split(',');
lstNamelike.AddRange(name);
}
if (directory.Trim().Length > 0)
{
string[] folder = directory.Split(',');
lstDirecorylike.AddRange(folder);
}
outputFolder = Path.GetDirectoryName(outputFolder);
string[] filePath = Directory.GetFiles(outputFolder);
foreach (string file in filePath)
{
try
{
string type = Path.GetExtension(file).ToLower();
if (lstExtn.Contains(type))
{
File.Delete(file);
}
string fi = Path.GetFileNameWithoutExtension(file).ToLower();
foreach (string filelike in lstNamelike)
{
if (fi.Contains(filelike.Trim().ToLower()))
{
File.Delete(file);
}
}
if (type == ".css" && !fi.ToLower().Contains("merged"))
{
File.Delete(file);
}
}
catch
{
}
}
string[] FolderList = Directory.GetDirectories(outputFolder);
foreach (string folderName in FolderList)
{
if (lstDirecorylike.Contains(Path.GetFileName(folderName)))
{
try
{
Directory.Delete(folderName, true);
}
catch
{
}
}
}
}