142 references to ToArray
Aspire.Azure.AI.OpenAI.Tests (1)
AspireAzureOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs (1)
218Assert.Equal(1.23f, vector.ToArray().Single());
Aspire.OpenAI.Tests (2)
AspireOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs (2)
221Assert.Equal(1.23f, vector.ToArray().Single()); 255Assert.Equal(1.23f, vector.ToArray().Single());
dotnet (1)
ToolManifest\ToolManifestEditor.cs (1)
398return Encoding.UTF8.GetString(arrayBufferWriter.WrittenMemory.ToArray());
dotnet-aot (1)
src\sdk\src\Cli\dotnet\ToolManifest\ToolManifestEditor.cs (1)
398return Encoding.UTF8.GetString(arrayBufferWriter.WrittenMemory.ToArray());
Microsoft.AspNetCore.Components (1)
PersistentState\PersistentValueProviderComponentSubscription.cs (1)
198_state.PersistAsBytes(_storageKey, writer.WrittenMemory.ToArray());
Microsoft.AspNetCore.Identity (5)
PasskeyHandler.cs (2)
332var credentialId = attestedCredentialData.CredentialId.ToArray(); 354Aaguid = attestedCredentialData.Aaguid.ToArray(),
Passkeys\AttestedCredentialData.cs (1)
72var credentialId = data.Slice(offset, credentialIdLength).ToArray();
Passkeys\BufferSource.cs (1)
65=> _bytes.ToArray();
Passkeys\CredentialPublicKey.cs (1)
253public byte[] ToArray() => _bytes.ToArray();
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
Infrastructure\DefaultTempDataSerializer.cs (1)
213return bufferWriter.WrittenMemory.ToArray();
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Internal\TlsConnectionFeature.cs (1)
72_applicationProtocol = _sslStream.NegotiatedApplicationProtocol.Protocol.ToArray();
Microsoft.Build.Framework (1)
FileUtilities.cs (1)
771Span<char> newValue = ConvertToUnixSlashes(value.ToArray());
Microsoft.Extensions.AI (2)
ChatRouting\SemanticRoutingChatClient.cs (1)
342index[i] = new(_profiles[i].ClientIndex, embeddings[i].Vector.ToArray());
Common\OtelMessageSerializer.cs (1)
293return Encoding.UTF8.GetString(dc.Data.ToArray());
Microsoft.Extensions.AI.Abstractions (6)
Contents\DataContent.cs (2)
375return $"MediaType = {MediaType}, Text = \"{Encoding.UTF8.GetString(Data.ToArray())}\""; 380return $"JSON = {Encoding.UTF8.GetString(Data.ToArray())}";
Files\HostedFileClientExtensions.cs (1)
43new(content.Data.ToArray());
parent\parent\parent\eng\MSBuild\parent\parent\src\LegacySupport\FilePolyfills\FilePolyfills.cs (1)
69byteArray = bytes.ToArray();
SpeechToText\SpeechToTextClientExtensions.cs (2)
52new MemoryStream(audioSpeechContent.Data.ToArray()); 74new MemoryStream(audioSpeechContent.Data.ToArray());
Microsoft.Extensions.AI.Abstractions.Tests (42)
ChatCompletion\ChatOptionsTests.cs (2)
259Assert.Equal(new byte[] { 1, 2, 3 }, result.ContinuationToken.ToBytes().ToArray()); 393Assert.Equal(new byte[] { 1, 2, 3, 4 }, result.ContinuationToken.ToBytes().ToArray());
ChatCompletion\ChatResponseTests.cs (2)
153Assert.Equal(new byte[] { 1, 2, 3 }, result.ContinuationToken.ToBytes().ToArray()); 223Assert.Equal(new byte[] { 1, 2, 3 }, result.ContinuationToken.ToBytes().ToArray());
ChatCompletion\ChatResponseUpdateTests.cs (4)
154Assert.Equal("data"u8.ToArray(), ((DataContent)result.Contents[3]).Data.ToArray()); 218Assert.Equal("data"u8.ToArray(), ((DataContent)result.Contents[3]).Data.ToArray()); 233Assert.Equal(new byte[] { 1, 2, 3 }, result.ContinuationToken.ToBytes().ToArray()); 452Assert.Equal(new byte[] { 1, 2, 3 }, result.ContinuationToken.ToBytes().ToArray());
Contents\DataContentTests.cs (14)
124Assert.Equal(expectedData, Encoding.UTF8.GetString(content.Data.ToArray())); 178Assert.Equal([0x01, 0x02, 0x03, 0x04], content.Data.ToArray()); 201Assert.Equal([0x01, 0x02, 0x03, 0x04], content.Data.ToArray()); 288Assert.Equal(data, content.Data.ToArray()); 300Assert.Equal("hello world", Encoding.ASCII.GetString(content.Data.ToArray())); 328Assert.Equal(testData, content.Data.ToArray()); 355Assert.Equal(testData, content.Data.ToArray()); 381Assert.Equal(testData, content.Data.ToArray()); 409Assert.Equal(testData, content.Data.ToArray()); 433Assert.Equal(testData, content.Data.ToArray()); 449Assert.Equal(testData, content.Data.ToArray()); 724Assert.Equal(testData, content.Data.ToArray()); 907Assert.Equal(testData, content.Data.ToArray()); 997Assert.Equal(new byte[] { 1, 2, 3, 4 }, dataContent.Data.ToArray());
Embeddings\EmbeddingTests.cs (10)
30Assert.Equal(floats, e.Vector.ToArray()); 49Assert.Equal(e.Vector.ToArray(), result.Vector.ToArray()); 62Assert.Equal(e.Vector.ToArray(), result.Vector.ToArray()); 90Assert.Equal(e.Vector.ToArray(), result.Vector.ToArray()); 103Assert.Equal(e.Vector.ToArray(), result.Vector.ToArray()); 125Assert.Equal(new float[] { 1.0f, 2.0f, 3.0f }, floatEmbedding.Vector.ToArray());
Files\HostedFileClientExtensionsTests.cs (1)
373Assert.Equal(data, result.Data.ToArray());
Files\HostedFileDownloadStreamTests.cs (3)
29Assert.Equal(data, content.Data.ToArray()); 40Assert.Equal(data, content.Data.ToArray()); 50Assert.Empty(content.Data.ToArray());
Image\ImageGenerationResponseTests.cs (1)
117Assert.Equal([1, 2, 3, 4], dataContent.Data.ToArray());
Image\ImageGeneratorExtensionsTests.cs (1)
121Assert.Equal(imageData, dataContent.Data.ToArray());
parent\parent\parent\eng\MSBuild\parent\parent\src\LegacySupport\FilePolyfills\FilePolyfills.cs (1)
69byteArray = bytes.ToArray();
ResponseContinuationTokenTests.cs (3)
20Assert.Equal(testBytes, token.ToBytes().ToArray()); 38Assert.Equal(originalToken.ToBytes().ToArray(), deserializedToken.ToBytes().ToArray());
Microsoft.Extensions.AI.Integration.Tests (3)
EmbeddingGeneratorIntegrationTests.cs (2)
56Assert.NotEmpty(embeddings[0].Vector.ToArray()); 77Assert.NotEmpty(embedding.Vector.ToArray());
ImageGeneratingChatClientIntegrationTests.cs (1)
175Assert.Equal(testImageData, originalImageContent.Data.ToArray());
Microsoft.Extensions.AI.OpenAI (3)
OpenAIImageGenerator.cs (1)
63new MemoryStream(dataContent.Data.ToArray());
OpenAIRealtimeClientSession.cs (2)
677BinaryData.FromBytes(dataContent.Data.ToArray()))); 743return BinaryData.FromBytes(content.Data.ToArray());
Microsoft.Extensions.AI.OpenAI.Tests (12)
OpenAIAssistantChatClientIntegrationTests.cs (1)
79Assert.NotEmpty(codeInput.Data.ToArray());
OpenAIEmbeddingGeneratorTests.cs (2)
146Assert.Contains(e.Vector.ToArray(), f => !f.Equals(0)); 215Assert.Contains(e.Vector.ToArray(), f => !f.Equals(0));
OpenAIHostedFileClientIntegrationTests.cs (1)
212Assert.Equal(content, Encoding.UTF8.GetString(dataContent.Data.ToArray()));
OpenAIResponseClientIntegrationTests.cs (2)
59Assert.NotEmpty(codeInput.Data.ToArray()); 183File.WriteAllBytes(tempPath, imageContent.Data.ToArray());
OpenAIResponseClientTests.cs (4)
3400Assert.Equal("# Calculating the sum of numbers from 1 to 5\nresult = sum(range(1, 6))\nresult", Encoding.UTF8.GetString(codeInput.Data.ToArray())); 3620Assert.Equal("# Calculate the sum of numbers from 1 to 10\nsum_of_numbers = sum(range(1, 11))\nsum_of_numbers", Encoding.UTF8.GetString(codeInput.Data.ToArray())); 3720codeBuilder.Append(Encoding.UTF8.GetString(dataContent.Data.ToArray())); 3746Assert.Equal("# sum(range(1, 11))", Encoding.UTF8.GetString(codeInput.Data.ToArray()));
OpenAITextToSpeechClientTests.cs (2)
324Assert.Equal(new byte[] { 1, 2, 3, 4 }, data0.Data.ToArray()); 331Assert.Equal(new byte[] { 5, 6, 7, 8 }, data1.Data.ToArray());
Microsoft.Extensions.AI.Stabilization.Tests (3)
parent\Microsoft.Extensions.AI.Abstractions.Tests\ResponseContinuationTokenTests.cs (3)
20Assert.Equal(testBytes, token.ToBytes().ToArray()); 38Assert.Equal(originalToken.ToBytes().ToArray(), deserializedToken.ToBytes().ToArray());
Microsoft.Extensions.AI.Tests (4)
Embeddings\DistributedCachingEmbeddingGeneratorTest.cs (4)
324Assert.NotEqual(result1.Vector.ToArray(), result4.Vector.ToArray()); 407Assert.Equal(expected.Vector.ToArray(), actual.Vector.ToArray());
Microsoft.Extensions.DataIngestion.Tests (7)
Processors\AlternativeTextEnricherTests.cs (4)
56Assert.Equal(_imageContent.ToArray(), dataContent.Data.ToArray()); 143Assert.Equal(_imageContent.ToArray(), dataContent.Data.ToArray());
Readers\MarkdownReaderTests.cs (3)
134Assert.Equal(imageBytes1, images[0].Content?.ToArray()); 137Assert.Equal(imageBytes2, images[1].Content?.ToArray()); 140Assert.Equal(imageBytes3, images[2].Content?.ToArray());
Microsoft.Extensions.VectorData.ConformanceTests (8)
ModelTests\BasicModelTests.cs (2)
536Assert.Equal(Vector.ToArray(), other.Vector.ToArray());
ModelTests\DynamicModelTests.cs (2)
371((ReadOnlyMemory<float>)expected[VectorPropertyName]!).ToArray(), 372((ReadOnlyMemory<float>)actual[VectorPropertyName]!).ToArray());
TypeTests\EmbeddingTypeTests.cs (4)
26vectorEqualityAsserter: (e, a) => Assert.Equal(e.ToArray(), a.ToArray())); 33vectorEqualityAsserter: (e, a) => Assert.Equal(e.Vector.ToArray(), a.Vector.ToArray()));
Microsoft.ML.AutoML (1)
ColumnInference\PurposeInference.cs (1)
99var copy = new ReadOnlyMemory<char>(value.ToArray());
Microsoft.ML.Transforms (1)
Text\WordEmbeddingsExtractor.cs (1)
142labels.Add(new string(label.Value.ToArray()));
NuGet.Packaging (3)
Signing\Timestamp\Rfc3161TimestampRequestNetstandard21Wrapper.cs (1)
85return normalizedNonce.HasValue ? normalizedNonce.Value.ToArray() : null;
Signing\Timestamp\Rfc3161TimestampTokenInfoNetstandard21Wrapper.cs (2)
48var value = _rfc3161TimestampTokenInfo.GetMessageHash().ToArray(); 63return nonce.Value.ToArray();
System.Memory.Data (1)
System\BinaryData.cs (1)
437public byte[] ToArray() => _bytes.ToArray();
System.Net.Security (3)
System\Net\Security\SslConnectionInfo.cs (3)
9private static readonly byte[] s_http1 = SslApplicationProtocol.Http11.Protocol.ToArray(); 10private static readonly byte[] s_http2 = SslApplicationProtocol.Http2.Protocol.ToArray(); 11private static readonly byte[] s_http3 = SslApplicationProtocol.Http3.Protocol.ToArray();
System.Private.CoreLib (1)
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryDebugView.cs (1)
23public T[] Items => _memory.ToArray();
System.Security.Cryptography (8)
src\runtime\src\libraries\Common\src\Internal\Cryptography\PkcsHelpers.cs (1)
279valueColl.Add(CreateBestPkcs9AttributeObjectAvailable(type, attrValue.ToArray()));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Builder.cs (1)
133return _sealedData.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Info.cs (1)
60ReadOnlyMemory<byte> maybeCopy = skipCopy ? firstValue : firstValue.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12SafeBag.cs (1)
51EncodedBagValue = skipCopy ? encodedBagValue : encodedBagValue.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs8PrivateKeyInfo.cs (2)
40AlgorithmParameters = skipCopies ? algorithmParameters : algorithmParameters?.ToArray(); 41PrivateKeyBytes = skipCopies ? privateKey : privateKey.ToArray();
System\Security\Cryptography\X509Certificates\X509Certificate.cs (1)
501return PalRawDataMemory.ToArray();
System\Security\Cryptography\X509Certificates\X509Certificate2.cs (1)
337public byte[] RawData => RawDataMemory.ToArray();
System.Security.Cryptography.Pkcs (19)
Internal\Cryptography\Pal\AnyOS\AsnHelpers.cs (3)
23var name = new X500DistinguishedName(originator.IssuerAndSerialNumber.Value.Issuer.ToArray()); 47originatorKey.PublicKey.ToArray())); 142parameters = asn.Parameters.Value.ToArray();
Internal\Cryptography\Pal\AnyOS\ManagedPal.cs (1)
113alg.IV = rc2Params.Iv.ToArray();
Internal\Cryptography\Pal\AnyOS\ManagedPal.Decode.cs (1)
35data.EncryptedContentInfo.EncryptedContent?.ToArray() ?? Array.Empty<byte>());
Internal\Cryptography\Pal\AnyOS\ManagedPal.KeyAgree.cs (1)
25_asn.RecipientEncryptedKeys[_index].EncryptedKey.ToArray();
Internal\Cryptography\Pal\AnyOS\ManagedPal.KeyTrans.cs (1)
26_asn.EncryptedKey.ToArray();
src\runtime\src\libraries\Common\src\Internal\Cryptography\PkcsHelpers.cs (1)
279valueColl.Add(CreateBestPkcs9AttributeObjectAvailable(type, attrValue.ToArray()));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Builder.cs (1)
133return _sealedData.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Info.cs (1)
60ReadOnlyMemory<byte> maybeCopy = skipCopy ? firstValue : firstValue.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12SafeBag.cs (1)
51EncodedBagValue = skipCopy ? encodedBagValue : encodedBagValue.ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs8PrivateKeyInfo.cs (2)
40AlgorithmParameters = skipCopies ? algorithmParameters : algorithmParameters?.ToArray(); 41PrivateKeyBytes = skipCopies ? privateKey : privateKey.ToArray();
System\Security\Cryptography\Pkcs\Rfc3161TimestampRequest.cs (1)
48rawExtension.ExtnValue.ToArray(),
System\Security\Cryptography\Pkcs\Rfc3161TimestampToken.cs (1)
443if (issuerDirectoryName != new X500DistinguishedName(requiredName.DirectoryName.Value.ToArray()).Name)
System\Security\Cryptography\Pkcs\Rfc3161TimestampTokenInfo.cs (2)
186rawExtension.ExtnValue.ToArray(), 271copiedBytes = firstElement.ToArray();
System\Security\Cryptography\Pkcs\SignedCms.cs (1)
200ContentInfo = new ContentInfo(new Oid(_contentType), contentValue.ToArray());
System\Security\Cryptography\Pkcs\SignerInfo.cs (1)
71public byte[] GetSignature() => _signature.ToArray();
System.Text.Json (1)
System\Text\Json\Document\JsonDocument.cs (1)
716ReadOnlyMemory<byte> segmentCopy = GetRawValue(index, includeQuotes: true).ToArray();