本文整理汇总了C#中GLib.List.Any方法的典型用法代码示例。如果您正苦于以下问题:C# List.Any方法的具体用法?C# List.Any怎么用?C# List.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLib.List
的用法示例。
在下文中一共展示了List.Any方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Launch
public void Launch (GLib.File app, IEnumerable<GLib.File> files)
{
if (app != null && !app.Exists) {
Log<SystemService>.Warn ("Application {0} doesnt exist", app.Path);
return;
}
List<GLib.File> noMountNeeded = new List<GLib.File> ();
// before we try to use the files, make sure they are mounted
foreach (GLib.File f in files) {
// if the path isn't empty,
// check if it's a local file or on VolumeMonitor's mount list.
// if it is, skip it.
if (!string.IsNullOrEmpty (f.Path)
&& (f.IsNative || VolumeMonitor.Default.Mounts.Any (m => f.Path.Contains (m.Root.Path)))) {
noMountNeeded.Add (f);
continue;
}
// if the file has no path, there are 2 possibilities
// either it's a "fake" file, like computer:// or trash://
// or it's a mountable file that isn't mounted
// this launches the "fake" files":
try {
GLib.AppInfoAdapter.LaunchDefaultForUri (f.StringUri (), null);
// FIXME: until we use a more recent Gtk# (one that exposes the GException code
// we'll just have to silently fail and assume it's an unmounted but mountable file
} catch {
// otherwise:
// try to mount, if successful launch, otherwise (it's possibly already mounted) try to launch anyways
f.MountWithActionAndFallback (() => LaunchWithFiles (app, new [] {f}), () => LaunchWithFiles (app, new [] {f}));
}
}
if (noMountNeeded.Any () || !files.Any ())
LaunchWithFiles (app, noMountNeeded);
}
示例2: RequireGenerics
static bool RequireGenerics (IMethodSymbol method)
{
System.Collections.Immutable.ImmutableArray<ITypeSymbol> typeArgs;
if (method.MethodKind == MethodKind.Constructor) {
typeArgs = method.ContainingType.TypeArguments;
} else {
typeArgs = method.TypeArguments;
}
if (!typeArgs.Any (ta => ta.TypeKind == TypeKind.TypeParameter))
return false;
var parameterTypes = new List<ITypeSymbol> (method.Parameters.Select (p => p.Type));
if (method.IsExtensionMethod) {
parameterTypes.Add (method.ReducedFrom.Parameters [0].Type);
}
return typeArgs.Any (t => !parameterTypes.Any (pt => ContainsType (pt, t)));
}
示例3: SetElementVariables
public void SetElementVariables()
{
var state = AppController.Instance.CurrentState as PropertiesState;
if (state == null || state.Element == null) {
return;
}
var vars = new List<Variable> ();
string variable;
VariableType t;
var c = state.Element.GetVariablesCount ();
if (c > 0) {
GetPropertyData (cbDefaultVar,
cbExistVar,
etNewVar,
rbDefault,
rbExisting,
rbNew,
out variable,
out t);
if (variable != null) {
vars.Add (new Variable{ Value = variable, Type = t });
}
}
if (c > 1) {
GetPropertyData (cbDefaultVar1,
cbExistVar1,
etNewVar1,
rbDefault1,
rbExisting1,
rbNew1,
out variable,
out t);
if (variable != null) {
vars.Add (new Variable{ Value = variable, Type = t });
}
}
if (c > 2) {
GetPropertyData (cbDefaultVar2,
cbExistVar2,
etNewVar2,
rbDefault2,
rbExisting2,
rbNew2,
out variable,
out t);
if (variable != null) {
vars.Add (new Variable{ Value = variable, Type = t });
}
}
if (c > 3) {
GetPropertyData (cbDefaultVar3,
cbExistVar3,
etNewVar3,
rbDefault3,
rbExisting3,
rbNew3,
out variable,
out t);
if (variable != null) {
vars.Add (new Variable{ Value = variable, Type = t });
}
}
if (vars.Any()) {
AppController.Instance.SetElementVariable (vars);
}
}