275 references to ArraySegment
AutobahnTestApp (2)
Startup.cs (2)
42var result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), cancellationToken); 46result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), cancellationToken);
dotnet-svcutil-lib (2)
FrameworkFork\System.Runtime.Serialization\System\Xml\EncodingStreamWrapper.cs (1)
526seg = new ArraySegment<byte>(s_validatingUTF8.GetBytes(GetEncoding(declEnc).GetChars(buffer, offset, count)));
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (1)
1272_webSocket.ReceiveAsync(new ArraySegment<byte>(_initialReadBuffer.Array), cancelToken);
ExceptionHandlerSample (1)
StartupWithWebSocket.cs (1)
32await ws.SendAsync(new ArraySegment<byte>(Encoding.UTF8.GetBytes("Hello")), System.Net.WebSockets.WebSocketMessageType.Text, true, context.RequestAborted);
GenerateDocumentationAndConfigFiles (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
IIS.FunctionalTests (1)
src\Servers\IIS\IIS\test\Common.FunctionalTests\WebSocketTests.cs (1)
190await webSocket.SendAsync(new ArraySegment<byte>(Encoding.ASCII.GetBytes(message)), WebSocketMessageType.Text, true, default);
IISExpress.FunctionalTests (1)
src\Servers\IIS\IIS\test\Common.FunctionalTests\WebSocketTests.cs (1)
190await webSocket.SendAsync(new ArraySegment<byte>(Encoding.ASCII.GetBytes(message)), WebSocketMessageType.Text, true, default);
InProcessWebSite (4)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.WebSockets.cs (4)
138await webSocket.SendAsync(new ArraySegment<byte>(Encoding.ASCII.GetBytes(message)), WebSocketMessageType.Text, true, CancellationToken.None); 166var result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), token); 182result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), token); 215result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
Metrics (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
Metrics.Legacy (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
Microsoft.AspNetCore.Components.Server (1)
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\BufferWriter.cs (1)
83_segment = new ArraySegment<byte>(array);
Microsoft.AspNetCore.DataProtection (16)
AuthenticatedEncryption\AuthenticatedEncryptorExtensions.cs (4)
47var protectedData = encryptor.Encrypt(new ArraySegment<byte>(plaintextAsBytes), new ArraySegment<byte>(aad)); 48var roundTrippedData = encryptor.Decrypt(new ArraySegment<byte>(protectedData), new ArraySegment<byte>(aad));
AuthenticatedEncryption\ConfigurationModel\SecretExtensions.cs (1)
28secret.WriteSecretIntoBuffer(new ArraySegment<byte>(unprotectedSecretRawBytes));
Cng\DpapiSecretSerializerHelper.cs (2)
52secret.WriteSecretIntoBuffer(new ArraySegment<byte>(plaintextSecret)); 128secret.WriteSecretIntoBuffer(new ArraySegment<byte>(plaintextSecret));
KeyManagement\KeyRingBasedDataProtector.cs (3)
116plaintext: new ArraySegment<byte>(plaintext), 117additionalAuthenticatedData: new ArraySegment<byte>(aad), 282ArraySegment<byte> additionalAuthenticatedData = new ArraySegment<byte>(_aadTemplate.GetAadForKey(keyIdFromPayload, isProtecting: false));
Managed\AesGcmAuthenticatedEncryptor.cs (2)
112_keyDerivationKey.WriteSecretIntoBuffer(new ArraySegment<byte>(decryptedKdk)); 185_keyDerivationKey.WriteSecretIntoBuffer(new ArraySegment<byte>(decryptedKdk));
Managed\ManagedAuthenticatedEncryptor.cs (1)
75var EMPTY_ARRAY_SEGMENT = new ArraySegment<byte>(EMPTY_ARRAY);
Secret.cs (2)
41: this(new ArraySegment<byte>(value)) 88secret.WriteSecretIntoBuffer(new ArraySegment<byte>(tempPlaintextBuffer));
XmlEncryption\XmlEncryptionExtensions.cs (1)
191secret.WriteSecretIntoBuffer(new ArraySegment<byte>(plaintextSecret));
Microsoft.AspNetCore.DataProtection.Tests (73)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorDeserializerTests.cs (4)
39byte[] ciphertext = control.Encrypt(new ArraySegment<byte>(plaintext), new ArraySegment<byte>(aad)); 40byte[] roundTripPlaintext = test.Decrypt(new ArraySegment<byte>(ciphertext), new ArraySegment<byte>(aad));
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorTests.cs (16)
47byte[] ciphertext = control.Encrypt(new ArraySegment<byte>(plaintext), new ArraySegment<byte>(aad)); 48byte[] roundTripPlaintext = test.Decrypt(new ArraySegment<byte>(ciphertext), new ArraySegment<byte>(aad)); 73byte[] ciphertext = control.Encrypt(new ArraySegment<byte>(plaintext), new ArraySegment<byte>(aad)); 74byte[] roundTripPlaintext = test.Decrypt(new ArraySegment<byte>(ciphertext), new ArraySegment<byte>(aad)); 99byte[] ciphertext = control.Encrypt(new ArraySegment<byte>(plaintext), new ArraySegment<byte>(aad)); 100byte[] roundTripPlaintext = test.Decrypt(new ArraySegment<byte>(ciphertext), new ArraySegment<byte>(aad)); 137byte[] ciphertext = control.Encrypt(new ArraySegment<byte>(plaintext), new ArraySegment<byte>(aad)); 138byte[] roundTripPlaintext = test.Decrypt(new ArraySegment<byte>(ciphertext), new ArraySegment<byte>(aad));
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptorDeserializerTests.cs (4)
46byte[] ciphertext = control.Encrypt(new ArraySegment<byte>(plaintext), new ArraySegment<byte>(aad)); 47byte[] roundTripPlaintext = test.Decrypt(new ArraySegment<byte>(ciphertext), new ArraySegment<byte>(aad));
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptorDeserializerTests.cs (4)
43byte[] ciphertext = control.Encrypt(new ArraySegment<byte>(plaintext), new ArraySegment<byte>(aad)); 44byte[] roundTripPlaintext = test.Decrypt(new ArraySegment<byte>(ciphertext), new ArraySegment<byte>(aad));
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs (8)
47byte[] ciphertext = control.Encrypt(new ArraySegment<byte>(plaintext), new ArraySegment<byte>(aad)); 48byte[] roundTripPlaintext = test.Decrypt(new ArraySegment<byte>(ciphertext), new ArraySegment<byte>(aad)); 81byte[] ciphertext = control.Encrypt(new ArraySegment<byte>(plaintext), new ArraySegment<byte>(aad)); 82byte[] roundTripPlaintext = test.Decrypt(new ArraySegment<byte>(ciphertext), new ArraySegment<byte>(aad));
Cng\CbcAuthenticatedEncryptorTests.cs (10)
24ArraySegment<byte> plaintext = new ArraySegment<byte>(Encoding.UTF8.GetBytes("plaintext")); 25ArraySegment<byte> aad = new ArraySegment<byte>(Encoding.UTF8.GetBytes("aad")); 29byte[] decipheredtext = encryptor.Decrypt(new ArraySegment<byte>(ciphertext), aad); 45ArraySegment<byte> plaintext = new ArraySegment<byte>(Encoding.UTF8.GetBytes("plaintext")); 46ArraySegment<byte> aad = new ArraySegment<byte>(Encoding.UTF8.GetBytes("aad")); 54encryptor.Decrypt(new ArraySegment<byte>(invalidCiphertext_tooShort), aad); 63encryptor.Decrypt(new ArraySegment<byte>(invalidCiphertext_manipulated), aad); 71encryptor.Decrypt(new ArraySegment<byte>(invalidCiphertext_tooLong), aad); 78encryptor.Decrypt(new ArraySegment<byte>(validCiphertext), new ArraySegment<byte>(Encoding.UTF8.GetBytes("different aad")));
Cng\CngAuthenticatedEncryptorBaseTests.cs (2)
40var aad = new ArraySegment<byte>(new byte[0]); 64var ciphertext = new ArraySegment<byte>(new byte[0]);
Cng\GcmAuthenticatedEncryptorTests.cs (10)
21ArraySegment<byte> plaintext = new ArraySegment<byte>(Encoding.UTF8.GetBytes("plaintext")); 22ArraySegment<byte> aad = new ArraySegment<byte>(Encoding.UTF8.GetBytes("aad")); 26byte[] decipheredtext = encryptor.Decrypt(new ArraySegment<byte>(ciphertext), aad); 39ArraySegment<byte> plaintext = new ArraySegment<byte>(Encoding.UTF8.GetBytes("plaintext")); 40ArraySegment<byte> aad = new ArraySegment<byte>(Encoding.UTF8.GetBytes("aad")); 48encryptor.Decrypt(new ArraySegment<byte>(invalidCiphertext_tooShort), aad); 57encryptor.Decrypt(new ArraySegment<byte>(invalidCiphertext_manipulated), aad); 65encryptor.Decrypt(new ArraySegment<byte>(invalidCiphertext_tooLong), aad); 72encryptor.Decrypt(new ArraySegment<byte>(validCiphertext), new ArraySegment<byte>(Encoding.UTF8.GetBytes("different aad")));
Managed\ManagedAuthenticatedEncryptorTests.cs (10)
20ArraySegment<byte> plaintext = new ArraySegment<byte>(Encoding.UTF8.GetBytes("plaintext")); 21ArraySegment<byte> aad = new ArraySegment<byte>(Encoding.UTF8.GetBytes("aad")); 25byte[] decipheredtext = encryptor.Decrypt(new ArraySegment<byte>(ciphertext), aad); 40ArraySegment<byte> plaintext = new ArraySegment<byte>(Encoding.UTF8.GetBytes("plaintext")); 41ArraySegment<byte> aad = new ArraySegment<byte>(Encoding.UTF8.GetBytes("aad")); 49encryptor.Decrypt(new ArraySegment<byte>(invalidCiphertext_tooShort), aad); 58encryptor.Decrypt(new ArraySegment<byte>(invalidCiphertext_manipulated), aad); 66encryptor.Decrypt(new ArraySegment<byte>(invalidCiphertext_tooLong), aad); 73encryptor.Decrypt(new ArraySegment<byte>(validCiphertext), new ArraySegment<byte>(Encoding.UTF8.GetBytes("different aad")));
SecretAssert.cs (1)
38secret.WriteSecretIntoBuffer(new ArraySegment<byte>(secretBytes));
SecretTests.cs (4)
82secret.WriteSecretIntoBuffer(new ArraySegment<byte>(new byte[0])); 121secret.WriteSecretIntoBuffer(new ArraySegment<byte>(new byte[0])); 205testCode: () => secret.WriteSecretIntoBuffer(new ArraySegment<byte>(new byte[100])), 219testCode: () => secret.WriteSecretIntoBuffer(new ArraySegment<byte>(new byte[16])));
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (2)
Latency\AddServerTimingHeaderMiddlewareTests.cs (1)
26ArraySegment<Checkpoint> checkpoints = new(new[] { checkpoint });
Latency\LatencyContextControlExtensionsTests.cs (1)
37var chkSegment = new ArraySegment<Checkpoint>(checkpoints);
Microsoft.AspNetCore.Http.Connections.Tests (2)
MapConnectionHandlerTests.cs (1)
405var result = await client.ReceiveAsync(new ArraySegment<byte>(new byte[1024]), CancellationToken.None).DefaultTimeout();
WebSocketsTests.cs (1)
48buffer: new ArraySegment<byte>(Encoding.UTF8.GetBytes("Hello")),
Microsoft.AspNetCore.Owin (1)
WebSockets\OwinWebSocketAdapter.cs (1)
144await ReceiveAsync(new ArraySegment<byte>(buffer), cancellationToken);
Microsoft.AspNetCore.Server.HttpSys (1)
Helpers.cs (1)
22return new ArraySegment<byte>(Encoding.ASCII.GetBytes(size.ToString("X", CultureInfo.InvariantCulture) + "\r\n"));
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (16)
Http1\Http1ConnectionTests.cs (15)
300await _http1Connection.WriteAsync(new ArraySegment<byte>(new byte[1])); 311await _http1Connection.WriteAsync(new ArraySegment<byte>(new byte[1])); 321await _http1Connection.WriteAsync(new ArraySegment<byte>(new byte[1])); 591await Assert.ThrowsAsync<InvalidOperationException>(() => _http1Connection.WriteAsync(new ArraySegment<byte>(new byte[1]))); 602await Assert.ThrowsAsync<InvalidOperationException>(() => _http1Connection.WriteAsync(new ArraySegment<byte>(new byte[1]), default(CancellationToken))); 613await _http1Connection.WriteAsync(new ArraySegment<byte>(new byte[1])); 624await _http1Connection.WriteAsync(new ArraySegment<byte>(new byte[1]), default(CancellationToken)); 679await _http1Connection.WriteAsync(new ArraySegment<byte>(new[] { (byte)ch })); 683await _http1Connection.WriteAsync(new ArraySegment<byte>(new[] { (byte)'d' })); 701await _http1Connection.WriteAsync(new ArraySegment<byte>(new[] { (byte)ch }), default(CancellationToken)); 705await _http1Connection.WriteAsync(new ArraySegment<byte>(new[] { (byte)'d' }), default(CancellationToken)); 756await _http1Connection.WriteAsyncAwaited(startingTask, new ArraySegment<byte>(new[] { (byte)'h' }), default(CancellationToken)); 761await _http1Connection.WriteAsync(new ArraySegment<byte>(new[] { (byte)ch }), default(CancellationToken)); 765await _http1Connection.WriteAsync(new ArraySegment<byte>(new[] { (byte)'d' }), default(CancellationToken)); 780await _http1Connection.WriteAsync(new ArraySegment<byte>(Encoding.ASCII.GetBytes("hello, world")), default(CancellationToken));
MessageBodyTests.cs (1)
608Assert.Equal(0, await stream.ReadAsync(new ArraySegment<byte>(new byte[1])));
Microsoft.AspNetCore.SignalR.Tests (4)
EndToEndTests.cs (4)
104await ws.SendAsync(new ArraySegment<byte>(bytes), WebSocketMessageType.Binary, endOfMessage: true, CancellationToken.None).DefaultTimeout(); 107var buffer = new ArraySegment<byte>(new byte[1024]); 143await ws.SendAsync(new ArraySegment<byte>(bytes), WebSocketMessageType.Binary, endOfMessage: false, CancellationToken.None).DefaultTimeout(); 146var buffer = new ArraySegment<byte>(new byte[1024]);
Microsoft.AspNetCore.SpaServices.Extensions (1)
Proxying\SpaProxy.cs (1)
283var resultTask = source.ReceiveAsync(new ArraySegment<byte>(buffer), cancellationToken);
Microsoft.AspNetCore.TestHost (3)
TestWebSocket.cs (3)
63result = await ReceiveAsync(new ArraySegment<byte>(data), cancellationToken); 231Buffer = new ArraySegment<byte>(Array.Empty<byte>()); 292message.Buffer = new ArraySegment<byte>(array);
Microsoft.AspNetCore.TestHost.Tests (12)
TestClientTests.cs (12)
587var receiveResult = await websocket.ReceiveAsync(new System.ArraySegment<byte>(receiveArray), CancellationToken.None); 617await clientSocket.SendAsync(new System.ArraySegment<byte>(hello), WebSocketMessageType.Text, true, CancellationToken.None); 619await clientSocket.SendAsync(new System.ArraySegment<byte>(world), WebSocketMessageType.Binary, true, CancellationToken.None); 626var result = await clientSocket.ReceiveAsync(new System.ArraySegment<byte>(buffer), CancellationToken.None); 631result = await clientSocket.ReceiveAsync(new System.ArraySegment<byte>(buffer), CancellationToken.None); 636result = await clientSocket.ReceiveAsync(new System.ArraySegment<byte>(buffer), CancellationToken.None); 684var result = await clientSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None); 709var receiveResult = await websocket.ReceiveAsync(new ArraySegment<byte>(receiveArray), CancellationToken.None); 776await Assert.ThrowsAsync<IOException>(async () => await clientSocket.ReceiveAsync(new System.ArraySegment<byte>(buffer), CancellationToken.None)); 793var receiveResult = await websocket.ReceiveAsync(new System.ArraySegment<byte>(receiveArray), CancellationToken.None); 809await clientSocket.SendAsync(new System.ArraySegment<byte>(hello), WebSocketMessageType.Text, true, CancellationToken.None); 816var result = await clientSocket.ReceiveAsync(new System.ArraySegment<byte>(buffer), CancellationToken.None);
Microsoft.AspNetCore.WebSockets.Tests (37)
BufferStream.cs (2)
131_topBuffer = new ArraySegment<byte>(topBuffer); 195_topBuffer = new ArraySegment<byte>(topBuffer);
SendReceiveTests.cs (11)
19await pair.ClientSocket.SendAsync(new ArraySegment<byte>(sendBuffer), WebSocketMessageType.Text, endOfMessage: true, cancellationToken: CancellationToken.None); 22var result = await pair.ServerSocket.ReceiveAsync(new ArraySegment<byte>(receiveBuffer), CancellationToken.None); 36await pair.ServerSocket.SendAsync(new ArraySegment<byte>(sendBuffer), WebSocketMessageType.Text, endOfMessage: true, cancellationToken: CancellationToken.None); 39var result = await pair.ClientSocket.ReceiveAsync(new ArraySegment<byte>(receiveBuffer), CancellationToken.None); 51await pair.ClientSocket.SendAsync(new ArraySegment<byte>(sendBuffer), WebSocketMessageType.Binary, endOfMessage: true, cancellationToken: CancellationToken.None); 54var result = await pair.ServerSocket.ReceiveAsync(new ArraySegment<byte>(receiveBuffer), CancellationToken.None); 66await pair.ServerSocket.SendAsync(new ArraySegment<byte>(sendBuffer), WebSocketMessageType.Binary, endOfMessage: true, cancellationToken: CancellationToken.None); 69var result = await pair.ClientSocket.ReceiveAsync(new ArraySegment<byte>(receiveBuffer), CancellationToken.None); 81await pair.ServerSocket.SendAsync(new ArraySegment<byte>(sendBuffer), WebSocketMessageType.Binary, endOfMessage: true, cancellationToken: CancellationToken.None); 84var result = await pair.ClientSocket.ReceiveAsync(new ArraySegment<byte>(receiveBuffer), CancellationToken.None); 94await pair.ClientSocket.ReceiveAsync(new ArraySegment<byte>(receiveBuffer), CancellationToken.None);
WebSocketMiddlewareTests.cs (24)
71var result = await webSocket.ReceiveAsync(new ArraySegment<byte>(serverBuffer), CancellationToken.None); 81await client.SendAsync(new ArraySegment<byte>(originalData), WebSocketMessageType.Binary, true, CancellationToken.None); 96var result = await webSocket.ReceiveAsync(new ArraySegment<byte>(serverBuffer), CancellationToken.None); 106await client.SendAsync(new ArraySegment<byte>(originalData), WebSocketMessageType.Binary, true, CancellationToken.None); 121var result = await webSocket.ReceiveAsync(new ArraySegment<byte>(serverBuffer), CancellationToken.None); 131await client.SendAsync(new ArraySegment<byte>(originalData), WebSocketMessageType.Binary, true, CancellationToken.None); 147var result = await webSocket.ReceiveAsync(new ArraySegment<byte>(serverBuffer), CancellationToken.None); 159await client.SendAsync(new ArraySegment<byte>(originalData), WebSocketMessageType.Binary, true, CancellationToken.None); 178var result = await webSocket.ReceiveAsync(new ArraySegment<byte>(serverBuffer), CancellationToken.None); 226await webSocket.SendAsync(new ArraySegment<byte>(originalData), WebSocketMessageType.Binary, true, CancellationToken.None); 233var result = await client.ReceiveAsync(new ArraySegment<byte>(clientBuffer), CancellationToken.None); 251await webSocket.SendAsync(new ArraySegment<byte>(originalData), WebSocketMessageType.Binary, true, CancellationToken.None); 258var result = await client.ReceiveAsync(new ArraySegment<byte>(clientBuffer), CancellationToken.None); 276await webSocket.SendAsync(new ArraySegment<byte>(originalData), WebSocketMessageType.Binary, true, CancellationToken.None); 318var result = await client.ReceiveAsync(new ArraySegment<byte>(clientBuffer), CancellationToken.None); 353var result = await webSocket.ReceiveAsync(new ArraySegment<byte>(serverBuffer), CancellationToken.None); 387var result = await client.ReceiveAsync(new ArraySegment<byte>(clientBuffer), CancellationToken.None); 409var result = await webSocket.ReceiveAsync(new ArraySegment<byte>(serverBuffer), CancellationToken.None); 439var result = await webSocket.ReceiveAsync(new ArraySegment<byte>(serverBuffer), CancellationToken.None); 473var result = await webSocket.ReceiveAsync(new ArraySegment<byte>(serverBuffer), CancellationToken.None); 485var result = await client.ReceiveAsync(new ArraySegment<byte>(clientBuffer), CancellationToken.None); 526var pendingResponse = serverSocket.ReceiveAsync(new ArraySegment<byte>(new byte[1024]), default); 532var response = await serverSocket.ReceiveAsync(new ArraySegment<byte>(new byte[1024]), default); 601var response = await serverSocket.ReceiveAsync(new ArraySegment<byte>(new byte[1024]), cts.Token);
Microsoft.CodeAnalysis (6)
EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
ReferenceManager\CommonReferenceManager.Binding.cs (2)
308referenceBindingsToProcess.Push((resolvedReference, new ArraySegment<AssemblyReferenceBinding>(referenceBinding))); 431new ArraySegment<AssemblyReferenceBinding>(referenceBindings[explicitReferenceMapping.Index + 1])));
Microsoft.CodeAnalysis.Analyzers (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
Microsoft.CodeAnalysis.AnalyzerUtilities (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
Microsoft.CodeAnalysis.BannedApiAnalyzers (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
Microsoft.CodeAnalysis.CodeStyle (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
Microsoft.CodeAnalysis.Features (2)
SymbolSearch\Windows\SymbolSearchUpdateEngine.Update.cs (2)
307await WriteDatabaseFileAsync(databaseFileInfo, new ArraySegment<byte>(bytes), cancellationToken).ConfigureAwait(false); 329arraySegmentBuffer = new ArraySegment<byte>(memoryStream.ReadAllBytes());
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
Microsoft.CodeAnalysis.PublicApiAnalyzers (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
Microsoft.CodeAnalysis.ResxSourceGenerator (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
Microsoft.CodeAnalysis.Workspaces (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
Microsoft.DotNet.Build.Tasks.Installers (1)
src\RpmBuilder.cs (1)
417signatureEntries.Add(new(RpmSignatureTag.ReservedSpace, RpmHeaderEntryType.Binary, new ArraySegment<byte>(new byte[4128])));
Microsoft.Extensions.Caching.Hybrid.Tests (1)
PayloadTests.cs (1)
211var result = HybridCachePayload.TryParse(new(bytes), "whatever", TagSet.Empty, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
Microsoft.Extensions.Caching.SqlServer (2)
SqlServerCache.cs (2)
177_dbOperations.SetCacheItem(key, new(value), options); 210await _dbOperations.SetCacheItemAsync(key, new(value), options, token).ConfigureAwait(false);
Microsoft.Extensions.Http.Diagnostics.Tests (3)
Latency\Internal\HttpClientLatencyLogEnricherTest.cs (3)
21var checkpoints = new ArraySegment<Checkpoint>(new[] { new Checkpoint("a", default, default), new Checkpoint("b", default, default) }); 38var checkpoints = new ArraySegment<Checkpoint>(new[] { new Checkpoint("a", default, default), new Checkpoint("b", default, default) }); 58var checkpoints = new ArraySegment<Checkpoint>(new[] { new Checkpoint("a", default, default), new Checkpoint("b", default, default) });
Microsoft.Extensions.Logging.EventSource (1)
EventSourceLogger.cs (1)
272buffer = new ArraySegment<byte>(stream.ToArray());
Microsoft.Extensions.Telemetry.Abstractions (3)
Latency\NullLatencyContext.cs (3)
13private readonly ArraySegment<Checkpoint> _checkpoints = new(Array.Empty<Checkpoint>()); 14private readonly ArraySegment<Tag> _tags = new(Array.Empty<Tag>()); 15private readonly ArraySegment<Measure> _measures = new(Array.Empty<Measure>());
Microsoft.Extensions.Telemetry.Abstractions.Tests (3)
Latency\LatencyDataTests.cs (3)
25ArraySegment<Checkpoint> checkpoints = new ArraySegment<Checkpoint>(LatencyDataTests.GetCheckpoints(num)); 26ArraySegment<Measure> measures = new ArraySegment<Measure>(GetMeasures(num)); 27ArraySegment<Tag> tags = new ArraySegment<Tag>(GetTags(num));
Microsoft.Extensions.Telemetry.Tests (9)
Latency\Internal\LatencyConsoleExporterTests.cs (9)
167ArraySegment<Checkpoint> checkpoints = new(new[] 174ArraySegment<Measure> measures = new(new[] 181ArraySegment<Tag> tags = new(new[] 193ArraySegment<Checkpoint> checkpoints = new(new[] 200ArraySegment<Measure> measures = new(new[] 207ArraySegment<Tag> tags = new(new[] 219ArraySegment<Checkpoint> checkpoints = new(Array.Empty<Checkpoint>()); 220ArraySegment<Measure> measures = new(Array.Empty<Measure>()); 221ArraySegment<Tag> tags = new(Array.Empty<Tag>());
Roslyn.Diagnostics.Analyzers (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
System.Private.CoreLib (2)
src\libraries\System.Private.CoreLib\src\System\ArraySegment.cs (2)
37public static ArraySegment<T> Empty { get; } = new ArraySegment<T>(new T[0]); 173public static implicit operator ArraySegment<T>(T[] array) => array != null ? new ArraySegment<T>(array) : default;
System.Private.DataContractSerialization (2)
System\Runtime\Serialization\Json\JsonEncodingStreamWrapper.cs (1)
151new ArraySegment<byte>(DataContractSerializer.ValidatingUTF8.GetBytes(GetEncoding(dataEnc).GetChars(buffer, offset, count)));
System\Xml\EncodingStreamWrapper.cs (1)
488seg = new ArraySegment<byte>(DataContractSerializer.ValidatingUTF8.GetBytes(GetEncoding(declEnc).GetChars(buffer, offset, count)));
System.Private.Windows.Core.Tests (2)
System\Value\StoringArrays.cs (2)
42ArraySegment<byte> segment = new(b); 70ArraySegment<char> segment = new(b);
Test.Utilities (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
Text.Analyzers (4)
src\Compilers\Core\Portable\EncodedStringText.cs (4)
183bytes = new ArraySegment<byte>(Array.Empty<byte>()); 202bytes = new ArraySegment<byte>(Array.Empty<byte>()); 222? new ArraySegment<byte>(buffer) 223: new ArraySegment<byte>(Array.Empty<byte>());
WebSocketSample (2)
Program.cs (2)
38await ws.SendAsync(new ArraySegment<byte>(bytes), WebSocketMessageType.Text, endOfMessage: true, cancellationToken: CancellationToken.None); 55var result = await ws.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);