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


C# IEnumerable.NotNull方法代码示例

本文整理汇总了C#中IEnumerable.NotNull方法的典型用法代码示例。如果您正苦于以下问题:C# IEnumerable.NotNull方法的具体用法?C# IEnumerable.NotNull怎么用?C# IEnumerable.NotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEnumerable的用法示例。


在下文中一共展示了IEnumerable.NotNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InGac

 public static ILookup<IPackageInfo, AssemblyName> InGac(IEnumerable<IPackageInfo> packages, ExecutionEnvironment environment = null)
 {
     var domain = TempDomain();
     try
     {
         var loader = ((Loader)domain.CreateInstanceFromAndUnwrap(
                 typeof(Loader).Assembly.Location,
                 typeof(Loader).FullName));
         return (from package in packages.NotNull().Select(x => x.Load()).NotNull()
                 let export = package.GetExport("bin", environment)
                 where export != null
                 from assembly in export.Items.OfType<IAssemblyReferenceExportItem>()
                 let inGac = loader.InGAC(assembly.AssemblyName)
                 where inGac
                 select new { package, assembly.AssemblyName })
                 .ToLookup(x => (IPackageInfo)x.package, x => x.AssemblyName);
     }
     catch
     {
         return (new AssemblyName[0]).ToLookup(x => (IPackageInfo)null);
     }
     finally
     {
         AppDomain.Unload(domain);
     }
 }
开发者ID:andrewdavey,项目名称:openwrap,代码行数:26,代码来源:GacResolver.cs

示例2: FormValidationResult

    /// <summary>
    /// 创建 FormValidationResult 对象
    /// </summary>
    /// <param name="form">所验证的表单</param>
    /// <param name="errors">验证错误信息</param>
    public FormValidationResult( HtmlForm form, IEnumerable<FormValidationError> errors )
    {

      if ( form == null )
        throw new ArgumentNullException( "form" );

      
      Form = form;

      Errors = new FormValidationErrorCollection();

      if ( errors != null )
      {
        errors = errors.NotNull();

        if ( errors.Any() )
        {
          HasError = true;
          foreach ( var e in errors )
            Errors.Add( e );
        }
      }

      else
        HasError = false;
    }
开发者ID:ajayumi,项目名称:Jumony,代码行数:31,代码来源:FormValidationResult.cs

示例3: Files

 static ILookup<string, string> Files(IEnumerable<ITaskItem> specs)
 {
     return specs == null
                ? Lookup<string, string>.Empty
                : specs.NotNull()
                      .Select(x => new { target = GetTarget(x), path = Path.GetFullPath(x.ItemSpec) })
                      .ToLookup(_ => _.target, _ => _.path);
 }
开发者ID:modulexcite,项目名称:openwrap,代码行数:8,代码来源:PublishPackageContent.cs

示例4: GetAssemblyReferencesFromPackages

 static IEnumerable<IAssemblyReferenceExportItem> GetAssemblyReferencesFromPackages(IEnumerable<IPackageInfo> packages, ExecutionEnvironment exec)
 {
     return from package in packages.NotNull()
                    .GroupBy(x => x.Name)
                    .Select(x => x.OrderByDescending(y => y.Version).Select(y=>y.Load()).NotNull().First())
            from assembly in package.Load().GetExport("bin", exec).Items.Cast<IAssemblyReferenceExportItem>()
            where MatchesReferenceSection(package, assembly)
            select assembly;
 }
开发者ID:petejohanson,项目名称:openwrap,代码行数:9,代码来源:AssemblyReferences.cs

示例5: GetAssemblyReferencesFromPackages

 static IEnumerable<IAssemblyReferenceExportItem> GetAssemblyReferencesFromPackages(IEnumerable<IPackageInfo> packages, ExecutionEnvironment exec)
 {
     return packages
             .NotNull()
             .GroupBy(x=>x.Name)
             .Select(x=>x.OrderByDescending(y=>y.Version).First())
             .NotNull()
             .SelectMany(x => x.Load().GetExport("bin", exec).Items)
             .Cast<IAssemblyReferenceExportItem>();
 }
开发者ID:seantfox,项目名称:openwrap,代码行数:10,代码来源:AssemblyReferenceExportExtensions.cs

示例6: InGac

 public static ILookup<IPackageInfo, AssemblyName> InGac(this IPackageExporter exporter, IEnumerable<IPackageInfo> packages)
 {
     var domain = TempDomain();
     try
     {
         var loader = ((Loader)domain.CreateInstanceFromAndUnwrap(
                 typeof(Loader).Assembly.Location,
                 typeof(Loader).FullName));
         return (from package in packages.NotNull().Select(x => x.Load()).NotNull()
                 from assembly in exporter.Assemblies(package, ExecutionEnvironment.Any)
                 where loader.InGAC(assembly.AssemblyName)
                 select new { package, assembly.AssemblyName }
                ).ToLookup(x => (IPackageInfo)x.package, x => x.AssemblyName);
     }
     catch
     {
         return (new AssemblyName[0]).ToLookup(x => (IPackageInfo)null);
     }
     finally
     {
         AppDomain.Unload(domain);
     }
 }
开发者ID:modulexcite,项目名称:openwrap,代码行数:23,代码来源:GacResolver.cs

示例7: SoundEmitterSourceAction

 public SoundEmitterSourceAction(IEnumerable<SoundEmitter.Source> obj)
 {
     if (obj == null) throw new ArgumentNullException("obj");
     this.targetObj = obj.NotNull().ToArray();
 }
开发者ID:SirePi,项目名称:duality,代码行数:5,代码来源:SoundEmitterSourceAction.cs

示例8: MonitorRequest

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="components">Collection of components to monitor in your system</param>
        public MonitorRequest(IEnumerable<ComponentDto> components)
        {
            components.NotNull(nameof(components));

            Components = components.ToList();
        }
开发者ID:c4rm4x,项目名称:C4rm4x.WebApi,代码行数:10,代码来源:MonitorRequest.cs

示例9: RigidBodyShapeAction

		public RigidBodyShapeAction(IEnumerable<ShapeInfo> obj)
		{
			if (obj == null) throw new ArgumentNullException("obj");
			this.targetObj = obj.NotNull().ToArray();
		}
开发者ID:Andrea,项目名称:duality-withsvn-history,代码行数:5,代码来源:RigidBodyShapeAction.cs

示例10: CopyPackagesToRepositories

        IEnumerable<PackageOperationResult> CopyPackagesToRepositories(IEnumerable<IPackageRepository> sourceRepositories,
            DependencyResolutionResult resolvedPackages,
            IEnumerable<IPackageRepository> destinationRepositories)
        {
            var publishingRepos = destinationRepositories.NotNull().OfType<ISupportPublishing>().ToList();
            foreach (var foundPackage in resolvedPackages.SuccessfulPackages)
            {
                foreach (var destinationRepository in publishingRepos)
                {
                    var existingUpToDateVersion = GetExistingPackage(destinationRepository, foundPackage, x => x >= foundPackage.Identifier.Version);
                    if (existingUpToDateVersion == null)
                    {
                        var sourcePackage = GetBestSourcePackage(sourceRepositories, foundPackage.Packages);

                        _deployer.DeployDependency(sourcePackage, destinationRepository);
                        var existingVersion = GetExistingPackage(destinationRepository, foundPackage, x => x < foundPackage.Identifier.Version);

                        yield return existingVersion == null
                            ? new PackageAddedResult(sourcePackage, destinationRepository)
                            : new PackageUpdatedResult(existingVersion, sourcePackage, destinationRepository);
                    }
                    else
                    {
                        yield return new PackageUpToDateResult(existingUpToDateVersion, destinationRepository);
                    }
                }
            }
            foreach (var repo in publishingRepos)
                repo.PublishCompleted();
        }
开发者ID:seantfox,项目名称:openwrap,代码行数:30,代码来源:DefaultPackageManager.cs

示例11: BadRequest

        public BadRequest(IEnumerable<SerializableValidationError> validationErrors)
        {
            validationErrors.NotNull(nameof(validationErrors));

            ValidationErrors = validationErrors;
        }
开发者ID:c4rm4x,项目名称:C4rm4x.WebApi,代码行数:6,代码来源:BadRequestResult.cs

示例12: Combine

    /// <summary>
    /// 合并多个缓存标记
    /// </summary>
    /// <param name="tokens">要合并的缓存标记列表</param>
    /// <returns>合并后的缓存标记</returns>
    public static CacheToken Combine( IEnumerable<CacheToken> tokens )
    {

      if ( tokens.IsNullOrEmpty() )
        return null;

      tokens = tokens.NotNull();

      CacheToken result;
      if ( tokens.IsSingle( out result ) )
        return result;

      return new CacheToken( tokens.SelectMany( t => t._tokens ).ToArray() );

    }
开发者ID:ajayumi,项目名称:Jumony,代码行数:20,代码来源:CacheToken.cs

示例13: CleanupAfterPlugins

		private static void CleanupAfterPlugins(IEnumerable<CorePlugin> oldPlugins)
		{
			oldPlugins = oldPlugins.NotNull().Distinct();
			if (!oldPlugins.Any()) oldPlugins = null;

			// Clean globally cached type values
			availTypeDict.Clear();
			ReflectionHelper.ClearTypeCache();
			Component.ClearTypeCache();
			Formatter.ClearTypeCache();
			CloneProvider.ClearTypeCache();
			
			// Clean input sources that a disposed Assembly forgot to unregister.
			if (oldPlugins != null)
			{
				foreach (CorePlugin plugin in oldPlugins)
					CleanInputSources(plugin.PluginAssembly);
			}
			// Clean event bindings that are still linked to the disposed Assembly.
			if (oldPlugins != null)
			{
				foreach (CorePlugin plugin in oldPlugins)
					CleanEventBindings(plugin.PluginAssembly);
			}
		}
开发者ID:undue,项目名称:duality,代码行数:25,代码来源:DualityApp.cs

示例14: GeTypes

 /// <summary>
 /// 获取可用的服务类型。
 /// </summary>
 /// <param name="types">类型集合。</param>
 /// <returns>可用的服务类型。</returns>
 public Type[] GeTypes(IEnumerable<Type> types)
 {
     types = types.NotNull("types").ToArray();
     return types.Where(i => i.IsClass && !i.IsAbstract).ToArray();
 }
开发者ID:l1183479157,项目名称:RabbitHub,代码行数:10,代码来源:DefaultServiceTypeHarvester.cs

示例15: Files

 static List<string> Files(IEnumerable<ITaskItem> specs)
 {
     return specs == null
         ? new List<string>(0)
         : specs.NotNull()
                .Select(x=>System.IO.Path.GetFullPath(x.ItemSpec))
                .ToList();
 }
开发者ID:andrewdavey,项目名称:openwrap,代码行数:8,代码来源:PublishPackageContent.cs


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