本文整理汇总了C#中IReadOnlyList类的典型用法代码示例。如果您正苦于以下问题:C# IReadOnlyList类的具体用法?C# IReadOnlyList怎么用?C# IReadOnlyList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IReadOnlyList类属于命名空间,在下文中一共展示了IReadOnlyList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetInsidePoint
public static Point GetInsidePoint(IReadOnlyList<Point> points, Box boundingBox)
{
var y = (boundingBox.MinY + boundingBox.MaxY) / 2;
var xIntersections = new List<double>();
var point1 = points.Last();
foreach (var point2 in points)
{
if ((y > point1.Y) != (y > point2.Y))
{
xIntersections.Add((y - point2.Y) * (point1.X - point2.X) / (point1.Y - point2.Y) + point2.X);
}
point1 = point2;
}
xIntersections.Sort();
Debugger.BreakWhen(xIntersections.Count == 0 || xIntersections.Count % 2 != 0);
var x = (boundingBox.MinX + boundingBox.MaxX) / 2;
var maxDelta = double.NegativeInfinity;
for (var i = 0; i < xIntersections.Count - 1; i += 2)
{
var delta = Math.Abs(xIntersections[i] - xIntersections[i + 1]);
if (delta > maxDelta)
{
x = (xIntersections[i] + xIntersections[i + 1]) / 2;
maxDelta = delta;
}
}
var point = new Point(x, y);
#if DEBUG
Debugger.BreakWhen(!PointInPolygonTest.Contains(points, point));
#endif
return point;
}
开发者ID:rflechner,项目名称:SvgToVectorDrawableConverter,代码行数:32,代码来源:PointInsidePolygonCalculator.cs
示例2: IncludeExpressionVisitor
public IncludeExpressionVisitor(
[NotNull] ISelectExpressionFactory selectExpressionFactory,
[NotNull] IMaterializerFactory materializerFactory,
[NotNull] ICommandBuilderFactory commandBuilderFactory,
[NotNull] IRelationalAnnotationProvider relationalAnnotationProvider,
[NotNull] ISqlQueryGeneratorFactory sqlQueryGeneratorFactory,
[NotNull] IQuerySource querySource,
[NotNull] IReadOnlyList<INavigation> navigationPath,
[NotNull] RelationalQueryCompilationContext queryCompilationContext,
[NotNull] IReadOnlyList<int> queryIndexes,
bool querySourceRequiresTracking)
{
Check.NotNull(selectExpressionFactory, nameof(selectExpressionFactory));
Check.NotNull(materializerFactory, nameof(materializerFactory));
Check.NotNull(commandBuilderFactory, nameof(commandBuilderFactory));
Check.NotNull(relationalAnnotationProvider, nameof(relationalAnnotationProvider));
Check.NotNull(sqlQueryGeneratorFactory, nameof(sqlQueryGeneratorFactory));
Check.NotNull(querySource, nameof(querySource));
Check.NotNull(navigationPath, nameof(navigationPath));
Check.NotNull(queryCompilationContext, nameof(queryCompilationContext));
Check.NotNull(queryIndexes, nameof(queryIndexes));
_selectExpressionFactory = selectExpressionFactory;
_materializerFactory = materializerFactory;
_commandBuilderFactory = commandBuilderFactory;
_relationalAnnotationProvider = relationalAnnotationProvider;
_sqlQueryGeneratorFactory = sqlQueryGeneratorFactory;
_querySource = querySource;
_navigationPath = navigationPath;
_queryCompilationContext = queryCompilationContext;
_queryIndexes = queryIndexes;
_querySourceRequiresTracking = querySourceRequiresTracking;
}
开发者ID:491134648,项目名称:EntityFramework,代码行数:33,代码来源:IncludeExpressionVisitor.cs
示例3: TryResolve
public VariablePathResolvingStatus TryResolve(IEnumerable<KeyValuePair<string, string>> variables, out IAbsoluteFilePath resolvedPath,
out IReadOnlyList<string> unresolvedVariables)
{
Argument.IsNotNull(nameof(variables), variables);
string path;
if (!TryResolve(variables, out path, out unresolvedVariables))
{
resolvedPath = null;
return VariablePathResolvingStatus.UnresolvedVariable;
}
if (!path.IsValidAbsoluteFilePath())
{
resolvedPath = null;
return VariablePathResolvingStatus.CannotConvertToAbsolutePath;
}
resolvedPath = path.ToAbsoluteFilePath();
return VariablePathResolvingStatus.Success;
}
开发者ID:ME3Explorer,项目名称:ME3Explorer,代码行数:25,代码来源:PathHelpers.VariableFilePath.cs
示例4: SqlForeignKeyConstraintExpression
public SqlForeignKeyConstraintExpression(string constraintName, IReadOnlyList<string> columnNames, SqlReferencesColumnExpression referencesColumnExpression)
: base(typeof(void))
{
this.ConstraintName = constraintName;
this.ColumnNames = columnNames;
this.ReferencesColumnExpression = referencesColumnExpression;
}
开发者ID:ciker,项目名称:Shaolinq,代码行数:7,代码来源:SqlForeignKeyConstraintExpression.cs
示例5: BulkWriteOperationResult
// constructors
/// <summary>
/// Initializes a new instance of the <see cref="BulkWriteOperationResult" /> class.
/// </summary>
/// <param name="requestCount">The request count.</param>
/// <param name="processedRequests">The processed requests.</param>
protected BulkWriteOperationResult(
int requestCount,
IReadOnlyList<WriteRequest> processedRequests)
{
_requestCount = requestCount;
_processedRequests = processedRequests;
}
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:13,代码来源:BulkWriteOperationResult.cs
示例6: FairPartitionResolver
public FairPartitionResolver(IReadOnlyList<string> collectionLinks)
{
Guard.NotNull("collectionLinks", collectionLinks);
this.collectionLinks = collectionLinks;
this.random = new ThreadLocal<Random>(CreateNewRandom);
}
开发者ID:kingkino,项目名称:azure-documentdb-datamigrationtool,代码行数:7,代码来源:FairPartitionResolver.cs
示例7: Execute
public IEnumerable<IDocument> Execute(IReadOnlyList<IDocument> inputs, IExecutionContext context)
{
if (_modules != null)
{
Dictionary<string, object> metadata = new Dictionary<string, object>();
// Execute the modules for each input document
if (_forEachDocument)
{
return inputs.Select(input =>
{
foreach (IDocument result in context.Execute(_modules, new[] { input }))
{
foreach (KeyValuePair<string, object> kvp in result)
{
metadata[kvp.Key] = kvp.Value;
}
}
return input.Clone(metadata);
});
}
// Execute the modules once and apply to each input document
foreach (IDocument result in context.Execute(_modules))
{
foreach (KeyValuePair<string, object> kvp in result)
{
metadata[kvp.Key] = kvp.Value;
}
}
return inputs.Select(input => input.Clone(metadata));
}
return inputs.Select(x => x.Clone(new [] { new KeyValuePair<string, object>(_key, _metadata.GetValue(x, context)) }));
}
开发者ID:st1pps,项目名称:Wyam,代码行数:35,代码来源:Meta.cs
示例8: RSessionEvaluation
public RSessionEvaluation(IReadOnlyList<IRContext> contexts, IRExpressionEvaluator evaluator, CancellationToken ct) {
Contexts = contexts;
_evaluator = evaluator;
_tcs = new TaskCompletionSource<object>();
_ct = ct;
ct.Register(() => _tcs.TrySetCanceled());
}
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:7,代码来源:RSessionEvaluation.cs
示例9: Save
public static void Save(IReadOnlyList<Contribution> contributions)
{
Guard.AgainstNullArgument(nameof(contributions), contributions);
using (var writer = new StreamWriter("contributions.txt", false))
{
writer.Write("Login/Group");
foreach (var group in contributions.Select(contribution => contribution.Group).Distinct())
{
writer.Write("\t" + @group);
}
writer.WriteLine();
foreach (var login in contributions.Select(contribution => contribution.Login).Distinct())
{
writer.Write(login);
foreach (var group in contributions.Select(contribution => contribution.Group).Distinct())
{
var contribution =
contributions.SingleOrDefault(
candidate => candidate.Group == @group && candidate.Login == login);
writer.Write(
"\t" +
(contribution?.Score.ToString(CultureInfo.InvariantCulture) ?? "0"));
}
writer.WriteLine();
}
}
}
开发者ID:ParticularLabs,项目名称:Uranium,代码行数:32,代码来源:TsvContributionsRepository.cs
示例10: CreateServiceBus
public IBusControl CreateServiceBus(MassTransitOptions options, IReadOnlyList<Action<IReceiveEndpointConfigurator>> commandSubscriptions, IReadOnlyList<Action<IReceiveEndpointConfigurator>> eventSubscriptions)
{
return Bus.Factory.CreateUsingInMemory(cfg =>
{
cfg.UseJsonSerializer();
cfg.UseConcurrencyLimit(options.ConcurrencyLimit);
if (commandSubscriptions.Any())
{
cfg.ReceiveEndpoint(options.CommandQueueNameStrategy.GetQueueName(), endpoint =>
{
endpoint.UseRetry(options.CommandErrorPolicy);
foreach (var subscription in commandSubscriptions)
subscription(endpoint);
});
}
if (eventSubscriptions.Any())
{
cfg.ReceiveEndpoint(options.EventQueueNameStrategy.GetQueueName(), endpoint =>
{
endpoint.UseRetry(options.EventErrorPolicy);
foreach (var subscription in eventSubscriptions)
subscription(endpoint);
});
}
});
}
开发者ID:Nybus-project,项目名称:Nybus.MassTransit3,代码行数:30,代码来源:LoopbackServiceBusFactory.cs
示例11: Validate
public async Task<IList<Mutation>> Validate(ParsedMutation mutation, IReadOnlyList<SignatureEvidence> authentication, IReadOnlyDictionary<AccountKey, AccountStatus> accounts)
{
await ValidateAccountMutations(mutation.AccountMutations, accounts, authentication);
await ValidateDataMutations(mutation.DataRecords, authentication);
return new Mutation[0];
}
开发者ID:openchain,项目名称:openchain,代码行数:7,代码来源:PermissionBasedValidator.cs
示例12: AddImplements
public static void AddImplements(this TypeBuilder builder, IReadOnlyList<TypeStructure> imp)
{
foreach (var v in imp)
{
builder.AddInterfaceImplementation(v.GainType());
}
}
开发者ID:B-head,项目名称:Dreit-prototype,代码行数:7,代码来源:TranslateUtility.cs
示例13: Execute
public IEnumerable<IDocument> Execute(IReadOnlyList<IDocument> inputs, IExecutionContext context)
{
foreach (IDocument input in inputs)
{
string path = _path(input);
if (path != null)
{
path = Path.Combine(context.InputFolder, path);
string fileRoot = Path.GetDirectoryName(path);
if (fileRoot != null && Directory.Exists(fileRoot))
{
foreach (string file in Directory.EnumerateFiles(fileRoot, Path.GetFileName(path), _searchOption).Where(x => _where == null || _where(x)))
{
string content = File.ReadAllText(file);
context.Trace.Verbose("Read file {0}", file);
yield return input.Clone(content, new Dictionary<string, object>
{
{MetadataKeys.SourceFileRoot, fileRoot},
{MetadataKeys.SourceFileBase, Path.GetFileNameWithoutExtension(file)},
{MetadataKeys.SourceFileExt, Path.GetExtension(file)},
{MetadataKeys.SourceFileName, Path.GetFileName(file)},
{MetadataKeys.SourceFileDir, Path.GetDirectoryName(file)},
{MetadataKeys.SourceFilePath, file},
{MetadataKeys.RelativeFilePath, Path.Combine(PathHelper.GetRelativePath(context.InputFolder, file))}
});
}
}
}
}
}
开发者ID:tareq-s,项目名称:Wyam,代码行数:30,代码来源:ReadFiles.cs
示例14: WebSocketRfc6455
public WebSocketRfc6455(Stream clientStream, WebSocketListenerOptions options, IPEndPoint local, IPEndPoint remote, WebSocketHttpRequest httpRequest, IReadOnlyList<IWebSocketMessageExtensionContext> extensions)
{
if (clientStream == null)
throw new ArgumentNullException("clientStream");
if (options == null)
throw new ArgumentNullException("options");
if (local == null)
throw new ArgumentNullException("local");
if (remote == null)
throw new ArgumentNullException("remote");
if (extensions == null)
throw new ArgumentNullException("extensions");
if (httpRequest == null)
throw new ArgumentNullException("httpRequest");
_remoteEndpoint = remote;
_localEndpoint = local;
_httpRequest = httpRequest;
Connection = new WebSocketConnectionRfc6455(clientStream, options);
_extensions = extensions;
}
开发者ID:Nepomuceno,项目名称:WebSocketListener,代码行数:27,代码来源:WebSocketRfc6455.cs
示例15: GetPermissions
public Task<PermissionSet> GetPermissions(IReadOnlyList<SignatureEvidence> authentication, LedgerPath path, bool recursiveOnly, string recordName)
{
HashSet<string> identities = new HashSet<string>(authentication.Select(evidence => keyEncoder.GetPubKeyHash(evidence.PublicKey)), StringComparer.Ordinal);
LedgerPath pathRecordName;
// If the path is root and the record name is a tird-party asset owned by the current identity,
// arbitrary modification of the balance is allowed
if (LedgerPath.TryParse(recordName, out pathRecordName)
&& thirdPartyAssetPath.IsStrictParentOf(pathRecordName)
&& path.Segments.Count == 0
&& identities.Contains(pathRecordName.Segments[thirdPartyAssetPath.Segments.Count]))
{
return Task.FromResult(new PermissionSet(accountNegative: Access.Permit));
}
// Account /asset/p2pkh/[addr]/
if (thirdPartyAssetPath.IsStrictParentOf(path)
&& path.Segments.Count == thirdPartyAssetPath.Segments.Count + 1
&& keyEncoder.IsP2pkh(path.Segments[path.Segments.Count - 1]))
{
Access ownAccount = identities.Contains(path.Segments[path.Segments.Count - 1]) && recordName != DynamicPermissionLayout.AclResourceName
? Access.Permit : Access.Unset;
return Task.FromResult(new PermissionSet(
accountModify: Access.Permit,
accountCreate: Access.Permit,
accountSpend: ownAccount,
dataModify: ownAccount));
}
else
{
return Task.FromResult(new PermissionSet());
}
}
开发者ID:juanfranblanco,项目名称:openchain,代码行数:34,代码来源:P2pkhIssuanceImplicitLayout.cs
示例16: Calculate
private static List<SectionTime> Calculate(IReadOnlyList<IAnimationSection> animationSections, DateTime startTime)
{
return animationSections
.Scan(new SectionTime(null, startTime), (acc, section) => new SectionTime(section, acc.EndTime + section.Duration))
.Skip(1)
.ToList();
}
开发者ID:Weingartner,项目名称:SolidworksAddinFramework,代码行数:7,代码来源:Animator.cs
示例17: PostTweetAsync
/// <summary>
/// ツイートを投稿する
/// </summary>
/// <param name="t">ツイート本文</param>
/// <param name="selectedPictures">選択された画像ファイルの List</param>
public async void PostTweetAsync(string t, IReadOnlyList<StorageFile> selectedPictures)
{
var mediaIds = await this.UploadPictures(selectedPictures);
var replayToStatusId = this._replyToStatus?.Id;
await this._tokens.Statuses.UpdateAsync(status => t, in_reply_to_status_id => replayToStatusId, media_ids => mediaIds);
this._replyToStatus = null;
}
开发者ID:tomoyashibata,项目名称:Geopelia,代码行数:12,代码来源:TwitterClient.cs
示例18: BuildMetricFilter
internal static string BuildMetricFilter(DateTime? startTime, DateTime? endTime, string timeGrain, IReadOnlyList<string> metricNames)
{
var dateTimeFormat = "yyyy-MM-ddTHH:mm:ssZ";
var filter = "";
if (metricNames != null && metricNames.Count > 0)
{
if (metricNames.Count == 1)
{
filter = "name.value eq '" + metricNames[0] + "'";
}
else
{
filter = "(name.value eq '" + string.Join("' or name.value eq '", metricNames) + "')";
}
}
if (startTime.HasValue)
{
filter += string.Format("and startTime eq {0}", startTime.Value.ToString(dateTimeFormat));
}
if (endTime.HasValue)
{
filter += string.Format("and endTime eq {0}", endTime.Value.ToString(dateTimeFormat));
}
if (!string.IsNullOrWhiteSpace(timeGrain))
{
filter += string.Format("and timeGrain eq duration'{0}'", timeGrain);
}
return filter;
}
开发者ID:takekazuomi,项目名称:azure-powershell,代码行数:33,代码来源:CmdletHelpers.cs
示例19: Execute
public IEnumerable<IDocument> Execute(IReadOnlyList<IDocument> inputs, IExecutionContext context)
{
List<IDocument> results = new List<IDocument>();
IEnumerable<IDocument> documents = inputs;
foreach (Tuple<DocumentConfig, IModule[]> condition in _conditions)
{
// Split the documents into ones that satisfy the predicate and ones that don't
List<IDocument> handled = new List<IDocument>();
List<IDocument> unhandled = new List<IDocument>();
foreach (IDocument document in documents)
{
if (condition.Item1 == null || condition.Item1.Invoke<bool>(document, context))
{
handled.Add(document);
}
else
{
unhandled.Add(document);
}
}
// Run the modules on the documents that satisfy the predicate
results.AddRange(context.Execute(condition.Item2, handled));
// Continue with the documents that don't satisfy the predicate
documents = unhandled;
}
// Add back any documents that never matched a predicate
results.AddRange(documents);
return results;
}
开发者ID:ibebbs,项目名称:Wyam,代码行数:33,代码来源:If.cs
示例20: Execute
public IEnumerable<IDocument> Execute(IReadOnlyList<IDocument> inputs, IExecutionContext context)
{
return inputs
.AsParallel()
.Select(input =>
{
try
{
object data = _data(input, context);
if (data != null)
{
string result = JsonConvert.SerializeObject(data,
_indenting ? Formatting.Indented : Formatting.None);
if (string.IsNullOrEmpty(_destinationKey))
{
return context.GetDocument(input, result);
}
return context.GetDocument(input, new MetadataItems
{
{_destinationKey, result}
});
}
}
catch (Exception ex)
{
Trace.Error("Error serializing JSON for {0}: {1}", input.Source, ex.ToString());
}
return input;
})
.Where(x => x != null);
}
开发者ID:ryanrousseau,项目名称:Wyam,代码行数:31,代码来源:GenerateJson.cs
注:本文中的IReadOnlyList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论