本文整理汇总了C#中IList.SelectMany方法的典型用法代码示例。如果您正苦于以下问题:C# IList.SelectMany方法的具体用法?C# IList.SelectMany怎么用?C# IList.SelectMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IList
的用法示例。
在下文中一共展示了IList.SelectMany方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExtractIntegrationJobTypesFromAssemblies
public IList<Type> ExtractIntegrationJobTypesFromAssemblies(IList<Assembly> assembliesWithJobs)
{
return assembliesWithJobs
.SelectMany(x => x.GetTypes())
.Where(x => typeof(IIntegrationJob).IsAssignableFrom(x) && x.IsClass)
.ToList();
}
示例2: ContentLocator
//todo: Link content to a content cache similar to openwraps package cache. Use same mechanism?
public ContentLocator()
{
var environment = ServiceLocator.GetService<IEnvironment>();
var packageManager = ServiceLocator.GetService<IPackageManager>();
var baseDirectory = LocalFileSystem.Instance.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory);
contentRoot = baseDirectory.GetDirectory("Content");
contentRoot.MustExist();
foreach (var scopedDescriptor in environment.ScopedDescriptors)
{
var files = packageManager.GetProjectExports<ContentFolderExport>(scopedDescriptor.Value.Value,
environment.ProjectRepository,
environment.ExecutionEnvironment);
contentPathSources = files.SelectMany(x => x).Distinct().Select(x => x.Directory).ToList();
foreach (
var pathSource in
contentPathSources.SelectMany(contentPathSource => contentPathSource.Directories()))
{
pathSource.LinkTo(contentRoot.GetDirectory(pathSource.Name).MustExist().Path.FullPath);
}
}
}
示例3: SchemaScope
public SchemaScope(JTokenType tokenType, IList<JsonSchemaModel> schemas)
{
_tokenType = tokenType;
_schemas = schemas;
_requiredProperties = schemas.SelectMany<JsonSchemaModel, string>(GetRequiredProperties).Distinct().ToDictionary(p => p, p => false);
}
示例4: ColoriseDupFilesWithDifferentPaths
private void ColoriseDupFilesWithDifferentPaths(ref IList<ProjectModel> projects)
{
// If there's a different version reference between 2 or more projects then flag this.
// Example: ProjectA has EF 4.3.1. ProjectB has EF 5.0. We need to flag this in the UI.
var children = projects.SelectMany(p => p.Children);
children.Where(c => c.ItemType != "ProjectReference")
.ToList()
.ForEach(c =>
{
if (c.IsConflicting)
return;
var similar = children.Where(x => x.Filename.Equals(c.Filename, StringComparison.CurrentCultureIgnoreCase)
&& !x.ItemLocation.Replace(@"..\", "").Equals(c.ItemLocation.Replace(@"..\", ""), StringComparison.CurrentCultureIgnoreCase)).ToList();
if (similar.Any())
{
int i = _r.Next(_pairedColors.Count - 1);
Color color = _pairedColors.Skip(i).First();
c.SimilarRefences = similar.ToList();
c.Color = color;
c.IsConflicting = true;
similar.ForEach(x =>
{
x.Color = color;
x.IsConflicting = true;
});
}
});
}
示例5: SearchForLunchMenuURLs
/// <summary>
/// Searches for lunch menu URLs through all search engines with given query strings.
/// </summary>
/// <param name="queries">Query-strings to search with.</param>
public IList<string> SearchForLunchMenuURLs(IList<string> queries)
{
return queries.SelectMany(SearchForLunchMenuURLs)
.AsParallel()
.Distinct(new UrlComparer())
.ToList();
}
示例6: FactoryClass
public FactoryClass(IConstructorArgList argList, IList<IFactoryMethod> methods)
{
m_argList = argList;
Methods = methods;
foreach (var definition in methods.SelectMany(m => m.ConstructorArgs))
argList.Add(definition);
}
示例7: Escape
private static List<byte> Escape(IList<byte> p)
{
return p.SelectMany(q =>
q == 0x7E ? new byte[] { 0x7d, 0x02 }
: (q == 0x7D ? new byte[] { 0x7D, 0x01 }
: new[] { q })
).ToList();
}
示例8: MapToTimeSlot
/// <summary>
/// Mapping list of date models into list of timeslot models
/// </summary>
/// <param name="dates">List of date models</param>
/// <returns>List of timeslot models</returns>
public static IList<TimeSlot> MapToTimeSlot(IList<EventModel.DatesModel> dates)
{
return dates.SelectMany(d => d.Times.Select(time => new TimeSlot()
{
Id = time.Id.GetValueOrDefault(),
DateTime = d.Date.Add(TimeSpan.Parse(time.Time))
}).ToList()).ToList();
}
示例9: GetUsersCatalogs
public IList<CatalogDto> GetUsersCatalogs(IList<long> userIds)
{
var userCatalogIds = userIds
.SelectMany(x => Call<IList<long>>("get-user-catalogs", new { UserId = x }))
.Distinct().ToArray();
return Get(userCatalogIds);
}
示例10: ValidatedContractBlock
public ValidatedContractBlock(IList<ValidatedStatement> validatedContractBlock)
{
Contract.Requires(validatedContractBlock != null);
_validatedContractBlock = validatedContractBlock;
_contractBlock = validatedContractBlock.Select(x => x.ProcessedStatement).ToList();
_validationResults = validatedContractBlock.SelectMany(x => x.ValidationResults).ToList();
}
示例11: UpdateValues
public bool UpdateValues(IList<AFValues> valsList)
{
IList<AFValue> valsToWrite = new List<AFValue>();
valsToWrite = valsList.SelectMany(i => i).ToList();
AFErrors<AFValue> errors = AFListData.UpdateValues(valsToWrite, AFUpdateOption.Replace);
return (errors == null) ? true : false;
}
示例12: GenerateMembers
private IList<ISymbol> GenerateMembers(
IList<Tuple<INamedTypeSymbol, IList<ISymbol>>> unimplementedMembers,
CancellationToken cancellationToken)
{
return
unimplementedMembers.SelectMany(t => t.Item2)
.Select(m => GenerateMember(m, cancellationToken))
.WhereNotNull()
.ToList();
}
示例13: GetPointsPerMinute
public double GetPointsPerMinute(IList<Player> players, bool? homeFixtures)
{
var fixtures = players.SelectMany(p => p.PastFixtures).ToList();
if(homeFixtures.HasValue)
{
fixtures = fixtures.Where(pf => pf.Home == homeFixtures).ToList();
}
var totalMinutes = fixtures.Sum(f => f.MinutesPlayed);
var totalPoints = fixtures.Sum(f => f.TotalPointsScored);
return totalPoints/(double)totalMinutes;
}
示例14: Game
public Game(IList<Team> teams, Contract contract, IEnumerable<Card> deck, ILogger logger)
{
_logger = logger;
Contract = contract;
Teams = teams;
_numberOfPlayers = teams.SelectMany(t => t.Players).Count();
Declarer = Contract.Team.Players.First(); // TODO: This probably isn't right!
Dummy = Contract.Team.Players.Last(); // TODO: This probably isn't right!
Deal(deck, Declarer); //TODO: This Probably isn't right!
}
示例15: SchemaScope
public SchemaScope(JTokenType tokenType, IList<JsonSchemaModel> schemas)
{
_tokenType = tokenType;
_schemas = schemas;
_requiredProperties = schemas.SelectMany<JsonSchemaModel, string>(GetRequiredProperties).Distinct().ToDictionary(p => p, p => false);
if (tokenType == JTokenType.Array && schemas.Any(s => s.UniqueItems))
{
IsUniqueArray = true;
UniqueArrayItems = new List<JToken>();
}
}