本文整理汇总了C#中System.Object.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Object.Contains方法的具体用法?C# Object.Contains怎么用?C# Object.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Object
的用法示例。
在下文中一共展示了Object.Contains方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckVersion
private static void CheckVersion(Object[] attributes)
{
ApplicationVersion currentVersion = GetCurrentVersion();
if (attributes.Length <= 0 || attributes.Contains(new Version(currentVersion)))
{
TestVersion = currentVersion;
}
else
{
Assert.Inconclusive("This test is not designed to be executed in the application version '" + currentVersion.ToString());
}
}
示例2: CheckEnvironment
private static void CheckEnvironment(Object[] attributes)
{
TestEnvironment = GetCurrentEnvironment();
if (attributes.Length > 0 && !attributes.Contains(new ExecutionEnvironment(TestEnvironment)))
{
Assert.Inconclusive("This test is not designed to be executed in the '" + TestEnvironment.ToString() + "' environment.");
}
}
示例3: CompileExpression
private Lambda CompileExpression(Object[] values, string expressionTemplate, bool convertBack = false, List<Type> targetTypes = null)
{
try
{
Lambda res = null;
var needCompile = false;
// we can't determine value type if value is null
// so, binding Path = (a == null) ? "a" : "b" is permitted
if (convertBack)
needCompile = true;
else
if (values.Contains(DependencyProperty.UnsetValue))
{
Trace.WriteLine("Binding error: one of source fields is Unset, return null");
}
else
{
needCompile = true;
}
if (needCompile)
{
var argumentsTypes = convertBack ? targetTypes : sourceValuesTypes.Select(t => t ?? typeof(Object)).ToList();
res = CompileExpression(argumentsTypes, expressionTemplate);
}
return res;
}
catch (Exception e)
{
Trace.WriteLine("Binding error: calc converter can't convert expression" + expressionTemplate + ": " + e.Message);
return null;
}
}