System.Collections.Generic.List.Add((Checksum, object))

Here are the examples of the csharp api class System.Collections.Generic.List.Add((Checksum, object)) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

1. Example

View license
private IList<(Checksum, object)> ReadAssets(
                Stream stream, int scopeId, ISet<Checksum> checksums, CancellationToken cancellationToken)
            {
                var results = new List<(Checksum, object)>();

                using (var reader = ObjectReader.TryGetReader(stream, cancellationToken))
                {
                    Debug.Assert(reader != null,
@"We only ge a reader for data transmitted between live processes.
This data should always be correct as we're never persisting the data between sessions.");

                    var responseScopeId = reader.ReadInt32();
                    Contract.ThrowIfFalse(scopeId == responseScopeId);

                    var count = reader.ReadInt32();
                    Contract.ThrowIfFalse(count == checksums.Count);

                    for (var i = 0; i < count; i++)
                    {
                        var responseChecksum = Checksum.ReadFrom(reader);
                        Contract.ThrowIfFalse(checksums.Contains(responseChecksum));

                        var kind = (WellKnownSynchronizationKind)reader.ReadInt32();

                        // in service hub, cancellation means simply closed stream
                        var @object = AssetService.Deserialize<object>(kind, reader, cancellationToken);

                        results.Add((responseChecksum, @object));
                    }

                    return results;
                }
            }

2. Example

Project: roslyn
Source File: TestAssetSource.cs
View license
public override Task<IList<(Checksum, object)>> RequestAssetsAsync(
            int serviceId, ISet<Checksum> checksums, CancellationToken cancellationToken)
        {
            var list = new List<(Checksum, object)>();

            foreach (var checksum in checksums)
            {
                Assert.True(_map.TryGetValue(checksum, out var data));

                list.Add(ValueTuple.Create(checksum, data));
            }

            return Task.FromResult<IList<(Checksum, object)>>(list);
        }