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


C# IEnumerable.?.Select方法代码示例

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


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

示例1: GetEnsuredBlogKeys

        public ICollection<string> GetEnsuredBlogKeys(IEnumerable<string> blogKeys)
        {
            var blogKeyList = blogKeys?.Select(x => new BlogKey(x));

            var ensuredBlogKeys = this.GetEnsuredBlogKeys(blogKeyList);
            return ensuredBlogKeys;
        }
开发者ID:sebnilsson,项目名称:Blaven,代码行数:7,代码来源:BlogSettingsHelper.cs

示例2: MappedDrift

		static public IEnumerable<MeasurementBound1DIntAtTime> MappedDrift(
			IEnumerable<MeasurementBound1DIntAtTime> Source,
			Int64 DriftTimeFixed,
			Int64 DriftNano) =>
			Source
			?.Select(BoundPreDrift =>
			BoundPreDrift.BoundOffset((Int64)(((BoundPreDrift.Time - DriftTimeFixed) * BoundPreDrift.Bound * DriftNano) / 1e+9)));
开发者ID:trainingday01,项目名称:Optimat.EveOnline,代码行数:7,代码来源:TargetingRange.cs

示例3: CreateSuperhero

        public Superhero CreateSuperhero(string superheroName, string secretIdentity, string cityName, IEnumerable<string> powerNames)
        {
            if (string.IsNullOrEmpty(superheroName) ||
                superheroName.Length < MinSuperheroNameLength ||
            superheroName.Length > MaxSuperherNameLength)
            {
                throw new ArgumentException("Invalid supehero name");
            }

            var superhero = new Superhero
            {
                SuperheroName = superheroName,
                SecretIdentity = secretIdentity,
                City = this.LoadOrCreateCity(cityName),
                Powers = powerNames?.Select(this.LoadOrCreatePower)
                    .ToList()
            };

            using (this.unitOfWork)
            {
                this.superheroes.Add(superhero);
                this.unitOfWork.Commit();
            }

            return superhero;
        }
开发者ID:TelerikAcademy,项目名称:Databases,代码行数:26,代码来源:SuperheroesService.cs

示例4: GenericDataValueProvider

 public GenericDataValueProvider(System.Reflection.MemberInfo member, IValueProvider inner, IEnumerable<string> sensitiveProperties)
 {
     if (member == null) throw new ArgumentNullException("member");
     if (inner == null) throw new ArgumentNullException("inner");
     Member = member;
     Inner = inner;
     SensitiveProperties = sensitiveProperties?.Select(p => p.ToLowerInvariant());
 }
开发者ID:BikS2013,项目名称:bUtility,代码行数:8,代码来源:GenericDataValueProvider.cs

示例5: CreateUserDto

        public static UserDto CreateUserDto(this User user, IEnumerable<Login> logins)
        {
            var userDto = user.CreateUserDto();

            userDto.Logins = logins?.Select(CreateLoginDto).ToArray() ?? new LoginDto[0];

            return userDto;
        }
开发者ID:ReaderOfDream,项目名称:GuessThePicture,代码行数:8,代码来源:UserBuilder.cs

示例6: Pkcs7EncryptionHandler

        /// <summary>
        /// Initialisiert eine neue Instanz der <see cref="Pkcs7EncryptionHandler"/> Klasse.
        /// </summary>
        /// <param name="senderCertificate">Das X509-Zertifikat des Absenders (PKCS#12)</param>
        /// <param name="receiverCertificate">Das X509-Zertifikat des Empfängers</param>
        /// <param name="oldSenderCertificates">Die abgelaufenen X509-Zertifikate des Absenders</param>
        public Pkcs7EncryptionHandler(X509Certificate2 senderCertificate, X509Certificate2 receiverCertificate, IEnumerable<X509Certificate2> oldSenderCertificates = null)
        {
#if NET45
            _encryptionHandler = new NativePkcs7EncryptionHandler(senderCertificate, receiverCertificate, oldSenderCertificates);
#else
            var senderCert = new Pkcs12Store(new MemoryStream(senderCertificate.Export(X509ContentType.Pkcs12)), new char[0]);
            var receiverCert = new Org.BouncyCastle.X509.X509CertificateParser().ReadCertificate(receiverCertificate.RawData);
            var oldSenderCerts = oldSenderCertificates?.Select(cert => new Pkcs12Store(new MemoryStream(cert.Export(X509ContentType.Pkcs12)), new char[0]));
            _encryptionHandler = new BouncyCastlePkcs7EncryptionHandler(senderCert, receiverCert, oldSenderCerts);
#endif
        }
开发者ID:dataline-gmbh,项目名称:ExtraStandard,代码行数:17,代码来源:Pkcs7EncryptionHandler.cs

示例7: GetMessages

		/// <summary>
		/// Возвращает сообщения с указанными идентификаторами, либо если 
		/// идентификаторы не указаны, возвращает текущие выделенные сообщения.
		/// </summary>
		public static IEnumerable<IForumMessageInfo> GetMessages(
			IServiceProvider serviceProvider,
			IEnumerable<int> messageIds)
		{
			return
				messageIds
					?.Select(msgId => (IForumMessageInfo)DatabaseManager.GetMessageWithForum(serviceProvider, msgId))
						?? serviceProvider
					.GetRequiredService<IActiveMessagesService>()
					.ActiveMessages;
		}
开发者ID:rsdn,项目名称:janus,代码行数:15,代码来源:ForumMessageCommandHelper.cs

示例8: AddPackage

 /// <summary>
 /// Adds a package.
 /// </summary>
 /// <param name="packageId">The package identifier.</param>
 /// <param name="packageSources">The package sources.</param>
 /// <param name="versionRange">The version range.</param>
 /// <param name="getLatest">If set to <c>true</c>, the latest version of the package will always be downloaded.</param>
 /// <param name="allowPrereleaseVersions">If set to <c>true</c>, allow prerelease versions.</param>
 /// <param name="allowUnlisted">If set to <c>true</c>, allow unlisted versions.</param>
 /// <param name="exclusive">If set to <c>true</c>, only use the package sources defined for this package.</param>
 public void AddPackage(string packageId, IEnumerable<string> packageSources = null, string versionRange = null,
     bool getLatest = false, bool allowPrereleaseVersions = false, bool allowUnlisted = false, bool exclusive = false)
 {
     if (_packages.ContainsKey(packageId))
     {
         throw new ArgumentException($"A package with the ID {packageId} has already been added");
     }
     _packages.Add(packageId, new Package(_currentFramework, packageId,
         packageSources?.Select(_sourceRepositories.CreateRepository).ToList(),
         versionRange, getLatest, allowPrereleaseVersions, allowUnlisted, exclusive));
 }
开发者ID:ibebbs,项目名称:Wyam,代码行数:21,代码来源:PackageInstaller.cs

示例9: BuildContext

        private IEnumerable<IContextItem> BuildContext(IEnumerable<KeyValuePair<string, string>> parameters, IConfiguration config)
        {
            // build any context from the query string and http request
            var parameterContext = parameters?.Select(p => p.ToContextItem()).ToArray() ?? new IContextItem[] { };

            // build any context from the config files
            var configContext = config?.ContextItems?.ToArray() ?? new IContextItem[] { };

            // build any context from the plugins - they get to see any context generated so far
            var pluginContext  = this.pluginContextProvider.Contribute(parameterContext.Union(configContext)) ?? new IContextItem[] { };

            // squish it all together.  add parameters last so they can overide stuff generated by the plugins
            return configContext.Union(pluginContext).Union(parameterContext).ToArray();
        }
开发者ID:mr-sandy,项目名称:kola,代码行数:14,代码来源:RenderingService.cs

示例10: MapPeopleList

 public IEnumerable<PersonViewModel> MapPeopleList(IEnumerable<PersonDto> peopleDtoList)
 {
     return peopleDtoList?.Select(MapPerson).ToList();
 }
开发者ID:nng-github,项目名称:LendingLibrary,代码行数:4,代码来源:PersonMapper.cs

示例11: PostCreate

 private void PostCreate(HostService hostService, IEnumerable<FileAndType> files)
 {
     using (new LoggerPhaseScope("ReportModelLoadInfo", true))
     {
         if (!hostService.ShouldTraceIncrementalInfo)
         {
             return;
         }
         var allFiles = files?.Select(f => f.File) ?? new string[0];
         var loadedFiles = hostService.Models.Select(m => m.FileAndType.File);
         IncrementalContext.ReportModelLoadInfo(hostService, allFiles.Except(loadedFiles), null);
         IncrementalContext.ReportModelLoadInfo(hostService, loadedFiles, BuildPhase.PreBuildBuild);
     }
 }
开发者ID:vicancy,项目名称:docfx,代码行数:14,代码来源:HostServiceCreatorWithIncremental.cs

示例12: ToSelectListItems

 public static List<SelectListItem> ToSelectListItems(this IEnumerable<PluginFeatureManifest> PluginFeatureDefinitions, IEnumerable<PluginFeatureManifest> SelectedItems)
 {
     return PluginFeatureDefinitions.ToSelectListItems(SelectedItems?.Select(i => i.Id), false, null);
 }
开发者ID:garysharp,项目名称:Disco,代码行数:4,代码来源:PluginExtensions.cs

示例13: SetTreeEntrySuitingSelectedPath

		static public IEnumerable<MemoryStruct.ITreeViewEntry> SetTreeEntrySuitingSelectedPath(
			this IEnumerable<MemoryStruct.ITreeViewEntry> SetTreeEntryRoot,
			IEnumerable<string> SelectedPathListNodeLabel)
		{
			if (null == SetTreeEntryRoot || null == SelectedPathListNodeLabel)
			{
				return null;
			}

			var PathListNodeLabelLessFormatting =
				SelectedPathListNodeLabel?.Select(Label => Label?.RemoveXmlTag()?.Trim())?.ToArray();

			var PathListNodeLabelNext =
				PathListNodeLabelLessFormatting?.FirstOrDefault();

			if (null == PathListNodeLabelNext)
			{
				return null;
			}

			var SetTreeEntryRootSuitingPathNodeNext =
				SetTreeEntryRoot
				?.Where(TreeEntry => (TreeEntry?.Text?.RemoveXmlTag()?.Trim()).EqualsIgnoreCase(PathListNodeLabelNext))
				?.ToArray();

			if (null == SetTreeEntryRootSuitingPathNodeNext)
			{
				return null;
			}

			if (PathListNodeLabelLessFormatting.Length < 2)
			{
				return SetTreeEntryRootSuitingPathNodeNext;
			}

			return
				SetTreeEntryRootSuitingPathNodeNext
				.Select((LinxTreeEntryPasend) =>
					SetTreeEntrySuitingSelectedPath(
						LinxTreeEntryPasend.Child,
						SelectedPathListNodeLabel.Skip(1)))
				?.Where((Kandidaat) => null != Kandidaat)
				?.ConcatNullable();
		}
开发者ID:grachevko,项目名称:Sanderling,代码行数:44,代码来源:Inventory.cs

示例14: MapBorrowTransactionList

 public IEnumerable<BorrowViewModel> MapBorrowTransactionList(IEnumerable<BorrowDto> borrowDtoList)
 {
     return borrowDtoList?.Select(MapBorrowViewModel).ToList();
 }
开发者ID:nng-github,项目名称:LendingLibrary,代码行数:4,代码来源:BorrowMapper.cs

示例15: EditMember

        public Task EditMember(string serverId, string userId, bool? mute = null, bool? deaf = null, IEnumerable<object> roles = null)
		{
			CheckReady();
			if (serverId == null) throw new NullReferenceException(nameof(serverId));
			if (userId == null) throw new NullReferenceException(nameof(userId));

			IEnumerable<string> newRoles = roles?.Select(x =>
			{
				if (x is string)
					return x as string;
				else if (x is Role)
					return (x as Role).Id;
				else
					throw new ArgumentException("Roles must be a collection of string or Role.", nameof(roles));
			});

			return _api.EditMember(serverId, userId, mute: mute, deaf: deaf, roles: newRoles);
		}
开发者ID:cillas,项目名称:Discord.Net,代码行数:18,代码来源:DiscordClient.API.cs


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