本文整理汇总了C#中System.IO.Any方法的典型用法代码示例。如果您正苦于以下问题:C# System.IO.Any方法的具体用法?C# System.IO.Any怎么用?C# System.IO.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO
的用法示例。
在下文中一共展示了System.IO.Any方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsSatisifedBy
public bool IsSatisifedBy(string path)
{
var fileExt = Path.GetExtension(path);
var extensions = new[] { "PNG", "PCX", "JPG", "JPEG", "GIF", "TIF", "BMP", "TGA", };
if (fileExt != null && fileExt != "") fileExt = fileExt.Substring(1).ToUpper();
return extensions.Any(extension => fileExt != null && fileExt.Equals(extension));
}
示例2: IsSatisifedBy
public bool IsSatisifedBy(string path)
{
var nonImageDaxFiles = new [] { "WALLDEF", "MON", "ITEM", "MUSIC", "SOUND", "ZOUNDS", "LUCK" };
var fileName = Path.GetFileName(path);
if (fileName == null) return false;
fileName = fileName.ToUpper();
return !nonImageDaxFiles.Any(prefix => fileName.StartsWith(prefix)) && fileName.ToUpper().EndsWith(".DAX");
}
示例3: IsOnBlackList
static bool IsOnBlackList(string file)
{
var blackList = new[]
{
"signrequest-get-vanilla-query-unreserved",
"signrequest-post-vanilla-query-nonunreserved",
"signrequest-date-header-should-be-signed-headers",
"signrequest-support-custom-config" // 2x // TODO what are these?
};
return blackList.Any(file.Contains);
}
示例4: IsVersionInsertPresent
// ReSharper disable UnusedParameter.Local
/// <summary>
/// Checks if script makes insert into version history table
/// </summary>
public static bool IsVersionInsertPresent(DbVersion dbVersion, string script)
{
var versionInsertRegexes =
new[] {
string.Format("insert\\s+(into)?\\s+\\[?version(history)?\\]?(.+?){0}\\.{1}{2}{3}", dbVersion.Major, dbVersion.Minor, RevisionRegex(dbVersion), BuildRegex(dbVersion)),
string.Format("insert\\s+into\\s+#temp(.+?)VALUES(.*?){0}\\.{1}{2}{3}", dbVersion.Major, dbVersion.Minor, RevisionRegex(dbVersion), BuildRegex(dbVersion)),
"(alter|create)\\s+procedure\\s+(\\[?init\\]?\\.)?\\[?(init)?version\\]?",
}
.Select(pattern => new Regex(pattern, RegexOptions.IgnoreCase));
return versionInsertRegexes.Any(r => r.IsMatch(script));
}
示例5: Method
public int Method()
{
var variable = new[] { 1, 2, 3 };
for (var i = 0; i < variable.Length; i++)
{
variable[i] *= variable[i];
}
return variable.Any()
? variable.Last()
: default(int);
}
示例6: CreateAlpsGaTspSample
private AlpsGeneticAlgorithm CreateAlpsGaTspSample() {
AlpsGeneticAlgorithm alpsGa = new AlpsGeneticAlgorithm();
#region Problem Configuration
var provider = new TSPLIBTSPInstanceProvider();
var instance = provider.GetDataDescriptors().Single(x => x.Name == "ch130");
TravelingSalesmanProblem tspProblem = new TravelingSalesmanProblem();
tspProblem.Load(provider.LoadData(instance));
tspProblem.UseDistanceMatrix.Value = true;
#endregion
#region Algorithm Configuration
alpsGa.Name = "ALPS Genetic Algorithm - TSP";
alpsGa.Description = "An age-layered population structure genetic algorithm which solves the \"ch130\" traveling salesman problem (imported from TSPLIB)";
alpsGa.Problem = tspProblem;
SamplesUtils.ConfigureAlpsGeneticAlgorithmParameters<GeneralizedRankSelector, MultiPermutationCrossover, InversionManipulator>(alpsGa,
numberOfLayers: 1000,
popSize: 100,
mutationRate: 0.05,
elites: 1,
plusSelection: true,
agingScheme: AgingScheme.Polynomial,
ageGap: 20,
ageInheritance: 1.0,
maxGens: 1000);
var checkedCrossovers = new[] { typeof(EdgeRecombinationCrossover), typeof(MaximalPreservativeCrossover), typeof(OrderCrossover2) };
var multiCrossover = (MultiPermutationCrossover)alpsGa.Crossover;
var crossovers = multiCrossover.Operators.Where(c => checkedCrossovers.Any(cc => cc.IsInstanceOfType(c))).ToList();
foreach (var c in multiCrossover.Operators)
multiCrossover.Operators.SetItemCheckedState(c, crossovers.Contains(c));
#endregion
return alpsGa;
}