当前位置: 首页>>代码示例>>C#>>正文


C# List.Any方法代码示例

本文整理汇总了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);
		}
开发者ID:Aurora-and-Equinox,项目名称:docky,代码行数:37,代码来源:SystemService.cs

示例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)));
		}
开发者ID:pjcollins,项目名称:monodevelop,代码行数:19,代码来源:RoslynSymbolCompletionData.cs

示例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);
            }
        }
开发者ID:jdpillon,项目名称:ArduinoLadder,代码行数:78,代码来源:AppWindow.cs


注:本文中的GLib.List.Any方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。