本文整理汇总了C#中Collection.Concat方法的典型用法代码示例。如果您正苦于以下问题:C# Collection.Concat方法的具体用法?C# Collection.Concat怎么用?C# Collection.Concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collection
的用法示例。
在下文中一共展示了Collection.Concat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTabResults
public IEnumerable<ITabResult> GetTabResults(IClient client, ITabQuery query)
{
IEnumerable<ITabResult> results = new Collection<ITabResult>();
if (client != null && client.Users != null)
{
results = results.Concat(this.GetLogResults(client, query));
results = results.Concat(this.GetVisibleUsersResults(client, query));
results = results.Concat(this.GetAllUsersResults(client, query));
}
return results.Distinct();
}
示例2: GetTabResults
public ITabResult GetTabResults(ITabQuery query)
{
IEnumerable<ITabResult> results = new Collection<ITabResult>();
foreach(ITabHandler handler in this.tabHandlers){
IEnumerable<ITabResult> handlerMatches = handler.GetTabResults(this.client, query);
if (handlerMatches != null && handlerMatches.Count() > 0)
{
results = results.Concat(handlerMatches);
}
}
return results.FirstOrDefault();
}
示例3: OnTick
void OnTick(object state)
{
var ready = new Collection<Tuple<Guid, DateTime?>>();
var notReady = new Collection<Tuple<Guid, DateTime?>>();
try
{
Tuple<Guid, DateTime?> item;
_eventStream.Publish<FailedJobQueue>(
EventType.TimerActivity,
EventProperty.ActivityName("RescheduleFailedJobs"),
EventProperty.Named("FailedItemsQueueLength", _jobFailures.Count));
while (_jobFailures.TryTake(out item))
{
if (item.Item2 < _now())
ready.Add(item);
else
notReady.Add(item);
}
foreach(var job in ready.Select(i => _persistenceStore.Load(i.Item1)))
_router.Route(job);
ready.Clear();
}
catch (Exception e)
{
if (e.IsFatal())
throw;
_eventStream.Publish<FailedJobQueue>(e);
}
finally
{
foreach(var item in ready.Concat(notReady))
_jobFailures.Add(item);
_timer.Change(_configuration.RetryTimerInterval, Timeout.InfiniteTimeSpan);
}
}
示例4: WeaveType
private void WeaveType(ModuleDefinition module, TypeDefinition type, Collection<CustomAttribute> assemblyMethodBoundaryAspects)
{
var classMethodBoundaryAspects = type.CustomAttributes;
var propertyGetters = type.Properties
.Where(x => x.GetMethod != null)
.ToDictionary(x => x.GetMethod);
var propertySetters = type.Properties
.Where(x => x.SetMethod != null)
.ToDictionary(x => x.SetMethod);
var weavedAtLeastOneMethod = false;
foreach (var method in type.Methods)
{
if (!IsWeavableMethod(method))
continue;
Collection<CustomAttribute> methodMethodBoundaryAspects;
if (method.IsGetter)
methodMethodBoundaryAspects = propertyGetters[method].CustomAttributes;
else if (method.IsSetter)
methodMethodBoundaryAspects = propertySetters[method].CustomAttributes;
else
methodMethodBoundaryAspects = method.CustomAttributes;
var aspectInfos = assemblyMethodBoundaryAspects
.Concat(classMethodBoundaryAspects)
.Concat(methodMethodBoundaryAspects)
.Where(IsMethodBoundaryAspect)
.Select(x => new AspectInfo(x))
.ToList();
if (aspectInfos.Count == 0)
continue;
weavedAtLeastOneMethod = WeaveMethod(
module,
method,
aspectInfos);
}
if (weavedAtLeastOneMethod)
TotalWeavedTypes++;
}
示例5: Run
private static int Run(RunConfig config)
{
IEnumerable<SearchContent> searchPieces = new Collection<SearchContent>();
if (config.CleanLocalisations)
{
var keys = XamlKeys.Process(config.LocalisationPropertiesToIgnore, config.LocalisationResources);
searchPieces = searchPieces.Concat(keys);
}
if (config.CleanStyles)
{
var styles = XamlStyles.Process(config.StyleResources);
searchPieces = searchPieces.Concat(styles);
}
if (config.CleanImages)
{
var images = Images.Process(config.ImageExtensions, config.ImageRecurse, config.ImageFolders);
searchPieces = searchPieces.Concat(images);
}
var xamlFiles = XamlFiles.FindXamlFiles(config.RootFolder);
searchPieces = XamlFiles.Search(xamlFiles, searchPieces);
if (config.ImageSearchInResources && config.CleanImages && config.CleanLocalisations)
{
searchPieces = XamlKeys.SearchLocalisationValues(config.LocalisationResources, searchPieces);
}
if (config.CleanLocalisations)
{
PrintResult(searchPieces, SearchContentType.ResourceID, "Resources with not match in XAML files", "No used resources :)");
}
if (config.CleanStyles)
{
PrintResult(searchPieces, SearchContentType.BasedOnStyle | SearchContentType.StyleKey, "Styles with no match in XAML files", "No used styles :)");
}
if (config.CleanImages)
{
PrintResult(searchPieces, SearchContentType.Image, "Images with no match in XAML files", "No used images :)");
}
if (config.Beep)
{
Console.Beep();
}
return (int)ExitCode.Success;
}