本文整理汇总了C#中IEnumerable.Concat方法的典型用法代码示例。如果您正苦于以下问题:C# IEnumerable.Concat方法的具体用法?C# IEnumerable.Concat怎么用?C# IEnumerable.Concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnumerable
的用法示例。
在下文中一共展示了IEnumerable.Concat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoRepackForCmd
public static void DoRepackForCmd(IEnumerable<string> args)
{
var repackOptions = new RepackOptions(args.Concat(new[] { "/log" }));
var repack = new ILRepacking.ILRepack(repackOptions);
repack.Repack();
ReloadAndCheckReferences(repackOptions);
}
示例2: ReduceGroup
private static IEnumerable<KeyValuePair<IndexedName, RealNode>> ReduceGroup(
IEnumerable<KeyValuePair<IndexedName, RealNode>> aggr, IGrouping<XName, RealNode> items)
{
var addition = items.Select((elem, i) =>
new KeyValuePair<IndexedName, RealNode>(new IndexedName(items.Key, i), elem));
return aggr.Concat(addition);
}
示例3: GetLocalSymbols
public static IEnumerable<SymbolExpression> GetLocalSymbols(this ContainerExpression container, IEnumerable<String> locals)
{
var list = new List<SymbolExpression>();
var expressions = container.Expressions;
if (expressions != null)
{
var op = container.Operator as FatArrowOperator;
if (op != null)
{
var left = expressions.FirstOrDefault();
var right = expressions.LastOrDefault();
if (left != null)
{
var symbols = new List<SymbolExpression>();
left.CollectSymbols(symbols);
list.AddRange(symbols);
var newLocals = locals.Concat(symbols.Select(m => m.SymbolName));
right.CollectLocalSymbols(list, newLocals);
}
}
else
{
foreach (var expression in expressions)
{
expression.CollectLocalSymbols(list, locals);
}
}
}
return list;
}
示例4: ParameterValueReader
public ParameterValueReader(IEnumerable<IValueExpressionFactory> expressionFactories)
{
_expressionFactories = expressionFactories.Concat(
new IValueExpressionFactory[]
{
new EnumExpressionFactory(),
new BooleanExpressionFactory(),
new ByteExpressionFactory(),
new GuidExpressionFactory(),
new DateTimeExpressionFactory(),
new TimeSpanExpressionFactory(),
new DateTimeOffsetExpressionFactory(),
new DecimalExpressionFactory(),
new DoubleExpressionFactory(),
new SingleExpressionFactory(),
new ByteArrayExpressionFactory(),
new StreamExpressionFactory(),
new LongExpressionFactory(),
new IntExpressionFactory(),
new ShortExpressionFactory(),
new UnsignedIntExpressionFactory(),
new UnsignedLongExpressionFactory(),
new UnsignedShortExpressionFactory()
})
.ToList();
}
示例5: StaffingGetRange
/// <summary>
/// Get information about specified staffing identifiers
/// </summary>
/// <returns>Result info</returns>
public Model.StaffingExecutionResults StaffingGetRange(IEnumerable<long> identifiers)
{
UpdateSessionCulture();
using (var logSession = Helpers.Log.Session($"{GetType()}.{System.Reflection.MethodBase.GetCurrentMethod().Name}()", VerboseLog, RaiseLog))
try
{
using (var rep = GetNewRepository(logSession))
{
SRVCCheckCredentials(logSession, rep, Repository.Model.RightType.Login);
var res = rep.Get<Repository.Model.Staffing>(e => identifiers.Contains(e.StaffingId), asNoTracking: true)
.ToArray()
.Select(i => AutoMapper.Mapper.Map<Model.Staffing>(i))
.ToArray();
return new StaffingExecutionResults(res);
}
}
catch (Exception ex)
{
ex.Data.Add(nameof(identifiers), identifiers.Concat(i => i.ToString(), ","));
logSession.Enabled = true;
logSession.Add(ex);
return new StaffingExecutionResults(ex);
}
}
示例6: CreateTemplateService
/// <summary>
/// Creates an instance of a <see cref="TemplateService"/>.
/// </summary>
/// <param name="configuration">The <see cref="TemplateServiceConfigurationElement"/> that represents the configuration.</param>
/// <param name="defaultNamespaces">The enumerable of namespaces to add as default.</param>
/// <returns>A new instance of <see cref="TemplateService"/>.</returns>
public static TemplateService CreateTemplateService(TemplateServiceConfigurationElement configuration, IEnumerable<string> defaultNamespaces = null)
{
if (configuration == null)
throw new ArgumentNullException("configuration");
ILanguageProvider provider = null;
MarkupParser parser = null;
Type templateBaseType = null;
if (!string.IsNullOrEmpty(configuration.LanguageProvider))
provider = (ILanguageProvider)GetInstance(configuration.LanguageProvider);
if (!string.IsNullOrEmpty(configuration.MarkupParser))
parser = (MarkupParser)GetInstance(configuration.MarkupParser);
if (!string.IsNullOrEmpty(configuration.TemplateBase))
templateBaseType = GetType(configuration.TemplateBase);
var namespaces = configuration.Namespaces
.Cast<NamespaceConfigurationElement>()
.Select(n => n.Namespace);
if (defaultNamespaces != null)
{
namespaces = defaultNamespaces
.Concat(namespaces)
.Distinct();
}
var service = new TemplateService(provider, templateBaseType, parser);
foreach (string ns in namespaces)
service.Namespaces.Add(ns);
return service;
}
示例7: GetValidators
protected override IEnumerable<ModelValidator> GetValidators(ModelMetadata metadata, ControllerContext context, IEnumerable<Attribute> attributes) {
_adaptersLock.EnterReadLock();
try {
List<ModelValidator> results = new List<ModelValidator>();
if (AddImplicitRequiredAttributeForValueTypes &&
metadata.IsRequired &&
!attributes.Any(a => a is RequiredAttribute)) {
attributes = attributes.Concat(new[] { new RequiredAttribute() });
}
foreach (ValidationAttribute attribute in attributes.OfType<ValidationAttribute>()) {
DataAnnotationsModelValidationFactory factory;
if (!AttributeFactories.TryGetValue(attribute.GetType(), out factory)) {
factory = DefaultAttributeFactory;
}
results.Add(factory(metadata, context, attribute));
}
return results;
}
finally {
_adaptersLock.ExitReadLock();
}
}
示例8: MemberInfoProxyBase
protected MemberInfoProxyBase(System.Reflection.MemberInfo fieldInfo, IEnumerable<string> aliases)
{
_names = aliases
.Concat(new[] { fieldInfo.Name })
.Distinct()
.ToList();
}
示例9: Build
public DependencyContext Build(CommonCompilerOptions compilerOptions,
IEnumerable<LibraryExport> compilationExports,
IEnumerable<LibraryExport> runtimeExports,
bool portable,
NuGetFramework target,
string runtime)
{
if (compilationExports == null)
{
compilationExports = Enumerable.Empty<LibraryExport>();
}
var dependencyLookup = compilationExports
.Concat(runtimeExports)
.Select(export => export.Library.Identity)
.Distinct()
.Select(identity => new Dependency(identity.Name, identity.Version.ToString()))
.ToDictionary(dependency => dependency.Name);
var compilationOptions = compilerOptions != null
? GetCompilationOptions(compilerOptions)
: CompilationOptions.Default;
var runtimeSignature = GenerateRuntimeSignature(runtimeExports);
return new DependencyContext(
new TargetInfo(target.DotNetFrameworkName, runtime, runtimeSignature, portable),
compilationOptions,
GetLibraries(compilationExports, dependencyLookup, runtime: false).Cast<CompilationLibrary>(),
GetLibraries(runtimeExports, dependencyLookup, runtime: true).Cast<RuntimeLibrary>(),
new RuntimeFallbacks[] {});
}
示例10: VisitExpression
protected override Expression VisitExpression(Expression exp)
{
// Store the opinion of previously traversed node (which is most likely our left sibling or
// alternatively the right-most child of one of our parents' left-sibling)
var prevCanBeExecutedLocally = _canBeExecutedLocally;
var prevUnresolvedVars = _unresolvedVars;
// Find out the opinion of the node itself (which will typically ask its children via base.Visit
// and will add spice it up with its own logics)
_canBeExecutedLocally = true;
_unresolvedVars = new List<ParameterExpression>();
exp = base.VisitExpression(exp);
if (exp != null)
{
if (!_simplificationMap.ContainsKey(exp))
{
_simplificationMap.Add(exp, _canBeExecutedLocally && _unresolvedVars.Count() == 0);
}
}
// Restore the opinion of previously traversed node (this is important so that parent will get a
// joint opinion of all its children, not just the very right-most one's)
_canBeExecutedLocally &= prevCanBeExecutedLocally;
_unresolvedVars = _unresolvedVars.Concat(prevUnresolvedVars);
return exp;
}
示例11: Download
/// <summary>
/// Downloads the results of query defined by <paramref name="parameters"/>.
/// </summary>
public XDocument Download(IEnumerable<HttpQueryParameterBase> parameters)
{
parameters = parameters.ToArray();
if (LogDownloading)
LogRequest(parameters);
parameters = new[] { new HttpQueryParameter("format", "xml") }.Concat(parameters);
if (UseMaxlag)
parameters = parameters.Concat(new[] { new HttpQueryParameter("maxlag", "5") });
var client = new RestClient
{
BaseUrl = new Uri(m_wiki.ApiUrl.AbsoluteUri + "?rawcontinue"),
CookieContainer = m_cookies,
UserAgent = UserAgent
};
var request = new RestRequest(Method.POST);
WriteParameters(parameters, request);
var response = client.Execute(request);
return XDocument.Parse(response.Content);
}
示例12: EdiPropertyDescriptor
public EdiPropertyDescriptor(PropertyInfo info, IEnumerable<EdiAttribute> attributes) {
_Info = info;
if (attributes == null) {
attributes = info.GetCustomAttributes<EdiAttribute>()
.Concat(info.PropertyType.GetTypeInfo().GetCustomAttributes<EdiAttribute>());
if (info.PropertyType.IsCollectionType()) {
var itemType = default(Type);
if (info.PropertyType.HasElementType) {
itemType = info.PropertyType.GetElementType();
} else {
itemType = Info.PropertyType.GetGenericArguments().First();
}
attributes = attributes.Concat(itemType.GetTypeInfo().GetCustomAttributes<EdiAttribute>());
}
}
_Attributes = attributes.ToList();
_PathInfo = Attributes.OfType<EdiPathAttribute>().FirstOrDefault();
_ConditionInfo = Attributes.OfType<EdiConditionAttribute>().FirstOrDefault();
_ValueInfo = Attributes.OfType<EdiValueAttribute>().FirstOrDefault();
_SegmentGroupInfo = Attributes.OfType<EdiSegmentGroupAttribute>().FirstOrDefault();
if (_ValueInfo != null && _ValueInfo.Path != null && _PathInfo == null) {
_PathInfo = new EdiPathAttribute(_ValueInfo.Path);
}
if (_SegmentGroupInfo != null && _SegmentGroupInfo.StartInternal.Segment != null && _PathInfo == null) {
_PathInfo = new EdiPathAttribute(_SegmentGroupInfo.StartInternal.Segment);
}
}
示例13: UploadMultipleList
public IDictionary<string, IList<FileDetails>> UploadMultipleList(IEnumerable<IFormFile> filelist1,
IEnumerable<IFormFile> filelist2)
{
var fileDetailsDict = new Dictionary<string, IList<FileDetails>>
{
{ "filelist1", new List<FileDetails>() },
{ "filelist2", new List<FileDetails>() }
};
var fileDetailsList = new List<FileDetails>();
foreach (var file in filelist1.Concat(filelist2))
{
var parsedContentDisposition = ContentDispositionHeaderValue.Parse(file.ContentDisposition);
using (var reader = new StreamReader(file.OpenReadStream()))
{
var fileContent = reader.ReadToEnd();
var fileDetails = new FileDetails
{
Filename = parsedContentDisposition.FileName,
Content = fileContent
};
fileDetailsDict[parsedContentDisposition.Name].Add(fileDetails);
}
}
return fileDetailsDict;
}
示例14: SetRemoteRepositories
IEnumerable<ICommandOutput> SetRemoteRepositories()
{
_remoteRepositories = new[] { HostEnvironment.CurrentDirectoryRepository, HostEnvironment.SystemRepository }
.Concat(Remotes.FetchRepositories());
if (HostEnvironment.ProjectRepository != null)
_remoteRepositories = _remoteRepositories.Concat(new[] { HostEnvironment.ProjectRepository });
yield break;
}
示例15: GenericAction
private GenericAction(String name, IEnumerable<IObjectTreeNode> attributes, IEnumerable<IObjectTreeNode> elements)
{
_name = name;
Children = attributes
.Concat(elements)
.ToList();
}