469 instantiations of ArraySegment
AutobahnTestApp (3)
Startup.cs (3)
42var result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), cancellationToken); 45await webSocket.SendAsync(new ArraySegment<byte>(buffer, 0, result.Count), result.MessageType, result.EndOfMessage, cancellationToken); 46result = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), cancellationToken);
ClientSample (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
dotnet-dev-certs (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
dotnet-getdocument (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
dotnet-openapi (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
dotnet-sql-cache (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
dotnet-svcutil-lib (27)
FrameworkFork\System.Runtime.Serialization\System\Xml\EncodingStreamWrapper.cs (3)
497seg = new ArraySegment<byte>(buffer, offset, count); 502seg = new ArraySegment<byte>(buffer, offset, count); 526seg = new ArraySegment<byte>(s_validatingUTF8.GetBytes(GetEncoding(declEnc).GetChars(buffer, offset, count)));
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\BinaryMessageEncoder.cs (3)
434return new ArraySegment<byte>(buffer, newOffset, newSize); 513return new ArraySegment<byte>(buffer, newOffset, newSize); 1440messageData.Open(new ArraySegment<byte>(buffer, offset, size), bufferManager);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\BufferedMessageData.cs (1)
76_buffer = new ArraySegment<byte>();
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\BufferedMessageWriter.cs (1)
58return new ArraySegment<byte>(buffer, initialOffset, size - initialOffset);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\FramingChannels.cs (1)
216return new ArraySegment<byte>(startBytes, 0, startSize);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\FramingEncoders.cs (2)
231return new ArraySegment<byte>(buffer, messageFrame.Offset - spaceNeeded, messageFrame.Count + spaceNeeded); 315return new ArraySegment<byte>(buffer, offset, messageFrame.Count + spaceNeeded);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpResponseMessageHelper.cs (2)
205var messageBuffer = new ArraySegment<byte>(_factory.BufferManager.TakeBuffer(bufferSize), 0, bufferSize); 228return await DecodeBufferedMessageAsync(new ArraySegment<byte>(buffer, 0, offset), inputStream);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageEncoder.cs (1)
89return new ArraySegment<byte>(buffer, 0, offset);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageEncoderCompressionHandler.cs (2)
55buffer = new ArraySegment<byte>(decompressedBytes, buffer.Offset, length - buffer.Offset); 75buffer = new ArraySegment<byte>(compressedBytes, buffer.Offset, length - buffer.Offset);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SessionConnectionReader.cs (1)
391message = _messageEncoder.ReadMessage(new ArraySegment<byte>(EnvelopeBuffer, 0, EnvelopeSize), _bufferManager);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (10)
581new ArraySegment<byte>(internalBuffer, receivedByteCount, internalBuffer.Length - receivedByteCount), 767result = await _webSocket.ReceiveAsync(new ArraySegment<byte>(buffer, 0, _receiveBufferSize), cancelToken); 838new ArraySegment<byte>(buffer, 0, count), 849ArraySegment<byte> bytes = new ArraySegment<byte>(buffer, 0, count); 1060result = await _webSocket.ReceiveAsync(new ArraySegment<byte>(buffer, offset, count), cancellationToken); 1140await _webSocket.SendAsync(new ArraySegment<byte>(buffer, offset, count), _outgoingMessageType, false, cancellationToken); 1183Task task = _webSocket.SendAsync(new ArraySegment<byte>(Array.Empty<byte>(), 0, 0), _outgoingMessageType, true, timeoutHelper.GetCancellationToken()); 1209await _webSocket.SendAsync(new ArraySegment<byte>(Array.Empty<byte>(), 0, 0), _outgoingMessageType, true, cancelToken); 1251_initialReadBuffer = new ArraySegment<byte>(_initialReadBuffer.Array, _initialReadBuffer.Offset + bytesToCopy, _initialReadBuffer.Count - bytesToCopy); 1272_webSocket.ReceiveAsync(new ArraySegment<byte>(_initialReadBuffer.Array), cancelToken);
dotnet-user-jwts (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
dotnet-user-secrets (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
ExceptionHandlerSample (1)
StartupWithWebSocket.cs (1)
32await ws.SendAsync(new ArraySegment<byte>(Encoding.UTF8.GetBytes("Hello")), System.Net.WebSockets.WebSocketMessageType.Text, true, context.RequestAborted);
Extensibility.MessageEncoder.IntegrationTests (1)
CustomTextMessageEncoder.cs (1)
97ArraySegment<byte> byteArray = new ArraySegment<byte>(totalBytes, messageOffset, messageLength);
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>());
GetDocument.Insider (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
IIS.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\WebSocketTests.cs (2)
190await webSocket.SendAsync(new ArraySegment<byte>(Encoding.ASCII.GetBytes(message)), WebSocketMessageType.Text, true, default); 202result = await webSocket.ReceiveAsync(new ArraySegment<byte>(received, offset, received.Length - offset), default);
IISExpress.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\WebSocketTests.cs (2)
190await webSocket.SendAsync(new ArraySegment<byte>(Encoding.ASCII.GetBytes(message)), WebSocketMessageType.Text, true, default); 202result = await webSocket.ReceiveAsync(new ArraySegment<byte>(received, offset, received.Length - offset), default);
InMemory.FunctionalTests (2)
Http2\Http2ConnectionTests.cs (1)
965await SendDataAsync(1, new ArraySegment<byte>(_helloWorldBytes, i, 1), endStream: false);
Http2\Http2TestBase.cs (1)
243data.AddRange(new ArraySegment<byte>(buffer, 0, received));
InProcessWebSite (5)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.WebSockets.cs (5)
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); 181await webSocket.SendAsync(new ArraySegment<byte>(buffer, 0, result.Count), result.MessageType, result.EndOfMessage, 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 (2)
RenderTree\ArrayBuilderSegment.cs (2)
55=> ((IEnumerable<T>)new ArraySegment<T>(Array, _offset, _count)).GetEnumerator(); 58=> ((IEnumerable)new ArraySegment<T>(Array, _offset, _count)).GetEnumerator();
Microsoft.AspNetCore.Components.Authorization.Tests (1)
src\Components\Shared\test\ArrayRangeExtensions.cs (1)
15return new ArraySegment<T>(source.Array, 0, source.Count);
Microsoft.AspNetCore.Components.Endpoints (1)
Rendering\Buffering\BufferedTextWriter.cs (1)
29=> _currentOutput.Add(new TextChunk(new ArraySegment<char>(buffer, index, count), _charArraySegmentBuilder));
Microsoft.AspNetCore.Components.Endpoints.Tests (1)
Buffering\TextChunkTest.cs (1)
34var chunk = new TextChunk(new ArraySegment<char>(chars, 1, 3), charArrayScope);
Microsoft.AspNetCore.Components.Forms.Tests (1)
src\Components\Shared\test\ArrayRangeExtensions.cs (1)
15return new ArraySegment<T>(source.Array, 0, source.Count);
Microsoft.AspNetCore.Components.Server (3)
Circuits\RemoteRenderer.cs (1)
222var segment = new ArraySegment<byte>(pending.Data.Buffer, 0, pending.Data.Count);
ComponentHub.cs (1)
502yield return new ArraySegment<byte>(buffer, 0, bytesRead);
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\BufferWriter.cs (1)
83_segment = new ArraySegment<byte>(array);
Microsoft.AspNetCore.Components.Tests (1)
src\Components\Shared\test\ArrayRangeExtensions.cs (1)
15return new ArraySegment<T>(source.Array, 0, source.Count);
Microsoft.AspNetCore.Components.Web.Tests (1)
src\Components\Shared\test\ArrayRangeExtensions.cs (1)
15return new ArraySegment<T>(source.Array, 0, source.Count);
Microsoft.AspNetCore.Components.WebView (1)
IpcCommon.cs (1)
46args = new ArraySegment<JsonElement>(parsed, 1, parsed.Length - 1);
Microsoft.AspNetCore.DataProtection (22)
ArraySegmentExtensions.cs (1)
27_ = new ArraySegment<T>(arraySegment.Array!, arraySegment.Offset, arraySegment.Count);
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 (4)
116plaintext: new ArraySegment<byte>(plaintext), 117additionalAuthenticatedData: new ArraySegment<byte>(aad), 281ArraySegment<byte> ciphertext = new ArraySegment<byte>(protectedData, sizeof(uint) + sizeof(Guid), protectedData.Length - (sizeof(uint) + sizeof(Guid))); // chop off magic header + encryptor id 282ArraySegment<byte> additionalAuthenticatedData = new ArraySegment<byte>(_aadTemplate.GetAadForKey(keyIdFromPayload, isProtecting: false));
Managed\AesGcmAuthenticatedEncryptor.cs (3)
99var keyModifier = new ArraySegment<byte>(ciphertext.Array!, keyModifierOffset, KEY_MODIFIER_SIZE_IN_BYTES); 112_keyDerivationKey.WriteSecretIntoBuffer(new ArraySegment<byte>(decryptedKdk)); 185_keyDerivationKey.WriteSecretIntoBuffer(new ArraySegment<byte>(decryptedKdk));
Managed\ManagedAuthenticatedEncryptor.cs (3)
75var EMPTY_ARRAY_SEGMENT = new ArraySegment<byte>(EMPTY_ARRAY); 117rgbKey: new ArraySegment<byte>(tempKeys, 0, _symmetricAlgorithmSubkeyLengthInBytes).AsStandaloneArray(), 129using (var hashAlg = CreateValidationAlgorithm(new ArraySegment<byte>(tempKeys, _symmetricAlgorithmSubkeyLengthInBytes, _validationAlgorithmSubkeyLengthInBytes).AsStandaloneArray()))
Secret.cs (2)
41: this(new ArraySegment<byte>(value)) 88secret.WriteSecretIntoBuffer(new ArraySegment<byte>(tempPlaintextBuffer));
XmlEncryption\XmlEncryptionExtensions.cs (2)
172return new Secret(new ArraySegment<byte>(underlyingBuffer, 0, checked((int)memoryStream.Length))); 191secret.WriteSecretIntoBuffer(new ArraySegment<byte>(plaintextSecret));
Microsoft.AspNetCore.DataProtection.Tests (90)
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 (12)
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"))); 93ArraySegment<byte> plaintext = new ArraySegment<byte>(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, 2, 3); 94ArraySegment<byte> aad = new ArraySegment<byte>(new byte[] { 7, 6, 5, 4, 3, 2, 1, 0 }, 1, 4);
Cng\CngAuthenticatedEncryptorBaseTests.cs (6)
14var ciphertext = new ArraySegment<byte>(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04 }, 3, 2); 15var aad = new ArraySegment<byte>(new byte[] { 0x10, 0x11, 0x12, 0x13, 0x14 }, 1, 4); 39var ciphertext = new ArraySegment<byte>(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04 }, 3, 2); 40var aad = new ArraySegment<byte>(new byte[0]); 64var ciphertext = new ArraySegment<byte>(new byte[0]); 65var aad = new ArraySegment<byte>(new byte[] { 0x10, 0x11, 0x12, 0x13, 0x14 }, 1, 4);
Cng\GcmAuthenticatedEncryptorTests.cs (12)
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"))); 83ArraySegment<byte> plaintext = new ArraySegment<byte>(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, 2, 3); 84ArraySegment<byte> aad = new ArraySegment<byte>(new byte[] { 7, 6, 5, 4, 3, 2, 1, 0 }, 1, 4);
Managed\ManagedAuthenticatedEncryptorTests.cs (12)
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"))); 87ArraySegment<byte> plaintext = new ArraySegment<byte>(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, 2, 3); 88ArraySegment<byte> aad = new ArraySegment<byte>(new byte[] { 7, 6, 5, 4, 3, 2, 1, 0 }, 1, 4);
SecretAssert.cs (1)
38secret.WriteSecretIntoBuffer(new ArraySegment<byte>(secretBytes));
SecretTests.cs (8)
24var input = new ArraySegment<byte>(new byte[] { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60 }, 1, 3); 34var outputSegment = new ArraySegment<byte>(new byte[7], 2, 3); 61var outputSegment = new ArraySegment<byte>(new byte[7], 2, 3); 82secret.WriteSecretIntoBuffer(new ArraySegment<byte>(new byte[0])); 121secret.WriteSecretIntoBuffer(new ArraySegment<byte>(new byte[0])); 143var outputSegment = new ArraySegment<byte>(new byte[7], 2, 3); 205testCode: () => secret.WriteSecretIntoBuffer(new ArraySegment<byte>(new byte[100])), 219testCode: () => secret.WriteSecretIntoBuffer(new ArraySegment<byte>(new byte[16])));
SP800_108\SP800_108Tests.cs (3)
160var labelSegment = new ArraySegment<byte>(new byte[label.Length + 10], 3, label.Length); 162var contextSegment = new ArraySegment<byte>(new byte[context.Length + 10], 5, context.Length); 164var derivedSubkeySegment = new ArraySegment<byte>(new byte[numDerivedBytes + 10], 4, numDerivedBytes);
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 (8)
Helpers.cs (2)
22return new ArraySegment<byte>(Encoding.ASCII.GetBytes(size.ToString("X", CultureInfo.InvariantCulture) + "\r\n")); 84return new ArraySegment<byte>(header, offset, header.Length - offset);
RequestProcessing\ResponseBody.cs (4)
112private unsafe void FlushInternal(bool endOfRequest, ArraySegment<byte> data = new ArraySegment<byte>()) 316return FlushInternalAsync(new ArraySegment<byte>(), cancellationToken); 539var data = new ArraySegment<byte>(buffer, offset, count); 591var data = new ArraySegment<byte>(buffer, offset, count);
RequestProcessing\ResponseStreamAsyncResult.cs (2)
59var chunkHeaderBuffer = new ArraySegment<byte>(); 118var chunkHeaderBuffer = new ArraySegment<byte>();
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (26)
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));
Http2\Http2HPackEncoderTests.cs (1)
489Assert.Equal(expectedPayload, new ArraySegment<byte>(payload, 0, length).ToArray());
MessageBodyTests.cs (10)
46AssertASCII("Hello", new ArraySegment<byte>(buffer, 0, count)); 172AssertASCII("Hello", new ArraySegment<byte>(buffer, 0, count)); 199AssertASCII("Hello", new ArraySegment<byte>(buffer, 0, count)); 320AssertASCII("Hello", new ArraySegment<byte>(buffer, 0, count)); 432AssertASCII("Hello", new ArraySegment<byte>(buffer, 0, count)); 459AssertASCII("Hello", new ArraySegment<byte>(buffer, 0, count)); 536AssertASCII(largeInput + "Hello", new ArraySegment<byte>(requestArray, 0, requestArray.Length)); 608Assert.Equal(0, await stream.ReadAsync(new ArraySegment<byte>(new byte[1]))); 667AssertASCII("Hello", new ArraySegment<byte>(buffer, 0, 5)); 694AssertASCII("Hello", new ArraySegment<byte>(buffer, 0, 5));
Microsoft.AspNetCore.Shared.Tests (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
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 (3)
Proxying\SpaProxy.cs (2)
283var resultTask = source.ReceiveAsync(new ArraySegment<byte>(buffer), cancellationToken); 310await destination.SendAsync(new ArraySegment<byte>(buffer, 0, result.Count), result.MessageType, result.EndOfMessage, cancellationToken);
Util\EventedStreamReader.cs (1)
92OnChunk(new ArraySegment<char>(buf, 0, chunkLength));
Microsoft.AspNetCore.TestHost (4)
TestWebSocket.cs (4)
63result = await ReceiveAsync(new ArraySegment<byte>(data), cancellationToken); 146receiveMessage.Buffer = new ArraySegment<byte>(receiveMessage.Buffer.Array!, receiveMessage.Buffer.Offset + count, receiveMessage.Buffer.Count - count); 231Buffer = new ArraySegment<byte>(Array.Empty<byte>()); 292message.Buffer = new ArraySegment<byte>(array);
Microsoft.AspNetCore.TestHost.Tests (15)
TestClientTests.cs (15)
587var receiveResult = await websocket.ReceiveAsync(new System.ArraySegment<byte>(receiveArray), CancellationToken.None); 595var sendBuffer = new System.ArraySegment<byte>(receiveArray, 0, receiveResult.Count); 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); 717var sendBuffer = new System.ArraySegment<byte>(receiveArray, 0, receiveResult.Count); 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); 794var sendBuffer = new System.ArraySegment<byte>(receiveArray, 0, receiveResult.Count); 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 (50)
BufferStream.cs (4)
131_topBuffer = new ArraySegment<byte>(topBuffer); 135_topBuffer = new ArraySegment<byte>(_topBuffer.Array, 195_topBuffer = new ArraySegment<byte>(topBuffer); 199_topBuffer = new ArraySegment<byte>(_topBuffer.Array,
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 (35)
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); 186new ArraySegment<byte>(serverBuffer, totalReceived, serverBuffer.Length - totalReceived), CancellationToken.None); 194new ArraySegment<byte>(serverBuffer, totalReceived, serverBuffer.Length - totalReceived), CancellationToken.None); 206await client.SendAsync(new ArraySegment<byte>(originalData, 0, 2), WebSocketMessageType.Binary, false, CancellationToken.None); 209await client.SendAsync(new ArraySegment<byte>(originalData, 2, 2), WebSocketMessageType.Binary, false, CancellationToken.None); 212await client.SendAsync(new ArraySegment<byte>(originalData, 4, 7), WebSocketMessageType.Binary, true, 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); 287result = await client.ReceiveAsync(new ArraySegment<byte>(clientBuffer, receivedCount, clientBuffer.Length - receivedCount), CancellationToken.None); 309await webSocket.SendAsync(new ArraySegment<byte>(originalData, 0, 2), WebSocketMessageType.Binary, false, CancellationToken.None); 310await webSocket.SendAsync(new ArraySegment<byte>(originalData, 2, 2), WebSocketMessageType.Binary, false, CancellationToken.None); 311await webSocket.SendAsync(new ArraySegment<byte>(originalData, 4, 7), WebSocketMessageType.Binary, true, CancellationToken.None); 318var result = await client.ReceiveAsync(new ArraySegment<byte>(clientBuffer), CancellationToken.None); 325new ArraySegment<byte>(clientBuffer, totalReceived, clientBuffer.Length - totalReceived), CancellationToken.None); 332new ArraySegment<byte>(clientBuffer, totalReceived, clientBuffer.Length - totalReceived), 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.AspNetCore.WebUtilities (1)
BufferedReadStream.cs (1)
55get { return new ArraySegment<byte>(_buffer, _bufferOffset, _bufferCount); }
Microsoft.CodeAnalysis (9)
DiaSymReader\Utilities\ComMemoryStream.cs (1)
98yield return new ArraySegment<byte>(chunk, 0, bytesToCopy);
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 (3)
308referenceBindingsToProcess.Push((resolvedReference, new ArraySegment<AssemblyReferenceBinding>(referenceBinding))); 412new ArraySegment<AssemblyReferenceBinding>(bindingsOfAssemblyBeingBuilt, bindingIndex, moduleBindingsCount))); 431new ArraySegment<AssemblyReferenceBinding>(referenceBindings[explicitReferenceMapping.Index + 1])));
Text\SourceText.cs (1)
278var embeddedTextBlob = canBeEmbedded ? EmbeddedText.CreateBlob(new ArraySegment<byte>(buffer, 0, length)) : default(ImmutableArray<byte>);
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.UnitTests (6)
EmbeddedTextTests.cs (6)
28Assert.Throws<ArgumentException>("checksumAlgorithm", () => EmbeddedText.FromBytes("path", new ArraySegment<byte>(new byte[0], 0, 0), SourceHashAlgorithm.None)); 81var text = EmbeddedText.FromBytes("pathToEmpty", new ArraySegment<byte>(new byte[0], 0, 0), SourceHashAlgorithm.Sha1); 118var text = EmbeddedText.FromBytes("pathToSmall", new ArraySegment<byte>(bytes, 0, bytes.Length)); 133var text = EmbeddedText.FromBytes("pathToSmall", new ArraySegment<byte>(paddedBytes, 1, bytes.Length)); 160var text = EmbeddedText.FromBytes("pathToLarge", new ArraySegment<byte>(bytes, 0, bytes.Length), SourceHashAlgorithms.Default); 175var text = EmbeddedText.FromBytes("pathToLarge", new ArraySegment<byte>(paddedBytes, 1, bytes.Length), SourceHashAlgorithms.Default);
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.Data.Analysis (1)
DataFrame.cs (1)
355ArraySegment<int> segment = new ArraySegment<int>(shuffleArray, 0, shuffleLowerLimit);
Microsoft.DotNet.Build.Tasks.Installers (2)
src\RpmBuilder.cs (1)
417signatureEntries.Add(new(RpmSignatureTag.ReservedSpace, RpmHeaderEntryType.Binary, new ArraySegment<byte>(new byte[4128])));
src\RpmHeader.cs (1)
149entries.Add(new Entry(entry.Tag, entry.Type, new ArraySegment<byte>(store, entry.Offset, entry.Count)));
Microsoft.Extensions.Caching.Hybrid (2)
Internal\BufferChunk.cs (1)
87internal ArraySegment<byte> AsArraySegment() => Length == 0 ? default! : new(OversizedArray!, Offset, Length);
Internal\HybridCachePayload.cs (1)
305payload = new(source.Array!, start, payloadLength);
Microsoft.Extensions.Caching.Hybrid.Tests (10)
PayloadTests.cs (10)
56var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _); 85var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _); 91result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out payload, out remaining, out flags, out entropy, out pendingTags, out _); 121var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _); 151var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _); 157result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out payload, out remaining, out flags, out entropy, out pendingTags, out _); 189var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _); 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 _); 238var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength - 1), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _); 265var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength + 1), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
Microsoft.Extensions.Caching.SqlServer (5)
SqlParameterCollectionExtensions.cs (1)
35value = new([], 0, 0);
SqlServerCache.cs (4)
177_dbOperations.SetCacheItem(key, new(value), options); 210await _dbOperations.SetCacheItemAsync(key, new(value), options, token).ConfigureAwait(false); 239return new([], 0, 0); 252return new(lease, 0, length);
Microsoft.Extensions.DependencyModel (1)
DependencyContextJsonReader.cs (1)
113return new ArraySegment<byte>(rented, 0, written);
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.ServiceDiscovery.Dns (3)
Resolver\DnsResolver.cs (3)
696DnsDataReader responseReader = new DnsDataReader(new ArraySegment<byte>(buffer, 0, length), true); 744responseReader = new DnsDataReader(new ArraySegment<byte>(buffer, 0, packetLength), true); 809DnsDataReader responseReader = new DnsDataReader(new ArraySegment<byte>(buffer, 2, responseLength), true);
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (3)
Resolver\DnsDataReaderTests.cs (1)
60DnsDataReader reader = new DnsDataReader(new ArraySegment<byte>(buffer, 0, i));
Resolver\LoopbackDnsServer.cs (2)
60int bytesWritten = await ProcessRequestCore((IPEndPoint)result.RemoteEndPoint, new ArraySegment<byte>(buffer, 0, result.ReceivedBytes), action, buffer.AsMemory(0, 512)); 103int bytesWritten = await ProcessRequestCore((IPEndPoint)tcpClient.RemoteEndPoint!, new ArraySegment<byte>(buffer, 2, length), action, buffer.AsMemory(2));
Microsoft.Extensions.Telemetry (3)
Latency\Internal\CheckpointTracker.cs (1)
76public ArraySegment<Checkpoint> Checkpoints => new(_checkpoints, 0, _numCheckpoints);
Latency\Internal\MeasureTracker.cs (1)
132return new(_measures, 1, _numMeasures);
Latency\Internal\TagCollection.cs (1)
70public ArraySegment<Tag> Tags => new(_tags, 0, _numTags);
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 (6)
Latency\LatencyDataTests.cs (6)
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)); 44ArraySegment<Checkpoint> checkpoints = new ArraySegment<Checkpoint>(LatencyDataTests.GetCheckpoints(num), 1, numCheckpoints); 45ArraySegment<Measure> measures = new ArraySegment<Measure>(GetMeasures(num), 2, numMeasures); 46ArraySegment<Tag> tags = new ArraySegment<Tag>(GetTags(num), 3, numTags);
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>());
PresentationCore (1)
System\Windows\Nrbf\SerializationRecordExtensions.cs (1)
366return new List<T>(new ArraySegment<T>(array, 0, count));
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>());
Swaggatherer (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
System.Formats.Nrbf (1)
System\Formats\Nrbf\Utils\TypeNameHelpers.cs (1)
215return new ArraySegment<char>(rented, 0, length);
System.Memory (1)
System\Buffers\ReadOnlySequence.Helpers.cs (1)
550segment = new ArraySegment<T>((T[])_startObject, startIndex, GetIndex(_endInteger) - startIndex);
System.Private.CoreLib (11)
src\libraries\System.Private.CoreLib\src\System\ArraySegment.cs (4)
37public static ArraySegment<T> Empty { get; } = new ArraySegment<T>(new T[0]); 140return new ArraySegment<T>(_array!, _offset + index, _count - index); 152return new ArraySegment<T>(_array!, _offset + index, count); 173public static implicit operator ArraySegment<T>(T[] array) => array != null ? new ArraySegment<T>(array) : default;
src\libraries\System.Private.CoreLib\src\System\IO\MemoryStream.cs (1)
194buffer = new ArraySegment<byte>(_buffer, offset: _origin, count: _length - _origin);
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (2)
150return ReadSpan(new Span<byte>(buffer, offset, count), new ArraySegment<byte>(buffer, offset, count)); 468WriteSpan(new ReadOnlySpan<byte>(buffer, offset, count), new ArraySegment<byte>(buffer, offset, count));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\MemoryMarshal.cs (2)
290segment = new ArraySegment<T>(Unsafe.As<T[]>(obj), index & ReadOnlyMemory<T>.RemoveFlagsBitMask, length); 301segment = new ArraySegment<T>(tempArraySegment.Array!, tempArraySegment.Offset + index, length);
src\libraries\System.Private.CoreLib\src\System\Text\TranscodingStream.cs (2)
268return new ArraySegment<byte>(bytes, 0, byteCount); 584ArraySegment<char> decodedChars = new ArraySegment<char>(scratchChars, 0, charsWritten);
System.Private.DataContractSerialization (5)
System\Runtime\Serialization\Json\JsonEncodingStreamWrapper.cs (2)
146return new ArraySegment<byte>(buffer, offset, count); 151new ArraySegment<byte>(DataContractSerializer.ValidatingUTF8.GetBytes(GetEncoding(dataEnc).GetChars(buffer, offset, count)));
System\Xml\EncodingStreamWrapper.cs (3)
459seg = new ArraySegment<byte>(buffer, offset, count); 464seg = new ArraySegment<byte>(buffer, offset, count); 488seg = new ArraySegment<byte>(DataContractSerializer.ValidatingUTF8.GetBytes(GetEncoding(declEnc).GetChars(buffer, offset, count)));
System.Private.Windows.Core (9)
System\Collections\Generic\CollectionExtensions.cs (1)
24return new List<T>(new ArraySegment<T>(array, 0, count));
System\Value.cs (8)
783? new(byteArray, _union.Segment.Offset, _union.Segment.Count) 784: new(byteArray, 0, 0); 799? new(charArray, _union.Segment.Offset, _union.Segment.Count) 800: new(charArray, 0, 0); 1004? (T)(object)new ArraySegment<char>(chars, _union.Segment.Offset, _union.Segment.Count) 1005: (T)(object)new ArraySegment<char>(chars, 0, 0); 1011? (T)(object)new ArraySegment<byte>(bytes, _union.Segment.Offset, _union.Segment.Count) 1012: (T)(object)new ArraySegment<byte>(bytes, 0, 0);
System.Private.Windows.Core.Tests (6)
System\Value\StoringArrays.cs (6)
42ArraySegment<byte> segment = new(b); 49segment = new(b, 0, 0); 56segment = new(b, 1, 1); 70ArraySegment<char> segment = new(b); 77segment = new(b, 0, 0); 84segment = new(b, 1, 1);
System.Reflection.Metadata (1)
System\Reflection\Metadata\Blob.cs (1)
21public ArraySegment<byte> GetBytes() => new ArraySegment<byte>(Buffer, Start, Length);
System.Security.Cryptography.Pkcs (2)
src\libraries\Common\src\System\Security\Cryptography\Asn1Reader\AsnValueReader.cs (1)
255return new ArraySegment<byte>(rented, 0, written);
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (1)
374return new ArraySegment<byte>(decrypted, 0, decryptedBytes);
System.ServiceModel.NetFramingBase (3)
System\ServiceModel\Channels\FramingEncoders.cs (2)
236return new ArraySegment<byte>(buffer, messageFrame.Offset - spaceNeeded, messageFrame.Count + spaceNeeded); 320return new ArraySegment<byte>(buffer, offset, messageFrame.Count + spaceNeeded);
System\ServiceModel\Channels\SessionConnectionReader.cs (1)
277message = _messageEncoder.ReadMessage(new ArraySegment<byte>(EnvelopeBuffer, 0, EnvelopeSize), _bufferManager);
System.Text.Json (3)
System\Text\Json\Document\JsonDocument.cs (1)
851rented = new ArraySegment<byte>(rent, 0, written);
System\Text\Json\Document\JsonDocument.Parse.cs (2)
858return new ArraySegment<byte>(rented, 0, written); 940return new ArraySegment<byte>(rented, 0, written);
Templates.Blazor.Tests (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
Templates.Blazor.WebAssembly.Auth.Tests (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
Templates.Blazor.WebAssembly.Tests (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
Templates.Mvc.Tests (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
Templates.Tests (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
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>());
Wasm.Performance.ConsoleHost (1)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (1)
596command.RemainingArguments.AddRange(new ArraySegment<string>(args, index, args.Length - index));
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);
720 references to ArraySegment
ClientSample (6)
Tcp\BufferExtensions.cs (3)
13public static ArraySegment<byte> GetArray(this Memory<byte> memory) 18public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 20if (!MemoryMarshal.TryGetArray(memory, out var result))
Tcp\SocketSender.cs (3)
21private List<ArraySegment<byte>> _bufferList; 80private List<ArraySegment<byte>> GetBufferList(in ReadOnlySequence<byte> buffer) 87_bufferList = new List<ArraySegment<byte>>();
dotnet-svcutil-lib (69)
FrameworkFork\Microsoft.Xml\Xml\Serialization\Types.cs (1)
999return t.GetTypeInfo().IsGenericType && (t.GetGenericTypeDefinition() == typeof(ArraySegment<>));
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\ClassDataContract.cs (1)
398return t.GetTypeInfo().IsGenericType && (t.GetGenericTypeDefinition() == typeof(ArraySegment<>));
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CollectionDataContract.cs (1)
990return t.GetTypeInfo().IsGenericType && (t.GetGenericTypeDefinition() == typeof(ArraySegment<>));
FrameworkFork\System.Runtime.Serialization\System\Xml\EncodingStreamWrapper.cs (2)
470internal static ArraySegment<byte> ProcessBuffer(byte[] buffer, int offset, int count, Encoding encoding) 478ArraySegment<byte> seg;
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryWriter.cs (2)
1035ArraySegment<byte> arraySegment; 1106ArraySegment<byte> arraySegment;
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlUTF8TextReader.cs (1)
575ArraySegment<byte> seg = EncodingStreamWrapper.ProcessBuffer(buffer, offset, count, encoding);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\BinaryMessageEncoder.cs (8)
257ArraySegment<byte> buffer = this.Buffer; 381private ArraySegment<byte> AddSessionInformationToMessage(ArraySegment<byte> messageData, BufferManager bufferManager, int maxMessageSize) 437private ArraySegment<byte> ExtractSessionInformationFromMessage(ArraySegment<byte> messageData) 516public override Message ReadMessage(ArraySegment<byte> buffer, BufferManager bufferManager, string contentType) 619public override ArraySegment<byte> WriteMessage(Message message, int maxMessageSize, BufferManager bufferManager, int messageOffset) 682ArraySegment<byte> messageData = messageWriter.WriteMessage(message, bufferManager, messageOffset, maxMessageSize);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\BufferedMessageData.cs (3)
12private ArraySegment<byte> _buffer; 25public ArraySegment<byte> Buffer 179public void Open(ArraySegment<byte> buffer, BufferManager bufferManager)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\BufferedMessageWriter.cs (1)
27public ArraySegment<byte> WriteMessage(Message message, BufferManager bufferManager, int initialOffset, int maxSizeQuota)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\Connection.cs (1)
767internal static void ValidateBufferBounds(ArraySegment<byte> buffer)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\FramingChannels.cs (8)
79ArraySegment<byte> messageData; 99protected override AsyncCompletionResult StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout, Action<object> callback, object state) 111protected override ArraySegment<byte> EncodeMessage(Message message) 113ArraySegment<byte> messageData = MessageEncoder.WriteMessage(message, 194private ArraySegment<byte> CreatePreamble() 241private async Task<IConnection> SendPreambleAsync(IConnection connection, ArraySegment<byte> preamble, TimeSpan timeout) 282private IConnection SendPreamble(IConnection connection, ArraySegment<byte> preamble, ref TimeoutHelper timeoutHelper) 415private ArraySegment<byte> _preamble;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\FramingEncoders.cs (4)
218public static ArraySegment<byte> EncodeMessageFrame(ArraySegment<byte> messageFrame) 303public static ArraySegment<byte> EncodeMessageFrame(ArraySegment<byte> messageFrame)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpResponseMessageHelper.cs (2)
205var messageBuffer = new ArraySegment<byte>(_factory.BufferManager.TakeBuffer(bufferSize), 0, bufferSize); 258private async Task<Message> DecodeBufferedMessageAsync(ArraySegment<byte> buffer, Stream inputStream)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\Message.cs (1)
1405ArraySegment<byte> Buffer { get; }
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageBuffer.cs (1)
187ArraySegment<byte> buffer = _messageData.Buffer;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageContent.cs (2)
205private ArraySegment<byte> _buffer; 261_buffer = default(ArraySegment<byte>);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageEncoder.cs (8)
42public virtual Task<Message> ReadMessageAsync(ArraySegment<byte> buffer, BufferManager bufferManager, string contentType) 49public Message ReadMessage(ArraySegment<byte> buffer, BufferManager bufferManager) 55public abstract Message ReadMessage(ArraySegment<byte> buffer, BufferManager bufferManager, string contentType); 58internal async Task<ArraySegment<byte>> BufferMessageStreamAsync(Stream stream, BufferManager bufferManager, int maxBufferSize) 115public ArraySegment<byte> WriteMessage(Message message, int maxMessageSize, BufferManager bufferManager) 117ArraySegment<byte> arraySegment = WriteMessage(message, maxMessageSize, bufferManager, 0); 121public abstract ArraySegment<byte> WriteMessage(Message message, int maxMessageSize, 130public virtual Task<ArraySegment<byte>> WriteMessageAsync(Message message, int maxMessageSize,
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageEncoderCompressionHandler.cs (2)
17internal static void DecompressBuffer(ref ArraySegment<byte> buffer, BufferManager bufferManager, CompressionFormat compressionFormat, long maxReceivedMessageSize) 59internal static void CompressBuffer(ref ArraySegment<byte> buffer, BufferManager bufferManager, CompressionFormat compressionFormat)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\TextMessageEncoder.cs (5)
401public override Message ReadMessage(ArraySegment<byte> buffer, BufferManager bufferManager, string contentType) 461public override ArraySegment<byte> WriteMessage(Message message, int maxMessageSize, BufferManager bufferManager, int messageOffset) 471public override Task<ArraySegment<byte>> WriteMessageAsync(Message message, int maxMessageSize, BufferManager bufferManager, int messageOffset) 496ArraySegment<byte> messageData = messageWriter.WriteMessage(message, bufferManager, messageOffset, maxMessageSize); 716ArraySegment<byte> buffer = this.Buffer;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\TransportDuplexSessionChannel.cs (3)
488protected abstract AsyncCompletionResult StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout, Action<object> callback, object state); 496protected abstract ArraySegment<byte> EncodeMessage(Message message); 542ArraySegment<byte> messageData;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (6)
186protected override AsyncCompletionResult StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout, Action<object> callback, object state) 282ArraySegment<byte> messageData = EncodeMessage(message); 323protected override ArraySegment<byte> EncodeMessage(Message message) 849ArraySegment<byte> bytes = new ArraySegment<byte>(buffer, 0, count); 891private ArraySegment<byte> _initialReadBuffer; 906ArraySegment<byte> initialBuffer,
FrameworkFork\System.ServiceModel\System\ServiceModel\Diagnostics\MessageLogger.cs (1)
61internal static void LogMessage(ArraySegment<byte> arraySegment, MessageLoggingSource messageLoggingSource)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\XmlSerializerOperationFormatter.cs (1)
209ArraySegment<byte> memoryBuffer;
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\EncryptedData.cs (2)
18private ArraySegment<byte> _buffer; 78public void SetUpEncryption(SymmetricAlgorithm algorithm, ArraySegment<byte> buffer)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\RequestSecurityToken.cs (1)
27private ArraySegment<byte> _cachedWriteBuffer;
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\RequestSecurityTokenResponse.cs (1)
35private ArraySegment<byte> _cachedWriteBuffer;
Extensibility.MessageEncoder.IntegrationTests (5)
CustomTextMessageEncoder.cs (4)
60public override Message ReadMessage(ArraySegment<byte> buffer, BufferManager bufferManager, string contentType) 78public override ArraySegment<byte> WriteMessage(Message message, int maxMessageSize, BufferManager bufferManager, int messageOffset) 80ArraySegment<byte> messageBuffer; 97ArraySegment<byte> byteArray = new ArraySegment<byte>(totalBytes, messageOffset, messageLength);
TextTests.4.1.0.cs (1)
115ArraySegment<byte> returnedByteArraySegment;
GenerateDocumentationAndConfigFiles (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
http2cat (3)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
52public static ArraySegment<byte> GetArray(this Memory<byte> buffer) 57public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 59if (!MemoryMarshal.TryGetArray(memory, out var result))
IIS.FunctionalTests (3)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
52public static ArraySegment<byte> GetArray(this Memory<byte> buffer) 57public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 59if (!MemoryMarshal.TryGetArray(memory, out var result))
IIS.LongTests (3)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
52public static ArraySegment<byte> GetArray(this Memory<byte> buffer) 57public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 59if (!MemoryMarshal.TryGetArray(memory, out var result))
IIS.NewHandler.FunctionalTests (3)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
52public static ArraySegment<byte> GetArray(this Memory<byte> buffer) 57public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 59if (!MemoryMarshal.TryGetArray(memory, out var result))
IIS.NewShim.FunctionalTests (3)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
52public static ArraySegment<byte> GetArray(this Memory<byte> buffer) 57public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 59if (!MemoryMarshal.TryGetArray(memory, out var result))
IIS.ShadowCopy.Tests (3)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
52public static ArraySegment<byte> GetArray(this Memory<byte> buffer) 57public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 59if (!MemoryMarshal.TryGetArray(memory, out var result))
IISExpress.FunctionalTests (3)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
52public static ArraySegment<byte> GetArray(this Memory<byte> buffer) 57public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 59if (!MemoryMarshal.TryGetArray(memory, out var result))
Interop.FunctionalTests (1)
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
164protected override bool TryGetArray(out ArraySegment<byte> segment)
KeyManagementSimulator (4)
Program.cs (4)
282byte[] IAuthenticatedEncryptor.Decrypt(ArraySegment<byte> ciphertext, ArraySegment<byte> _additionalAuthenticatedData) => ciphertext.ToArray(); 283byte[] IAuthenticatedEncryptor.Encrypt(ArraySegment<byte> plaintext, ArraySegment<byte> _additionalAuthenticatedData) => plaintext.ToArray();
Metrics (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Metrics.Legacy (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.AspNetCore.Antiforgery (1)
Internal\DefaultClaimUidExtractor.cs (1)
136bool success = serializationContext.Stream.TryGetBuffer(out ArraySegment<byte> buffer);
Microsoft.AspNetCore.Components (1)
RenderTree\ArrayBuilderExtensions.cs (1)
21/// <returns>The <see cref="ArraySegment{T}"/>.</returns>
Microsoft.AspNetCore.Components.Endpoints (1)
Rendering\Buffering\TextChunk.cs (1)
35public TextChunk(ArraySegment<char> value, StringBuilder charArraySegmentScope)
Microsoft.AspNetCore.Components.Server (4)
BlazorPack\BlazorPackHubProtocolWorker.cs (1)
99case ArraySegment<byte> bytes:
Circuits\RemoteRenderer.cs (1)
222var segment = new ArraySegment<byte>(pending.Data.Buffer, 0, pending.Data.Count);
ComponentHub.cs (1)
481public async IAsyncEnumerable<ArraySegment<byte>> SendDotNetStreamToJS(long streamId)
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\BufferWriter.cs (1)
33private ArraySegment<byte> _segment;
Microsoft.AspNetCore.Components.WebView (4)
IpcCommon.cs (3)
19public static bool TryDeserializeIncoming(string message, out IncomingMessageType messageType, out ArraySegment<JsonElement> args) 22public static bool TryDeserializeOutgoing(string message, out OutgoingMessageType messageType, out ArraySegment<JsonElement> args) 37private static bool TryDeserialize<T>(string message, out T messageType, out ArraySegment<JsonElement> args)
IpcReceiver.cs (1)
35if (IpcCommon.TryDeserializeIncoming(message, out var messageType, out var args))
Microsoft.AspNetCore.Components.WebView.Test (6)
Infrastructure\AssertHelpers.cs (3)
15Assert.True(IpcCommon.TryDeserializeOutgoing(message, out var messageType, out var args)); 23Assert.True(IpcCommon.TryDeserializeOutgoing(message, out var messageType, out var args)); 32Assert.True(IpcCommon.TryDeserializeOutgoing(message, out var messageType, out var args));
Infrastructure\TestDocument.cs (3)
198private int InsertFrame(RenderBatch batch, ContainerNode parent, int childIndex, ArraySegment<RenderTreeFrame> frames, RenderTreeFrame frame, int frameIndex) 270private int InsertFrameRange(RenderBatch batch, ContainerNode parent, int childIndex, ArraySegment<RenderTreeFrame> frames, int startIndex, int endIndexExcl) 286private void InsertElement(RenderBatch batch, ContainerNode parent, int childIndex, ArraySegment<RenderTreeFrame> frames, RenderTreeFrame frame, int frameIndex)
Microsoft.AspNetCore.DataProtection (38)
ArraySegmentExtensions.cs (2)
10public static byte[] AsStandaloneArray(this ArraySegment<byte> arraySegment) 23public static void Validate<T>(this ArraySegment<T> arraySegment)
AuthenticatedEncryption\AuthenticatedEncryptorExtensions.cs (2)
11public static byte[] Encrypt(this IAuthenticatedEncryptor encryptor, ArraySegment<byte> plaintext, ArraySegment<byte> additionalAuthenticatedData, uint preBufferSize, uint postBufferSize)
AuthenticatedEncryption\IAuthenticatedEncryptor.cs (4)
22byte[] Decrypt(ArraySegment<byte> ciphertext, ArraySegment<byte> additionalAuthenticatedData); 34byte[] Encrypt(ArraySegment<byte> plaintext, ArraySegment<byte> additionalAuthenticatedData);
AuthenticatedEncryption\IAuthenticatedEncryptorFactory.cs (4)
20/// be considered equivalent, e.g., the payload returned by one's <see cref="IAuthenticatedEncryptor.Encrypt(ArraySegment{byte}, ArraySegment{byte})"/> 21/// method should be consumable by the other's <see cref="IAuthenticatedEncryptor.Decrypt(ArraySegment{byte}, ArraySegment{byte})"/> method.
AuthenticatedEncryption\IOptimizedAuthenticatedEncryptor.cs (2)
40byte[] Encrypt(ArraySegment<byte> plaintext, ArraySegment<byte> additionalAuthenticatedData, uint preBufferSize, uint postBufferSize);
Cng\Internal\CngAuthenticatedEncryptorBase.cs (6)
14public byte[] Decrypt(ArraySegment<byte> ciphertext, ArraySegment<byte> additionalAuthenticatedData) 48public byte[] Encrypt(ArraySegment<byte> plaintext, ArraySegment<byte> additionalAuthenticatedData) 53public byte[] Encrypt(ArraySegment<byte> plaintext, ArraySegment<byte> additionalAuthenticatedData, uint preBufferSize, uint postBufferSize)
ISecret.cs (1)
25void WriteSecretIntoBuffer(ArraySegment<byte> buffer);
KeyManagement\KeyRingBasedDataProtector.cs (2)
281ArraySegment<byte> ciphertext = new ArraySegment<byte>(protectedData, sizeof(uint) + sizeof(Guid), protectedData.Length - (sizeof(uint) + sizeof(Guid))); // chop off magic header + encryptor id 282ArraySegment<byte> additionalAuthenticatedData = new ArraySegment<byte>(_aadTemplate.GetAadForKey(keyIdFromPayload, isProtecting: false));
Managed\AesGcmAuthenticatedEncryptor.cs (7)
67public byte[] Decrypt(ArraySegment<byte> ciphertext, ArraySegment<byte> additionalAuthenticatedData) 99var keyModifier = new ArraySegment<byte>(ciphertext.Array!, keyModifierOffset, KEY_MODIFIER_SIZE_IN_BYTES); 144public byte[] Encrypt(ArraySegment<byte> plaintext, ArraySegment<byte> additionalAuthenticatedData, uint preBufferSize, uint postBufferSize) 220public byte[] Encrypt(ArraySegment<byte> plaintext, ArraySegment<byte> additionalAuthenticatedData)
Managed\ManagedAuthenticatedEncryptor.cs (5)
75var EMPTY_ARRAY_SEGMENT = new ArraySegment<byte>(EMPTY_ARRAY); 166public byte[] Decrypt(ArraySegment<byte> protectedPayload, ArraySegment<byte> additionalAuthenticatedData) 297public byte[] Encrypt(ArraySegment<byte> plaintext, ArraySegment<byte> additionalAuthenticatedData)
Secret.cs (3)
28public Secret(ArraySegment<byte> value) 119private static SecureLocalAllocHandle Protect(ArraySegment<byte> plaintext) 235public void WriteSecretIntoBuffer(ArraySegment<byte> buffer)
Microsoft.AspNetCore.DataProtection.Tests (56)
Cng\CbcAuthenticatedEncryptorTests.cs (6)
24ArraySegment<byte> plaintext = new ArraySegment<byte>(Encoding.UTF8.GetBytes("plaintext")); 25ArraySegment<byte> aad = new ArraySegment<byte>(Encoding.UTF8.GetBytes("aad")); 45ArraySegment<byte> plaintext = new ArraySegment<byte>(Encoding.UTF8.GetBytes("plaintext")); 46ArraySegment<byte> aad = new ArraySegment<byte>(Encoding.UTF8.GetBytes("aad")); 93ArraySegment<byte> plaintext = new ArraySegment<byte>(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, 2, 3); 94ArraySegment<byte> aad = new ArraySegment<byte>(new byte[] { 7, 6, 5, 4, 3, 2, 1, 0 }, 1, 4);
Cng\CngAuthenticatedEncryptorBaseTests.cs (6)
14var ciphertext = new ArraySegment<byte>(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04 }, 3, 2); 15var aad = new ArraySegment<byte>(new byte[] { 0x10, 0x11, 0x12, 0x13, 0x14 }, 1, 4); 39var ciphertext = new ArraySegment<byte>(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04 }, 3, 2); 40var aad = new ArraySegment<byte>(new byte[0]); 64var ciphertext = new ArraySegment<byte>(new byte[0]); 65var aad = new ArraySegment<byte>(new byte[] { 0x10, 0x11, 0x12, 0x13, 0x14 }, 1, 4);
Cng\GcmAuthenticatedEncryptorTests.cs (6)
21ArraySegment<byte> plaintext = new ArraySegment<byte>(Encoding.UTF8.GetBytes("plaintext")); 22ArraySegment<byte> aad = new ArraySegment<byte>(Encoding.UTF8.GetBytes("aad")); 39ArraySegment<byte> plaintext = new ArraySegment<byte>(Encoding.UTF8.GetBytes("plaintext")); 40ArraySegment<byte> aad = new ArraySegment<byte>(Encoding.UTF8.GetBytes("aad")); 83ArraySegment<byte> plaintext = new ArraySegment<byte>(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, 2, 3); 84ArraySegment<byte> aad = new ArraySegment<byte>(new byte[] { 7, 6, 5, 4, 3, 2, 1, 0 }, 1, 4);
KeyManagement\KeyRingBasedDataProtectorTests.cs (24)
46.Setup(o => o.Encrypt(It.IsAny<ArraySegment<byte>>(), It.IsAny<ArraySegment<byte>>())) 47.Returns<ArraySegment<byte>, ArraySegment<byte>>((actualPlaintext, actualAad) => 84.Setup(o => o.Encrypt(It.IsAny<ArraySegment<byte>>(), It.IsAny<ArraySegment<byte>>())) 85.Returns<ArraySegment<byte>, ArraySegment<byte>>((actualPlaintext, actualAad) => 424.Setup(o => o.Decrypt(It.IsAny<ArraySegment<byte>>(), It.IsAny<ArraySegment<byte>>())) 425.Returns<ArraySegment<byte>, ArraySegment<byte>>((actualCiphertext, actualAad) => 471.Setup(o => o.Decrypt(It.IsAny<ArraySegment<byte>>(), It.IsAny<ArraySegment<byte>>())) 472.Returns<ArraySegment<byte>, ArraySegment<byte>>((actualCiphertext, actualAad) => 520.Setup(o => o.Decrypt(It.IsAny<ArraySegment<byte>>(), It.IsAny<ArraySegment<byte>>())) 521.Returns<ArraySegment<byte>, ArraySegment<byte>>((actualCiphertext, actualAad) => 595.Setup(o => o.Encrypt(It.IsAny<ArraySegment<byte>>(), It.IsAny<ArraySegment<byte>>())) 596.Returns<ArraySegment<byte>, ArraySegment<byte>>((actualPlaintext, actualAad) =>
Managed\ManagedAuthenticatedEncryptorTests.cs (6)
20ArraySegment<byte> plaintext = new ArraySegment<byte>(Encoding.UTF8.GetBytes("plaintext")); 21ArraySegment<byte> aad = new ArraySegment<byte>(Encoding.UTF8.GetBytes("aad")); 40ArraySegment<byte> plaintext = new ArraySegment<byte>(Encoding.UTF8.GetBytes("plaintext")); 41ArraySegment<byte> aad = new ArraySegment<byte>(Encoding.UTF8.GetBytes("aad")); 87ArraySegment<byte> plaintext = new ArraySegment<byte>(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, 2, 3); 88ArraySegment<byte> aad = new ArraySegment<byte>(new byte[] { 7, 6, 5, 4, 3, 2, 1, 0 }, 1, 4);
SecretTests.cs (5)
15testCode: () => new Secret(default(ArraySegment<byte>)), 24var input = new ArraySegment<byte>(new byte[] { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60 }, 1, 3); 34var outputSegment = new ArraySegment<byte>(new byte[7], 2, 3); 61var outputSegment = new ArraySegment<byte>(new byte[7], 2, 3); 143var outputSegment = new ArraySegment<byte>(new byte[7], 2, 3);
SP800_108\SP800_108Tests.cs (3)
160var labelSegment = new ArraySegment<byte>(new byte[label.Length + 10], 3, label.Length); 162var contextSegment = new ArraySegment<byte>(new byte[context.Length + 10], 5, context.Length); 164var derivedSubkeySegment = new ArraySegment<byte>(new byte[numDerivedBytes + 10], 4, numDerivedBytes);
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)
TestWebSocketConnectionFeature.cs (2)
130public override async Task<WebSocketReceiveResult> ReceiveAsync(ArraySegment<byte> buffer, CancellationToken cancellationToken) 191public override async Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
Microsoft.AspNetCore.Owin (9)
WebSockets\OwinWebSocketAdapter.cs (4)
15Func<ArraySegment<byte> /* data */, 21Func<ArraySegment<byte> /* data */, 102public override async Task<WebSocketReceiveResult> ReceiveAsync(ArraySegment<byte> buffer, CancellationToken cancellationToken) 125public override Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
WebSockets\WebSocketAdapter.cs (5)
15Func<ArraySegment<byte> /* data */, 25Func<ArraySegment<byte> /* data */, 60internal Task SendAsync(ArraySegment<byte> buffer, int messageType, bool endOfMessage, CancellationToken cancel) 76internal async Task<WebSocketReceiveTuple> ReceiveAsync(ArraySegment<byte> buffer, CancellationToken cancel) 97private Task RedirectSendToCloseAsync(ArraySegment<byte> buffer, CancellationToken cancel)
Microsoft.AspNetCore.Server.HttpSys (14)
Helpers.cs (2)
14internal static ArraySegment<byte> GetChunkHeader(long size) 33internal static ArraySegment<byte> GetChunkHeader(int size)
RequestProcessing\ResponseBody.cs (7)
112private unsafe void FlushInternal(bool endOfRequest, ArraySegment<byte> data = new ArraySegment<byte>()) 190private unsafe void BuildDataChunks(scoped ref UnmanagedBufferAllocator allocator, bool endOfRequest, ArraySegment<byte> data, out Span<HTTP_DATA_CHUNK> dataChunks, out Span<GCHandle> pins) 244var chunkHeaderBuffer = Helpers.GetChunkHeader(data.Count); 278ArraySegment<byte> buffer, 320private unsafe Task FlushInternalAsync(ArraySegment<byte> data, CancellationToken cancellationToken) 539var data = new ArraySegment<byte>(buffer, offset, count); 591var data = new ArraySegment<byte>(buffer, offset, count);
RequestProcessing\ResponseStreamAsyncResult.cs (4)
38internal ResponseStreamAsyncResult(ResponseBody responseStream, ArraySegment<byte> data, bool chunked, 59var chunkHeaderBuffer = new ArraySegment<byte>(); 118var chunkHeaderBuffer = new ArraySegment<byte>(); 157private static void SetDataChunk(HTTP_DATA_CHUNK[] chunks, ref int chunkIndex, object[] objectsToPin, ref int pinIndex, ArraySegment<byte> segment)
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
164protected override bool TryGetArray(out ArraySegment<byte> segment)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (3)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
52public static ArraySegment<byte> GetArray(this Memory<byte> buffer) 57public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 59if (!MemoryMarshal.TryGetArray(memory, out var result))
Microsoft.AspNetCore.Server.IIS (4)
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
164protected override bool TryGetArray(out ArraySegment<byte> segment)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
52public static ArraySegment<byte> GetArray(this Memory<byte> buffer) 57public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 59if (!MemoryMarshal.TryGetArray(memory, out var result))
Microsoft.AspNetCore.Server.Kestrel.Core (4)
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
164protected override bool TryGetArray(out ArraySegment<byte> segment)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
52public static ArraySegment<byte> GetArray(this Memory<byte> buffer) 57public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 59if (!MemoryMarshal.TryGetArray(memory, out var result))
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
MessageBodyTests.cs (1)
1400private void AssertASCII(string expected, ArraySegment<byte> actual)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
164protected override bool TryGetArray(out ArraySegment<byte> segment)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (1)
src\Shared\Buffers.MemoryPool\DiagnosticPoolBlock.cs (1)
164protected override bool TryGetArray(out ArraySegment<byte> segment)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (5)
Internal\BufferExtensions.cs (3)
10public static ArraySegment<byte> GetArray(this Memory<byte> memory) 15public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 17if (!MemoryMarshal.TryGetArray(memory, out var result))
Internal\SocketSender.cs (2)
14private List<ArraySegment<byte>>? _bufferList; 83_bufferList = new List<ArraySegment<byte>>();
Microsoft.AspNetCore.Shared.Tests (3)
src\Shared\ServerInfrastructure\BufferExtensions.cs (3)
52public static ArraySegment<byte> GetArray(this Memory<byte> buffer) 57public static ArraySegment<byte> GetArray(this ReadOnlyMemory<byte> memory) 59if (!MemoryMarshal.TryGetArray(memory, out var result))
Microsoft.AspNetCore.SignalR.Client.Tests (2)
WebSocketsTransportTests.cs (2)
66public override async Task<WebSocketReceiveResult> ReceiveAsync(ArraySegment<byte> buffer, CancellationToken cancellationToken) 73public override async Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (1)
Internal\RedisProtocol.cs (1)
243var isArray = MemoryMarshal.TryGetArray(serializedMessage.Serialized, out var array);
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (2)
RedisEndToEnd.cs (2)
406public override async Task<WebSocketReceiveResult> ReceiveAsync(ArraySegment<byte> buffer, CancellationToken cancellationToken) 419public override Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
Microsoft.AspNetCore.SignalR.Tests (2)
EndToEndTests.cs (2)
107var buffer = new ArraySegment<byte>(new byte[1024]); 146var buffer = new ArraySegment<byte>(new byte[1024]);
Microsoft.AspNetCore.SpaServices.Extensions (2)
Util\EventedStreamReader.cs (2)
15public delegate void OnReceivedChunkHandler(ArraySegment<char> chunk); 115private void OnChunk(ArraySegment<char> chunk)
Microsoft.AspNetCore.TestHost (5)
TestWebSocket.cs (5)
110public override async Task<WebSocketReceiveResult> ReceiveAsync(ArraySegment<byte> buffer, CancellationToken cancellationToken) 154public override Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken) 194private static void ValidateSegment(ArraySegment<byte> buffer) 220public Message(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage) 240public ArraySegment<byte> Buffer { get; set; }
Microsoft.AspNetCore.TestHost.Tests (3)
TestClientTests.cs (3)
595var sendBuffer = new System.ArraySegment<byte>(receiveArray, 0, receiveResult.Count); 717var sendBuffer = new System.ArraySegment<byte>(receiveArray, 0, receiveResult.Count); 794var sendBuffer = new System.ArraySegment<byte>(receiveArray, 0, receiveResult.Count);
Microsoft.AspNetCore.Testing (1)
ServiceFakesHostExtensions.cs (1)
75return ArraySegment<Uri>.Empty;
Microsoft.AspNetCore.WebSockets.Tests (1)
BufferStream.cs (1)
19private ArraySegment<byte> _topBuffer;
Microsoft.AspNetCore.WebUtilities (4)
BufferedReadStream.cs (1)
53public ArraySegment<byte> BufferedData
MultipartReaderStream.cs (3)
178var bufferedData = _innerStream.BufferedData; 258var bufferedData = _innerStream.BufferedData; 333private static bool SubMatch(ArraySegment<byte> segment1, ReadOnlySpan<byte> matchBytes, out int matchOffset, out int matchCount)
Microsoft.Build.Framework (3)
SegmentedArray.cs (3)
61if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 156if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 223if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis (18)
CommandLine\CommonCompiler.cs (1)
407ArraySegment<byte> bytes;
CryptographicHashProvider.cs (1)
207internal static ImmutableArray<byte> ComputeHash(HashAlgorithmName algorithmName, IEnumerable<ArraySegment<byte>> bytes)
DiaSymReader\Utilities\ComMemoryStream.cs (1)
75public IEnumerable<ArraySegment<byte>> GetChunks()
DiaSymReader\Writer\SymUnmanagedWriter.cs (1)
27public abstract IEnumerable<ArraySegment<byte>> GetUnderlyingData();
DiaSymReader\Writer\SymUnmanagedWriterImpl.cs (1)
128public override IEnumerable<ArraySegment<byte>> GetUnderlyingData()
EmbeddedText.cs (2)
175public static EmbeddedText FromBytes(string filePath, ArraySegment<byte> bytes, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1) 264internal static ImmutableArray<byte> CreateBlob(ArraySegment<byte> bytes)
EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
InternalUtilities\IncrementalHashExtensions.cs (3)
22internal static void AppendData(this IncrementalHash hash, IEnumerable<ArraySegment<byte>> blobs) 24foreach (var blob in blobs) 30internal static void AppendData(this IncrementalHash hash, ArraySegment<byte> segment)
ReferenceManager\CommonReferenceManager.Binding.cs (2)
242var referenceBindingsToProcess = ArrayBuilder<(MetadataReference, ArraySegment<AssemblyReferenceBinding>)>.GetInstance(); 395[Out] ArrayBuilder<(MetadataReference, ArraySegment<AssemblyReferenceBinding>)> result)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.Analyzers (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.AnalyzerUtilities (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.BannedApiAnalyzers (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.CodeStyle (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.Collections.Package (3)
Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
2508var sourceBlob = doc.GetEmbeddedSource();
Microsoft.CodeAnalysis.Extensions.Package (3)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.Features (4)
SymbolSearch\Windows\IIOService.cs (1)
21void WriteAndFlushAllBytes(string path, ArraySegment<byte> bytes);
SymbolSearch\Windows\SymbolSearchUpdateEngine.IOService.cs (1)
28public void WriteAndFlushAllBytes(string path, ArraySegment<byte> bytes)
SymbolSearch\Windows\SymbolSearchUpdateEngine.Update.cs (2)
324if (!memoryStream.TryGetBuffer(out var arraySegmentBuffer)) 338private async Task WriteDatabaseFileAsync(FileInfo databaseFileInfo, ArraySegment<byte> bytes, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.InteractiveHost (3)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.PublicApiAnalyzers (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.ResxSourceGenerator (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.Threading.Package (3)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.UnitTests (3)
EmbeddedTextTests.cs (3)
25Assert.Throws<ArgumentNullException>("filePath", () => EmbeddedText.FromBytes(null, default(ArraySegment<byte>))); 26Assert.Throws<ArgumentException>("filePath", () => EmbeddedText.FromBytes("", default(ArraySegment<byte>))); 27Assert.Throws<ArgumentNullException>("bytes", () => EmbeddedText.FromBytes("path", default(ArraySegment<byte>)));
Microsoft.CodeAnalysis.Workspaces (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (3)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Microsoft.Data.Analysis (2)
DataFrame.cs (1)
355ArraySegment<int> segment = new ArraySegment<int>(shuffleArray, 0, shuffleLowerLimit);
PrimitiveDataFrameColumn.Sort.cs (1)
66bool isArray = MemoryMarshal.TryGetArray(typedBuffer, out ArraySegment<T> arraySegment);
Microsoft.DotNet.Build.Tasks.Installers (6)
src\RpmHeader.cs (6)
56builder.AppendLine($"\t\t{((ArraySegment<byte>)entry.Value).Count} bytes"); 57builder.AppendLine($"\t\t{BitConverter.ToString(((ArraySegment<byte>)entry.Value).Array!, ((ArraySegment<byte>)entry.Value).Offset, ((ArraySegment<byte>)entry.Value).Count)}"); 257ArraySegment<byte> binary = (ArraySegment<byte>)entry.Value;
Microsoft.DotNet.SignTool (1)
src\VerifySignatures.cs (1)
104File.WriteAllBytes(pgpSignableContent, [.. (ArraySegment<byte>)pgpEntry]);
Microsoft.Extensions.AI.Abstractions (3)
Contents\DataContent.cs (1)
165string base64 = MemoryMarshal.TryGetArray(data, out ArraySegment<byte> segment) ?
SpeechToText\SpeechToTextClientExtensions.cs (2)
49var audioSpeechStream = MemoryMarshal.TryGetArray(audioSpeechContent.Data, out var array) ? 71var audioSpeechStream = MemoryMarshal.TryGetArray(audioSpeechContent.Data, out var array) ?
Microsoft.Extensions.AI.Abstractions.Tests (1)
Embeddings\EmbeddingTests.cs (1)
34Assert.True(MemoryMarshal.TryGetArray(e.Vector, out ArraySegment<float> array));
Microsoft.Extensions.AI.OpenAI (1)
src\Shared\ServerSentEvents\Helpers.cs (1)
88if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> segment))
Microsoft.Extensions.Caching.Hybrid (5)
Internal\BufferChunk.cs (1)
87internal ArraySegment<byte> AsArraySegment() => Length == 0 ? default! : new(OversizedArray!, Offset, Length);
Internal\DefaultHybridCache.StampedeStateT.cs (1)
233result.AsArraySegment(), Key.Key, CacheItem.Tags, Cache, out ArraySegment<byte> payload, out TimeSpan remainingTime,
Internal\HybridCachePayload.cs (2)
178public static HybridCachePayloadParseResult TryParse(ArraySegment<byte> source, string key, TagSet knownTags, DefaultHybridCache cache, 179out ArraySegment<byte> payload, out TimeSpan remainingTime, out PayloadFlags flags, out ushort entropy, out TagSet pendingTags, out Exception? fault)
Internal\InbuiltTypeSerializer.cs (1)
36if (source.IsSingleSegment && MemoryMarshal.TryGetArray(source.First, out ArraySegment<byte> segment))
Microsoft.Extensions.Caching.Hybrid.Tests (10)
DistributedCacheTests.cs (2)
335Assert.True(MemoryMarshal.TryGetArray(payload.First, out var segment)); 385protected override bool TryGetArray(out ArraySegment<byte> segment)
PayloadTests.cs (8)
56var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _); 85var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _); 121var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _); 151var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _); 189var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _); 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 _); 238var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength - 1), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _); 265var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength + 1), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
Microsoft.Extensions.Caching.SqlServer (8)
DatabaseOperations.cs (3)
131public void SetCacheItem(string key, ArraySegment<byte> value, DistributedCacheEntryOptions options) 169public async Task SetCacheItemAsync(string key, ArraySegment<byte> value, DistributedCacheEntryOptions options, CancellationToken token = default(CancellationToken)) 325if (MemoryMarshal.TryGetArray<byte>(memory, out var segment))
IDatabaseOperations.cs (2)
30void SetCacheItem(string key, ArraySegment<byte> value, DistributedCacheEntryOptions options); 32Task SetCacheItemAsync(string key, ArraySegment<byte> value, DistributedCacheEntryOptions options, CancellationToken token = default(CancellationToken));
SqlParameterCollectionExtensions.cs (1)
25public static SqlParameterCollection AddCacheItemValue(this SqlParameterCollection parameters, ArraySegment<byte> value)
SqlServerCache.cs (2)
234private static ArraySegment<byte> Linearize(in ReadOnlySequence<byte> value, out byte[]? lease) 244if (value.IsSingleSegment && MemoryMarshal.TryGetArray(value.First, out var segment))
Microsoft.Extensions.DependencyModel (2)
DependencyContextJsonReader.cs (2)
26ArraySegment<byte> buffer = ReadToEnd(stream); 53private static ArraySegment<byte> ReadToEnd(Stream stream)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
Linux\OSFileSystem.cs (1)
106if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> arraySegment) && arraySegment.Array != null)
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.AzureAppServices (3)
BlobAppendReferenceWrapper.cs (1)
31public async Task AppendAsync(ArraySegment<byte> data, CancellationToken cancellationToken)
BlobLoggerProvider.cs (1)
80var tryGetBuffer = stream.TryGetBuffer(out var buffer);
ICloudAppendBlob.cs (1)
20Task AppendAsync(ArraySegment<byte> data, CancellationToken cancellationToken);
Microsoft.Extensions.Logging.EventSource (1)
EventSourceLogger.cs (1)
270if (!stream.TryGetBuffer(out ArraySegment<byte> buffer))
Microsoft.Extensions.ServiceDiscovery.Dns (9)
Resolver\DnsDataReader.cs (2)
12public ArraySegment<byte> MessageBuffer { get; private set; } 16public DnsDataReader(ArraySegment<byte> buffer, bool returnToPool = false)
Resolver\DnsResolver.cs (5)
303static bool TryReadTarget(in DnsResourceRecord record, ArraySegment<byte> messageBytes, out EncodedDomainName target) 313var gotArray = MemoryMarshal.TryGetArray(record.Data, out ArraySegment<byte> segment); 538Response = new DnsResponse(ArraySegment<byte>.Empty, header, queryStartedTime, queryStartedTime, null!, null!, null!), 551Response = new DnsResponse(ArraySegment<byte>.Empty, header, queryStartedTime, queryStartedTime, null!, null!, null!), 565Response = new DnsResponse(ArraySegment<byte>.Empty, header, queryStartedTime, queryStartedTime, null!, null!, null!),
Resolver\DnsResponse.cs (2)
16public ArraySegment<byte> RawMessageBytes { get; private set; } 18public DnsResponse(ArraySegment<byte> rawData, DnsMessageHeader header, DateTime createdAt, DateTime expiration, List<DnsResourceRecord> answers, List<DnsResourceRecord> authorities, List<DnsResourceRecord> additionals)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (1)
Resolver\LoopbackDnsServer.cs (1)
32private static async Task<int> ProcessRequestCore(IPEndPoint remoteEndPoint, ArraySegment<byte> message, Func<LoopbackDnsResponseBuilder, IPEndPoint, Task> action, Memory<byte> responseBuffer)
Microsoft.Extensions.Telemetry (3)
Latency\Internal\CheckpointTracker.cs (1)
76public ArraySegment<Checkpoint> Checkpoints => new(_checkpoints, 0, _numCheckpoints);
Latency\Internal\MeasureTracker.cs (1)
123public ArraySegment<Measure> Measures
Latency\Internal\TagCollection.cs (1)
70public ArraySegment<Tag> Tags => new(_tags, 0, _numTags);
Microsoft.Extensions.Telemetry.Abstractions (9)
Latency\LatencyData.cs (6)
15private readonly ArraySegment<Tag> _tags; 16private readonly ArraySegment<Checkpoint> _checkpoints; 17private readonly ArraySegment<Measure> _measures; 27public LatencyData(ArraySegment<Tag> tags, ArraySegment<Checkpoint> checkpoints, ArraySegment<Measure> measures, long durationTimestamp, long durationTimestampFrequency)
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 (6)
Latency\LatencyDataTests.cs (6)
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)); 44ArraySegment<Checkpoint> checkpoints = new ArraySegment<Checkpoint>(LatencyDataTests.GetCheckpoints(num), 1, numCheckpoints); 45ArraySegment<Measure> measures = new ArraySegment<Measure>(GetMeasures(num), 2, numMeasures); 46ArraySegment<Tag> tags = new ArraySegment<Tag>(GetTags(num), 3, numTags);
Microsoft.Extensions.Telemetry.Tests (10)
Latency\Internal\CheckpointTrackerTests.cs (1)
75var c = ct.Checkpoints;
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>());
Microsoft.ML.Core (1)
Utilities\HybridMemoryStream.cs (1)
173ArraySegment<byte> buffer;
Microsoft.ML.Data (6)
DataLoadSave\Binary\BinaryLoader.cs (2)
1811ArraySegment<byte> buffer; 1892ArraySegment<byte> buf;
DataLoadSave\Binary\BinarySaver.cs (3)
230ArraySegment<byte> buffer; 373ArraySegment<byte> buffer; 427ArraySegment<byte> buffer;
DataLoadSave\Binary\Codecs.cs (1)
892ArraySegment<byte> buffer;
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
53[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ArraySegment<>))]
netstandard (1)
netstandard.cs (1)
46[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ArraySegment<>))]
Roslyn.Diagnostics.Analyzers (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Roslyn.Test.PdbUtilities (2)
Writer\DelegatingSymUnmanagedWriter.cs (1)
56public override IEnumerable<ArraySegment<byte>> GetUnderlyingData()
Writer\MockSymUnmanagedWriter.cs (1)
71public override IEnumerable<ArraySegment<byte>> GetUnderlyingData()
System.Formats.Asn1 (1)
src\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (1)
15internal static void Return(ArraySegment<byte> arraySegment, int clearSize = ClearAll)
System.Formats.Nrbf (2)
System\Formats\Nrbf\Utils\TypeNameHelpers.cs (2)
132ArraySegment<char> assemblyQualifiedName = RentAssemblyQualifiedName(rawName, libraryRecord.RawLibraryName); 205private static ArraySegment<char> RentAssemblyQualifiedName(string typeName, string libraryName)
System.Memory (3)
System\Buffers\ReadOnlySequence.cs (1)
153else if (MemoryMarshal.TryGetArray(memory, out ArraySegment<T> segment))
System\Buffers\ReadOnlySequence.Helpers.cs (1)
539internal bool TryGetArray(out ArraySegment<T> segment)
System\Runtime\InteropServices\SequenceMarshal.cs (1)
31public static bool TryGetArray<T>(ReadOnlySequence<T> sequence, out ArraySegment<T> segment)
System.Net.HttpListener (4)
src\libraries\Common\src\System\Net\WebSockets\WebSocketValidate.cs (1)
95internal static void ValidateArraySegment(ArraySegment<byte> arraySegment, string parameterName)
System\Net\Managed\HttpListenerContext.Managed.cs (1)
94public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync(string? subProtocol, int receiveBufferSize, TimeSpan keepAliveInterval, ArraySegment<byte> internalBuffer)
System\Net\Managed\WebSockets\HttpWebSocket.Managed.cs (2)
167ArraySegment<byte> buffer, 172ArraySegment<byte> buffer,
System.Net.Sockets (32)
artifacts\obj\System.Net.Sockets\Debug\net10.0\System.Net.Sockets.notsupported.cs (32)
319public System.IAsyncResult BeginReceive(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags, System.AsyncCallback? callback, object? state) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 320public System.IAsyncResult? BeginReceive(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags, out System.Net.Sockets.SocketError errorCode, System.AsyncCallback? callback, object? state) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 325public System.IAsyncResult BeginSend(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags, System.AsyncCallback? callback, object? state) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 326public System.IAsyncResult? BeginSend(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags, out System.Net.Sockets.SocketError errorCode, System.AsyncCallback? callback, object? state) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 384public int Receive(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 385public int Receive(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 386public int Receive(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags, out System.Net.Sockets.SocketError errorCode) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 390public System.Threading.Tasks.Task<int> ReceiveAsync(System.ArraySegment<byte> buffer) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 391public System.Threading.Tasks.Task<int> ReceiveAsync(System.ArraySegment<byte> buffer, System.Net.Sockets.SocketFlags socketFlags) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 392public System.Threading.Tasks.Task<int> ReceiveAsync(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 393public System.Threading.Tasks.Task<int> ReceiveAsync(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 404public System.Threading.Tasks.Task<System.Net.Sockets.SocketReceiveFromResult> ReceiveFromAsync(System.ArraySegment<byte> buffer, System.Net.EndPoint remoteEndPoint) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 405public System.Threading.Tasks.Task<System.Net.Sockets.SocketReceiveFromResult> ReceiveFromAsync(System.ArraySegment<byte> buffer, System.Net.Sockets.SocketFlags socketFlags, System.Net.EndPoint remoteEndPoint) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 412public System.Threading.Tasks.Task<System.Net.Sockets.SocketReceiveMessageFromResult> ReceiveMessageFromAsync(System.ArraySegment<byte> buffer, System.Net.EndPoint remoteEndPoint) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 413public System.Threading.Tasks.Task<System.Net.Sockets.SocketReceiveMessageFromResult> ReceiveMessageFromAsync(System.ArraySegment<byte> buffer, System.Net.Sockets.SocketFlags socketFlags, System.Net.EndPoint remoteEndPoint) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 424public int Send(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 425public int Send(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 426public int Send(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags, out System.Net.Sockets.SocketError errorCode) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 430public System.Threading.Tasks.Task<int> SendAsync(System.ArraySegment<byte> buffer) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 431public System.Threading.Tasks.Task<int> SendAsync(System.ArraySegment<byte> buffer, System.Net.Sockets.SocketFlags socketFlags) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 432public System.Threading.Tasks.Task<int> SendAsync(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 433public System.Threading.Tasks.Task<int> SendAsync(System.Collections.Generic.IList<System.ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 450public System.Threading.Tasks.Task<int> SendToAsync(System.ArraySegment<byte> buffer, System.Net.EndPoint remoteEP) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 451public System.Threading.Tasks.Task<int> SendToAsync(System.ArraySegment<byte> buffer, System.Net.Sockets.SocketFlags socketFlags, System.Net.EndPoint remoteEP) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 471public System.Collections.Generic.IList<System.ArraySegment<byte>>? BufferList { get { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } set { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } } 642public static System.Threading.Tasks.Task<int> ReceiveAsync(this System.Net.Sockets.Socket socket, System.ArraySegment<byte> buffer, System.Net.Sockets.SocketFlags socketFlags) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 644public static System.Threading.Tasks.Task<int> ReceiveAsync(this System.Net.Sockets.Socket socket, System.Collections.Generic.IList<System.ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 648public static System.Threading.Tasks.Task<System.Net.Sockets.SocketReceiveFromResult> ReceiveFromAsync(this System.Net.Sockets.Socket socket, System.ArraySegment<byte> buffer, System.Net.Sockets.SocketFlags socketFlags, System.Net.EndPoint remoteEndPoint) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 650public static System.Threading.Tasks.Task<System.Net.Sockets.SocketReceiveMessageFromResult> ReceiveMessageFromAsync(this System.Net.Sockets.Socket socket, System.ArraySegment<byte> buffer, System.Net.Sockets.SocketFlags socketFlags, System.Net.EndPoint remoteEndPoint) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 652public static System.Threading.Tasks.Task<int> SendAsync(this System.Net.Sockets.Socket socket, System.ArraySegment<byte> buffer, System.Net.Sockets.SocketFlags socketFlags) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 654public static System.Threading.Tasks.Task<int> SendAsync(this System.Net.Sockets.Socket socket, System.Collections.Generic.IList<System.ArraySegment<byte>> buffers, System.Net.Sockets.SocketFlags socketFlags) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); } 658public static System.Threading.Tasks.Task<int> SendToAsync(this System.Net.Sockets.Socket socket, System.ArraySegment<byte> buffer, System.Net.Sockets.SocketFlags socketFlags, System.Net.EndPoint remoteEP) { throw new System.PlatformNotSupportedException(System.SR.SystemNetSockets_PlatformNotSupported); }
System.Net.WebSockets (5)
artifacts\obj\System.Net.WebSockets\Debug\net10.0\System.Net.WebSockets.notsupported.cs (5)
28public static System.ArraySegment<byte> CreateClientBuffer(int receiveBufferSize, int sendBufferSize) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_WebSockets); } 30public static System.Net.WebSockets.WebSocket CreateClientWebSocket(System.IO.Stream innerStream, string? subProtocol, int receiveBufferSize, int sendBufferSize, System.TimeSpan keepAliveInterval, bool useZeroMaskingKey, System.ArraySegment<byte> internalBuffer) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_WebSockets); } 33public static System.ArraySegment<byte> CreateServerBuffer(int receiveBufferSize) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_WebSockets); } 39public abstract System.Threading.Tasks.Task<System.Net.WebSockets.WebSocketReceiveResult> ReceiveAsync(System.ArraySegment<byte> buffer, System.Threading.CancellationToken cancellationToken); 44public abstract System.Threading.Tasks.Task SendAsync(System.ArraySegment<byte> buffer, System.Net.WebSockets.WebSocketMessageType messageType, bool endOfMessage, System.Threading.CancellationToken cancellationToken);
System.Net.WebSockets.Client (6)
src\libraries\Common\src\System\Net\WebSockets\WebSocketValidate.cs (1)
95internal static void ValidateArraySegment(ArraySegment<byte> arraySegment, string parameterName)
System\Net\WebSockets\ClientWebSocket.cs (2)
145public override Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken) => 154public override Task<WebSocketReceiveResult> ReceiveAsync(ArraySegment<byte> buffer, CancellationToken cancellationToken) =>
System\Net\WebSockets\ClientWebSocketOptions.cs (3)
24private ArraySegment<byte>? _buffer; 233internal ArraySegment<byte>? Buffer => _buffer; 248public void SetBuffer(int receiveBufferSize, int sendBufferSize, ArraySegment<byte> buffer)
System.Private.CoreLib (52)
src\libraries\System.Private.CoreLib\src\System\ArraySegment.cs (12)
37public static ArraySegment<T> Empty { get; } = new ArraySegment<T>(new T[0]); 112public void CopyTo(ArraySegment<T> destination) 126obj is ArraySegment<T> other && Equals(other); 128public bool Equals(ArraySegment<T> obj) => 131public ArraySegment<T> Slice(int index) 143public ArraySegment<T> Slice(int index, int count) 169public static bool operator ==(ArraySegment<T> a, ArraySegment<T> b) => a.Equals(b); 171public static bool operator !=(ArraySegment<T> a, ArraySegment<T> b) => !(a == b); 173public static implicit operator ArraySegment<T>(T[] array) => array != null ? new ArraySegment<T>(array) : default; 288internal Enumerator(ArraySegment<T> arraySegment)
src\libraries\System.Private.CoreLib\src\System\Buffers\MemoryManager.cs (1)
53protected internal virtual bool TryGetArray(out ArraySegment<T> segment)
src\libraries\System.Private.CoreLib\src\System\IO\MemoryStream.cs (3)
186public virtual bool TryGetBuffer(out ArraySegment<byte> buffer) 412MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> destinationArray) ? 696if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> sourceArray))
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (2)
160private int ReadSpan(Span<byte> destination, ArraySegment<byte> arraySegment) 478private void WriteSpan(ReadOnlySpan<byte> source, ArraySegment<byte> arraySegment)
src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (2)
310if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> array)) 732if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> array))
src\libraries\System.Private.CoreLib\src\System\IO\TextReader.cs (2)
275new ValueTask<int>(MemoryMarshal.TryGetArray(buffer, out ArraySegment<char> array) ? 305new ValueTask<int>(MemoryMarshal.TryGetArray(buffer, out ArraySegment<char> array) ?
src\libraries\System.Private.CoreLib\src\System\IO\TextWriter.cs (2)
593MemoryMarshal.TryGetArray(buffer, out ArraySegment<char> array) ? 657MemoryMarshal.TryGetArray(buffer, out ArraySegment<char> array) ?
src\libraries\System.Private.CoreLib\src\System\IO\UnmanagedMemoryStream.cs (2)
467MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> destinationArray) ? 733if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> sourceArray))
src\libraries\System.Private.CoreLib\src\System\IO\UnmanagedMemoryStreamWrapper.cs (1)
50public override bool TryGetBuffer(out ArraySegment<byte> buffer)
src\libraries\System.Private.CoreLib\src\System\Memory.cs (2)
179/// Defines an implicit conversion of a <see cref="ArraySegment{T}"/> to a <see cref="Memory{T}"/> 181public static implicit operator Memory<T>(ArraySegment<T> segment) => new Memory<T>(segment.Array, segment.Offset, segment.Count);
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (8)
3722public static Span<T> AsSpan<T>(this ArraySegment<T> segment) 3739public static Span<T> AsSpan<T>(this ArraySegment<T> segment, int start) 3754public static Span<T> AsSpan<T>(this ArraySegment<T> segment, Index startIndex) 3773public static Span<T> AsSpan<T>(this ArraySegment<T> segment, int start, int length) 3789public static Span<T> AsSpan<T>(this ArraySegment<T> segment, Range range) 3868public static Memory<T> AsMemory<T>(this ArraySegment<T> segment) => new Memory<T>(segment.Array, segment.Offset, segment.Count); 3881public static Memory<T> AsMemory<T>(this ArraySegment<T> segment, int start) 3901public static Memory<T> AsMemory<T>(this ArraySegment<T> segment, int start, int length)
src\libraries\System.Private.CoreLib\src\System\ReadOnlyMemory.cs (2)
114/// Defines an implicit conversion of a <see cref="ArraySegment{T}"/> to a <see cref="ReadOnlyMemory{T}"/> 116public static implicit operator ReadOnlyMemory<T>(ArraySegment<T> segment) => new ReadOnlyMemory<T>(segment.Array, segment.Offset, segment.Count);
src\libraries\System.Private.CoreLib\src\System\ReadOnlySpan.cs (2)
208/// Defines an implicit conversion of a <see cref="ArraySegment{T}"/> to a <see cref="ReadOnlySpan{T}"/> 210public static implicit operator ReadOnlySpan<T>(ArraySegment<T> segment)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\MemoryMarshal.cs (3)
270public static bool TryGetArray<T>(ReadOnlyMemory<T> memory, out ArraySegment<T> segment) 299if (Unsafe.As<MemoryManager<T>>(obj).TryGetArray(out ArraySegment<T> tempArraySegment)) 313segment = ArraySegment<T>.Empty;
src\libraries\System.Private.CoreLib\src\System\Runtime\Loader\AssemblyLoadContext.cs (1)
407if (stream.GetType() == typeof(MemoryStream) && ((MemoryStream)stream).TryGetBuffer(out ArraySegment<byte> memoryStreamBuffer))
src\libraries\System.Private.CoreLib\src\System\Span.cs (2)
213/// Defines an implicit conversion of a <see cref="ArraySegment{T}"/> to a <see cref="Span{T}"/> 215public static implicit operator Span<T>(ArraySegment<T> segment) =>
src\libraries\System.Private.CoreLib\src\System\Text\TranscodingStream.cs (5)
102ArraySegment<byte> pendingData = FinalFlushWriteBuffers(); 130ArraySegment<byte> pendingData = FinalFlushWriteBuffers(); 148async ValueTask DisposeAsyncCore(ArraySegment<byte> pendingData) 232private ArraySegment<byte> FinalFlushWriteBuffers() 584ArraySegment<char> decodedChars = new ArraySegment<char>(scratchChars, 0, charsWritten);
System.Private.DataContractSerialization (10)
System\Runtime\Serialization\ClassDataContract.cs (1)
290return t.IsGenericType && (t.GetGenericTypeDefinition() == typeof(ArraySegment<>));
System\Runtime\Serialization\CollectionDataContract.cs (1)
1004return t.IsGenericType && (t.GetGenericTypeDefinition() == typeof(ArraySegment<>));
System\Runtime\Serialization\Json\JsonEncodingStreamWrapper.cs (1)
124public static ArraySegment<byte> ProcessBuffer(byte[] buffer, int offset, int count, Encoding? encoding)
System\Runtime\Serialization\Json\XmlJsonReader.cs (1)
791ArraySegment<byte> seg = JsonEncodingStreamWrapper.ProcessBuffer(buffer, offset, count, encoding);
System\Runtime\Serialization\MemoryStreamAdapter.cs (1)
95if (memoryStream.TryGetBuffer(out ArraySegment<byte> innerBuffer))
System\Xml\EncodingStreamWrapper.cs (2)
432internal static ArraySegment<byte> ProcessBuffer(byte[] buffer, int offset, int count, Encoding? encoding) 440ArraySegment<byte> seg;
System\Xml\XmlBinaryWriter.cs (2)
1064ArraySegment<byte> arraySegment; 1134ArraySegment<byte> arraySegment;
System\Xml\XmlUTF8TextReader.cs (1)
567ArraySegment<byte> seg = EncodingStreamWrapper.ProcessBuffer(buffer, offset, count, encoding);
System.Private.Windows.Core (21)
System\IO\BinaryReaderExtensions.cs (1)
236else if (values is ArraySegment<T> arraySegment)
System\Value.cs (20)
61type = typeof(ArraySegment<byte>); 65type = typeof(ArraySegment<char>); 550public Value(ArraySegment<byte> segment) 566public static implicit operator Value(ArraySegment<byte> value) => new(value); 567public static explicit operator ArraySegment<byte>(in Value value) => value.GetValue<ArraySegment<byte>>(); 569public Value(ArraySegment<char> segment) 585public static implicit operator Value(ArraySegment<char> value) => new(value); 586public static explicit operator ArraySegment<char>(in Value value) => value.GetValue<ArraySegment<char>>(); 664if (typeof(T) == typeof(ArraySegment<byte>)) 665return new(Unsafe.As<T, ArraySegment<byte>>(ref Unsafe.AsRef(in value))); 666if (typeof(T) == typeof(ArraySegment<char>)) 667return new(Unsafe.As<T, ArraySegment<char>>(ref Unsafe.AsRef(in value))); 777else if (typeof(T) == typeof(ArraySegment<byte>)) 782ArraySegment<byte> segment = bits != ulong.MaxValue 785value = Unsafe.As<ArraySegment<byte>, T>(ref segment); 793else if (typeof(T) == typeof(ArraySegment<char>)) 798ArraySegment<char> segment = bits != ulong.MaxValue 801value = Unsafe.As<ArraySegment<char>, T>(ref segment);
System.Private.Windows.Core.Tests (22)
System\Value\StoringArrays.cs (22)
19Assert.Throws<InvalidCastException>(() => value.GetValue<ArraySegment<byte>>()); 33Assert.Throws<InvalidCastException>(() => value.GetValue<ArraySegment<char>>()); 42ArraySegment<byte> segment = new(b); 44Assert.Equal(typeof(ArraySegment<byte>), value.Type); 45Assert.Equal(segment, value.GetValue<ArraySegment<byte>>()); 46Assert.Equal(segment, (ArraySegment<byte>)value.GetValue<object>()); 51Assert.Equal(typeof(ArraySegment<byte>), value.Type); 52Assert.Equal(segment, value.GetValue<ArraySegment<byte>>()); 53Assert.Equal(segment, (ArraySegment<byte>)value.GetValue<object>()); 58Assert.Equal(typeof(ArraySegment<byte>), value.Type); 59Assert.Equal(segment, value.GetValue<ArraySegment<byte>>()); 60Assert.Equal(segment, (ArraySegment<byte>)value.GetValue<object>()); 70ArraySegment<char> segment = new(b); 72Assert.Equal(typeof(ArraySegment<char>), value.Type); 73Assert.Equal(segment, value.GetValue<ArraySegment<char>>()); 74Assert.Equal(segment, (ArraySegment<char>)value.GetValue<object>()); 79Assert.Equal(typeof(ArraySegment<char>), value.Type); 80Assert.Equal(segment, value.GetValue<ArraySegment<char>>()); 81Assert.Equal(segment, (ArraySegment<char>)value.GetValue<object>()); 86Assert.Equal(typeof(ArraySegment<char>), value.Type); 87Assert.Equal(segment, value.GetValue<ArraySegment<char>>()); 88Assert.Equal(segment, (ArraySegment<char>)value.GetValue<object>());
System.Private.Xml (1)
System\Xml\Serialization\Types.cs (1)
951return t.IsGenericType && (t.GetGenericTypeDefinition() == typeof(ArraySegment<>));
System.Reflection.Metadata (2)
System\Reflection\Metadata\Blob.cs (1)
21public ArraySegment<byte> GetBytes() => new ArraySegment<byte>(Buffer, Start, Length);
System\Reflection\PortableExecutable\PEBuilder.cs (1)
530var segment = blob.GetBytes();
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
41[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ArraySegment<>))]
System.Runtime.InteropServices.JavaScript (6)
artifacts\obj\System.Runtime.InteropServices.JavaScript\Debug\net10.0\System.Runtime.InteropServices.JavaScript.notsupported.cs (6)
302public void ToManaged(out ArraySegment<byte> value) { throw new System.PlatformNotSupportedException(System.SR.SystemRuntimeInteropServicesJavaScript_PlatformNotSupported); } 303public void ToJS(ArraySegment<byte> value) { throw new System.PlatformNotSupportedException(System.SR.SystemRuntimeInteropServicesJavaScript_PlatformNotSupported); } 308public void ToManaged(out ArraySegment<int> value) { throw new System.PlatformNotSupportedException(System.SR.SystemRuntimeInteropServicesJavaScript_PlatformNotSupported); } 309public void ToJS(ArraySegment<int> value) { throw new System.PlatformNotSupportedException(System.SR.SystemRuntimeInteropServicesJavaScript_PlatformNotSupported); } 310public void ToManaged(out ArraySegment<double> value) { throw new System.PlatformNotSupportedException(System.SR.SystemRuntimeInteropServicesJavaScript_PlatformNotSupported); } 311public void ToJS(ArraySegment<double> value) { throw new System.PlatformNotSupportedException(System.SR.SystemRuntimeInteropServicesJavaScript_PlatformNotSupported); }
System.Security.Cryptography.Pkcs (11)
src\libraries\Common\src\System\Security\Cryptography\Asn1Reader\AsnValueReader.cs (1)
251internal static ArraySegment<byte> RentAndEncode(this AsnWriter writer)
src\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (1)
15internal static void Return(ArraySegment<byte> arraySegment, int clearSize = ClearAll)
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (7)
253internal static ArraySegment<byte> DecryptPkcs8( 265internal static ArraySegment<byte> DecryptPkcs8( 287ArraySegment<byte> decrypted = DecryptPkcs8(password, manager.Memory, out bytesRead); 318ArraySegment<byte> decrypted = KeyFormatHelper.DecryptPkcs8(passwordBytes, manager.Memory, out bytesRead); 339private static ArraySegment<byte> DecryptPkcs8( 389ArraySegment<byte> decrypted = DecryptPkcs8( 425ArraySegment<byte> decrypted = DecryptPkcs8(
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs8PrivateKeyInfo.cs (2)
178ArraySegment<byte> decrypted = KeyFormatHelper.DecryptPkcs8( 209ArraySegment<byte> decrypted = KeyFormatHelper.DecryptPkcs8(
System.ServiceModel.NetFramingBase (13)
System\ServiceModel\Channels\FramingChannels.cs (4)
55ArraySegment<byte> messageData; 70protected override ValueTask StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout) 81protected override ArraySegment<byte> EncodeMessage(Message message) 83ArraySegment<byte> messageData = MessageEncoder.WriteMessage(message,
System\ServiceModel\Channels\FramingEncoders.cs (4)
223public static ArraySegment<byte> EncodeMessageFrame(ArraySegment<byte> messageFrame) 308public static ArraySegment<byte> EncodeMessageFrame(ArraySegment<byte> messageFrame)
System\ServiceModel\Channels\SingletonConnectionReader.cs (2)
533if (MemoryMarshal.TryGetArray(buffer, out ArraySegment<byte> array)) 590ArraySegment<byte> messageData = await messageEncoder.WriteMessageAsync(message,
System\ServiceModel\Channels\TransportDuplexSessionChannel.cs (3)
382protected abstract ValueTask StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout); 386protected abstract ArraySegment<byte> EncodeMessage(Message message); 431ArraySegment<byte> messageData;
System.ServiceModel.Primitives (4)
netstandard.cs (4)
1599public System.ServiceModel.Channels.Message ReadMessage(System.ArraySegment<byte> buffer, System.ServiceModel.Channels.BufferManager bufferManager) { return default; } 1600public abstract System.ServiceModel.Channels.Message ReadMessage(System.ArraySegment<byte> buffer, System.ServiceModel.Channels.BufferManager bufferManager, string contentType); 1604public System.ArraySegment<byte> WriteMessage(System.ServiceModel.Channels.Message message, int maxMessageSize, System.ServiceModel.Channels.BufferManager bufferManager) { return default; } 1605public abstract System.ArraySegment<byte> WriteMessage(System.ServiceModel.Channels.Message message, int maxMessageSize, System.ServiceModel.Channels.BufferManager bufferManager, int messageOffset);
System.Text.Json (10)
System\Text\Json\Document\JsonDocument.cs (4)
836private ReadOnlySpan<byte> UnescapeString(in DbRow row, out ArraySegment<byte> rented) 855private static void ClearAndReturn(ArraySegment<byte> rented) 875ArraySegment<byte> rented = default; 889ArraySegment<byte> rented = default;
System\Text\Json\Document\JsonDocument.Parse.cs (6)
126ArraySegment<byte> drained = ReadToEnd(utf8Json); 159ArraySegment<byte> drained = ReadToEnd(utf8Json); 223ArraySegment<byte> drained = await ReadToEndAsync(utf8Json, cancellationToken).ConfigureAwait(false); 247ArraySegment<byte> drained = await ReadToEndAsync(utf8Json, cancellationToken).ConfigureAwait(false); 799private static ArraySegment<byte> ReadToEnd(Stream stream) 875ValueTask<ArraySegment<byte>>
System.Windows.Forms (1)
System\Windows\Forms\BinaryFormat\WinFormsBinaryFormatWriter.cs (1)
22bool success = memoryStream.TryGetBuffer(out ArraySegment<byte> data);
Test.Utilities (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))
Text.Analyzers (6)
src\Compilers\Core\Portable\EncodedStringText.cs (3)
144if (TryGetBytesFromStream(data, out ArraySegment<byte> bytes) && bytes.Offset == 0 && bytes.Array is object) 167internal static bool TryGetBytesFromStream(Stream data, out ArraySegment<byte> bytes) 194out ArraySegment<byte> bytes)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (3)
69if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 164if (!MemoryMarshal.TryGetArray<T>(memory, out var segment)) 231if (!MemoryMarshal.TryGetArray<T>(memory, out var segment))