171 references to ToArray
ILCompiler.Compiler (1)
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\PEObjectWriter.cs (1)
882BinaryPrimitives.WriteUInt32LittleEndian(timestamp, BlobContentId.FromHash(hash.ToArray()).Stamp);
ILCompiler.ReadyToRun (1)
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\PEObjectWriter.cs (1)
882BinaryPrimitives.WriteUInt32LittleEndian(timestamp, BlobContentId.FromHash(hash.ToArray()).Stamp);
Microsoft.AspNetCore.Antiforgery (2)
Internal\DefaultAntiforgeryTokenSerializer.cs (2)
64var unprotectedBytes = _defaultCryptoSystem.Unprotect(tokenBytesDecoded.ToArray()); 262var protectedBytes = _defaultCryptoSystem.Protect(tokenBytes.ToArray());
Microsoft.AspNetCore.Components.Endpoints (1)
TempData\CookieTempDataProvider.cs (1)
84var unprotectedBytes = _dataProtector.Unprotect(protectedBytes.ToArray());
Microsoft.AspNetCore.Components.WebAssembly (1)
Rendering\WebAssemblyRenderer.cs (1)
219var batchBytes = arrayBuilder.Buffer.AsSpan(0, arrayBuilder.Count).ToArray();
Microsoft.AspNetCore.DataProtection (2)
Managed\ManagedAuthenticatedEncryptor.cs (1)
263validationAlgorithm.Key = validationSubkeyArray ?? validationSubkey.ToArray();
SP800_108\ManagedSP800_108_CTR_HMACSHA512.cs (1)
133var prfOutputArray = prf.ComputeHash(prfInputArray ?? prfInput.ToArray());
Microsoft.AspNetCore.Identity (1)
Passkeys\BufferSourceJsonConverter.cs (1)
65bytes = byteSpan[..bytesWritten].ToArray();
Microsoft.AspNetCore.OutputCaching (1)
RecyclableArrayBufferWriter.cs (1)
78public T[] ToArray() => _buffer.AsSpan(0, _index).ToArray();
Microsoft.AspNetCore.Server.Kestrel.Core (8)
src\aspnetcore\src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (3)
604return span.Slice(0, length).ToArray(); 616return span.Slice(0, length).ToArray(); 632return span.Slice(0, length).ToArray();
src\aspnetcore\src\Shared\runtime\Http3\QPack\QPackEncoder.cs (5)
44return buffer.Slice(0, bytesWritten).ToArray(); 99return temp.Slice(0, headerBytesWritten).ToArray(); 107return temp.Slice(0, bytesWritten).ToArray(); 169return temp.Slice(0, nameLength).ToArray(); 179return temp.Slice(0, bytesWritten).ToArray();
Microsoft.CodeAnalysis.Razor.Compiler (1)
Language\TagHelperCollection.SegmentBuilder.cs (1)
112_ => new MultiSegmentCollection(ImmutableCollectionsMarshal.AsImmutableArray(segments.ToArray()))
Microsoft.Diagnostics.DataContractReader.Contracts (1)
Contracts\StackWalk\Context\ContextHolder.cs (1)
50return byteSpan.ToArray();
Microsoft.Diagnostics.DataContractReader.Legacy (1)
Dbi\DacDbiImpl.cs (1)
1743byte[] contextBuf = new Span<byte>(pContext, (int)contextSize).ToArray();
Microsoft.DotNet.Build.Tasks.FileCatalog (1)
CatalogBuilder.cs (1)
248return hash.AsSpan(0, ListIdentifierLength).ToArray();
Microsoft.Extensions.Caching.Hybrid (3)
Internal\HybridCachePayload.cs (1)
311pendingTags = new(pendingTagBuffer.AsSpan(0, pendingTagsCount).ToArray());
Internal\RecyclableArrayBufferWriter.cs (1)
132public T[] ToArray() => _buffer.AsSpan(0, _index).ToArray();
Internal\TagSet.cs (1)
161string[] final = oversized.AsSpan(0, count).ToArray();
Microsoft.Extensions.FileProviders.Physical (1)
PollingWildCardChangeToken.cs (1)
140_previousHash = currentHash.ToArray(); // First run
Microsoft.Extensions.Identity.Core (1)
PasswordHasher.cs (1)
267byte[] salt = hashedPassword.AsSpan(13, saltLength).ToArray();
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (7)
Resolver\DnsDataWriterTests.cs (3)
34Assert.Equal(expected, buffer.AsSpan().Slice(0, writer.Position).ToArray()); 82Assert.Equal(expected, buffer.AsSpan().Slice(0, writer.Position).ToArray()); 138Assert.Equal(expected, buffer.AsSpan().Slice(0, writer.Position).ToArray());
Resolver\DnsPrimitivesTests.cs (3)
28Assert.Equal(expected, buffer.AsSpan().Slice(0, written).ToArray()); 78Assert.Equal(buffer1.AsSpan().Slice(0, written1).ToArray(), buffer2.AsSpan().Slice(0, written2).ToArray());
Resolver\LoopbackDnsServer.cs (1)
213return buffer.AsSpan(0, bytesWritten).ToArray();
Microsoft.ML.Tokenizers (2)
Normalizer\SentencePieceNormalizer.cs (1)
610trieBlob = new Span<DoubleArrayUnit>((DoubleArrayUnit*)pBlob, (int)trieBlobSize / 4).ToArray();
Utils\BytePairEncoder.cs (1)
285var result = resultPoolArray.AsSpan(0, resultCount).ToArray();
Microsoft.ML.Tokenizers.Tests (10)
BertTokenizerTests.cs (10)
387Assert.Equal(new int[] { bertTokenizer.ClassificationTokenId, bertTokenizer.ClassificationTokenId, 8, 6, 10, 11, 12, 7, bertTokenizer.SeparatorTokenId, bertTokenizer.SeparatorTokenId }, ids1Span.ToArray()); 404ids1Span.ToArray()); 427ids1Span.ToArray()); 444ids1Span.ToArray()); 487Assert.Equal(new int[] { 1, 0, 0, 0, 0, 0, 0, 1 }, ids1Span.ToArray()); 502Assert.Equal(new int[] { 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1 }, ids1Span.ToArray()); 522Assert.Equal(new int[] { 1, 0, 0, 0, 0, 0, 0, 1 }, ids1Span.ToArray()); 537Assert.Equal(new int[] { 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }, ids1Span.ToArray()); 580Assert.Equal(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, ids1Span.ToArray()); 595Assert.Equal(new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 }, ids1Span.ToArray());
Microsoft.ML.TorchSharp (3)
AutoFormerV2\Anchors.cs (1)
62var imageShape = torch.tensor(image.shape.AsSpan().Slice(2).ToArray());
Roberta\Models\RobertaModel.cs (1)
118var segment = questionSize == size - 1 ? torch.tensor(Zeros.AsSpan(0, size).ToArray(), 1, size, dtype: torch.int64, device: device) :
Roberta\QATrainer.cs (1)
927outputCache.PredictedAnswersBuffer[index] = new ReadOnlyMemory<char>(_parent.Tokenizer.Decode(_parent.Tokenizer.RobertaModel().ConvertOccurrenceRanksToIds(contextIds).ToArray().AsSpan(predictStart - questionLength - 2, predictEnd - predictStart).ToArray()).Trim().ToCharArray());
Microsoft.NET.HostModel (2)
MachO\BinaryFormat\Blobs\CodeDirectoryBlob.cs (2)
50byte[] bytes = data.AsSpan(specialSlotHashesOffset + i * hashSize, hashSize).ToArray(); 57codeHashes[codeSlotNumber] = data.AsSpan(hashesDataOffset + codeSlotNumber * hashSize, hashSize).ToArray();
Microsoft.NET.Sdk.BlazorWebAssembly.Tasks (1)
src\sdk\src\StaticWebAssetsSdk\Tasks\Utils\FileHasher.cs (1)
42var dividend = BigInteger.Abs(new BigInteger(hash.AsSpan()[..9].ToArray()));
Microsoft.NET.Sdk.StaticWebAssets.Tasks (1)
Utils\FileHasher.cs (1)
42var dividend = BigInteger.Abs(new BigInteger(hash.AsSpan()[..9].ToArray()));
Microsoft.Private.Windows.Core (1)
Windows\Win32\Graphics\Gdi\RGNDATAHEADER.cs (1)
16return new Span<RECT>((byte*)regionData + regionData->dwSize, (int)regionData->nCount).ToArray();
Microsoft.Win32.Registry (2)
Microsoft\Win32\RegistryKey.cs (2)
1084return span.Slice(0, dataLength).ToArray(); 1092_ => span.Slice(0, dataLength).ToArray(), // This shouldn't happen, but the previous implementation included it defensively.
PresentationCore (1)
System\Windows\Input\Stylus\Common\StylusPointCollection.cs (1)
177data = rawPacketData.AsSpan(rawArrayStartIndex, dataLength).ToArray();
SuperFileCheck (1)
Program.cs (1)
713var argsToCopy = args.AsSpan(1).ToArray();
System.Diagnostics.Process (5)
src\runtime\src\libraries\Common\src\Interop\Unix\System.Native\Interop.GetGroupList.cs (1)
31return groups.Slice(0, ngroups).ToArray();
System\Diagnostics\Process.Multiplexing.cs (4)
106byte[] outputResult = outputBuffer.AsSpan(0, outputBytesRead).ToArray(); 107byte[] errorResult = errorBuffer.AsSpan(0, errorBytesRead).ToArray(); 428return (standardOutput.AsSpan().ToArray(), standardError.AsSpan().ToArray());
System.DirectoryServices.Protocols (9)
System\DirectoryServices\Protocols\common\DirectoryControl.cs (9)
127_directoryControlValue = value.AsSpan().ToArray(); 140return _directoryControlValue.AsSpan().ToArray(); 628return _dirsyncCookie.AsSpan().ToArray(); 694return _dirsyncCookie.AsSpan().ToArray(); 743return _pageCookie.AsSpan().ToArray(); 788return _pageCookie.AsSpan().ToArray(); 1022return _target.AsSpan().ToArray(); 1036return _context.AsSpan().ToArray(); 1115return _context.AsSpan().ToArray();
System.Drawing.Common (1)
System\Drawing\Imaging\PropertyItem.cs (1)
47Value = new Span<byte>(native->value, (int)native->length).ToArray()
System.Formats.Asn1 (2)
System\Formats\Asn1\AsnDecoder.BitString.cs (1)
321byte[] ret = rented.AsSpan(0, written).ToArray();
System\Formats\Asn1\AsnWriter.cs (1)
209return _buffer.AsSpan(0, _offset).ToArray();
System.IO.Compression (3)
System\IO\Compression\WinZipAesKeyMaterial.cs (3)
83byte[] encryptionKey = derivedKey.Slice(0, keySizeBytes).ToArray(); 84byte[] hmacKey = derivedKey.Slice(keySizeBytes, keySizeBytes).ToArray(); 85byte[] passwordVerifier = derivedKey.Slice(keySizeBytes + keySizeBytes, 2).ToArray();
System.Net.Http (11)
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackEncoder.cs (3)
604return span.Slice(0, length).ToArray(); 616return span.Slice(0, length).ToArray(); 632return span.Slice(0, length).ToArray();
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackEncoder.cs (5)
44return buffer.Slice(0, bytesWritten).ToArray(); 99return temp.Slice(0, headerBytesWritten).ToArray(); 107return temp.Slice(0, bytesWritten).ToArray(); 169return temp.Slice(0, nameLength).ToArray(); 179return temp.Slice(0, bytesWritten).ToArray();
System\Net\Http\HttpContent.cs (1)
897return _lastBuffer.AsSpan(0, _totalLength).ToArray();
System\Net\Http\SocketsHttpHandler\Http3Connection.cs (1)
531return buffer.Slice(0, 4 + integerLength).ToArray();
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (1)
1538return WriteAsync(temp.Slice(0, bytesWritten).ToArray());
System.Net.Quic (1)
System\Net\Quic\QuicConnection.cs (1)
625_negotiatedApplicationProtocol = new SslApplicationProtocol(new Span<byte>(data.NegotiatedAlpn, data.NegotiatedAlpnLength).ToArray());
System.Net.Security (3)
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs (1)
99return algorithms.Slice(0, algorithmCount).ToArray();
System\Net\NegotiateAuthenticationPal.ManagedNtlm.cs (1)
614return targetInfoBuffer.AsSpan(0, targetInfoOffset).ToArray();
System\Net\Security\SslApplicationProtocol.cs (1)
38protocol.AsSpan().ToArray() :
System.Net.Sockets (4)
System\Net\Sockets\UDPClient.cs (4)
395return _buffer.AsSpan(0, received).ToArray(); 632byte[] buffer = _buffer.AsSpan(0, result.ReceivedBytes).ToArray(); 658byte[] buffer = _buffer.AsSpan(0, result.ReceivedBytes).ToArray(); 854return _buffer.AsSpan(0, received).ToArray();
System.Private.CoreLib (18)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Array.cs (1)
1576return values?.Length == foundCount ? values : span[..foundCount].ToArray();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Decoder.cs (2)
113byte[] result = destination.Slice(0, bytesWritten).ToArray(); 245byte[] result = destination.Slice(0, bytesWritten).ToArray();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Url\Base64UrlDecoder.cs (2)
173byte[] ret = destination.Slice(0, bytesWritten).ToArray(); 270byte[] ret = destination.Slice(0, bytesWritten).ToArray();
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\File.cs (2)
1277return rentedArray.AsSpan(0, bytesRead).ToArray(); 1543return buffer.Slice(0, bytesRead).ToArray();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Memory.cs (1)
440public T[] ToArray() => Span.ToArray();
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\BitVector256.cs (2)
63return chars.Slice(0, size).ToArray(); 78return bytes.Slice(0, size).ToArray();
src\runtime\src\libraries\System.Private.CoreLib\src\System\SpanDebugView.cs (1)
14_array = span.ToArray();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\DecoderNLS.cs (2)
266if (FallbackBuffer.Fallback(combinedBuffer.Slice(0, combinedBufferBytesConsumed).ToArray(), index: -_leftoverByteCount)) 334if (FallbackBuffer.Fallback(combinedBuffer.Slice(0, combinedBufferBytesConsumed).ToArray(), index: -_leftoverByteCount)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.Sealed.cs (1)
71return new Span<byte>(ref *pDestination, bytesWritten).ToArray(); // this overload of Span ctor doesn't validate length
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\AsyncLocal.cs (1)
407KeyValuePair<IAsyncLocal, object?>[] newValues = _keyValues.AsSpan().ToArray();
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (2)
228return offsets.ToArray(); 264return offsets.ToArray();
System\Reflection\EnumInfo.cs (1)
48return MemoryMarshal.Cast<TStorage, TResult>(Values).ToArray();
System.Private.DataContractSerialization (1)
System\Runtime\Serialization\MemoryStreamAdapter.cs (1)
66buffer = slicedBuffer.ToArray(); // trim leading and trailing data
System.Private.Windows.Core (12)
Windows\Win32\Graphics\Gdi\RGNDATAHEADER.cs (1)
16return new Span<RECT>((byte*)regionData + regionData->dwSize, (int)regionData->nCount).ToArray();
Windows\Win32\System\Variant\VARIANT.cs (11)
759return new Span<sbyte>(ca.pElems, (int)ca.cElems).ToArray(); 761return new Span<byte>(ca.pElems, (int)ca.cElems).ToArray(); 763return new Span<short>(ca.pElems, (int)ca.cElems).ToArray(); 765return new Span<ushort>(ca.pElems, (int)ca.cElems).ToArray(); 780return new Span<int>(ca.pElems, (int)ca.cElems).ToArray(); 784return new Span<uint>(ca.pElems, (int)ca.cElems).ToArray(); 786return new Span<long>(ca.pElems, (int)ca.cElems).ToArray(); 788return new Span<ulong>(ca.pElems, (int)ca.cElems).ToArray(); 790return new Span<float>(ca.pElems, (int)ca.cElems).ToArray(); 792return new Span<double>(ca.pElems, (int)ca.cElems).ToArray(); 830return new Span<Guid>(ca.pElems, (int)ca.cElems).ToArray();
System.Reflection.Metadata (1)
System\Reflection\Metadata\BlobWriter.cs (1)
92return _buffer.AsSpan(_start + start, byteCount).ToArray();
System.Runtime.Numerics (3)
System\Numerics\BigInteger.cs (3)
496_bits = val.AsSpan(0, len).ToArray(); 644_bits = trimLen == 1 ? [magnitude] : value[..trimLen].ToArray(); 682_bits = value.ToArray();
System.Security.Cryptography (14)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CompositeMLDsa.cs (1)
171return lease.Span.Slice(0, bytesWritten).ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.EncryptDecrypt.cs (1)
245byte[] ret = output.AsSpan(0, numBytesNeeded).ToArray();
System\Security\Cryptography\Aes.cs (1)
515return lease.Span.Slice(0, written).ToArray();
System\Security\Cryptography\DSA.cs (2)
231return signature.Slice(0, bytesWritten).ToArray(); 438return signature.Slice(0, bytesWritten).ToArray();
System\Security\Cryptography\ECDsa.cs (2)
162byte[] ret = signature.Slice(0, bytesWritten).ToArray(); 444byte[] ret = signature.Slice(0, bytesWritten).ToArray();
System\Security\Cryptography\Rfc2898DeriveBytes.cs (1)
144return _salt.AsSpan(0, _salt.Length - sizeof(uint)).ToArray();
System\Security\Cryptography\RSA.cs (1)
1420rentResult = rented.AsSpan(0, written).ToArray();
System\Security\Cryptography\SymmetricAlgorithm.cs (1)
784byte[] plaintext = decryptBuffer.Slice(0, written).ToArray();
System\Security\Cryptography\UniversalCryptoDecryptor.cs (1)
145return rented.AsSpan(0, written).ToArray();
System\Security\Cryptography\X509Certificates\CertificatePal.Windows.cs (1)
250return new Span<byte>(pCertContext->pbCertEncoded, pCertContext->cbCertEncoded).ToArray();
System\Security\Cryptography\X509Certificates\X509SubjectKeyIdentifierExtension.cs (2)
180byte[] shortSha1 = sha1.Slice(SHA1.HashSizeInBytes - 8).ToArray(); 212return hash.Slice(0, TruncateSize).ToArray();
System.Security.Cryptography.Cose (4)
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (4)
784byte[] encodedSignProtected = bufferSpan.Slice(0, bytesWritten).ToArray(); 794byte[] signature = bufferSpan.Slice(0, bytesWritten).ToArray(); 857byte[] encodedSignProtected = buffer.AsSpan(0, bytesWritten).ToArray(); 868byte[] signature = buffer.AsSpan(0, bytesWritten).ToArray();
System.Security.Cryptography.Pkcs (2)
Internal\Cryptography\Pal\AnyOS\ManagedPal.KeyTrans.cs (1)
209return new Span<byte>(cek, 0, cekLength).ToArray();
System\Security\Cryptography\Pkcs\SignedCms.cs (1)
262return rented.AsSpan(0, bytesWritten).ToArray();
System.Security.Cryptography.ProtectedData (1)
System\Security\Cryptography\ProtectedData.cs (1)
383outputData = interopSpan.ToArray();
System.Text.Json (6)
System\Text\Json\Document\JsonDocument.MetadataDb.cs (1)
180_data = _data.AsSpan(0, Length).ToArray();
System\Text\Json\JsonHelpers.Escaping.cs (1)
46byte[] escapedString = escapedValue.Slice(0, written).ToArray();
System\Text\Json\Reader\JsonReaderHelper.Unescaping.cs (3)
82byte[] propertyName = utf8Unescaped.Slice(0, written).ToArray(); 214bytes = utf8Unescaped.Slice(0, bytesWritten).ToArray(); 242bytes = byteSpan.Slice(0, bytesWritten).ToArray();
System\Text\Json\Reader\Utf8JsonReader.MultiSegment.cs (1)
630throw GetInvalidLiteralMultiSegment(readSoFar.Slice(0, written).ToArray());
System.Text.RegularExpressions (4)
System\Text\RegularExpressions\Regex.cs (1)
452result = capslist.AsSpan().ToArray();
System\Text\RegularExpressions\RegexFindOptimizations.cs (1)
134chars = scratch.Slice(0, scratchCount).ToArray();
System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (2)
569result.Chars = scratch.Slice(0, count).ToArray(); 1247return (firstChild, ('\0', null, StringComparison.Ordinal, chars.ToArray()));
System.Text.RegularExpressions.Generator (5)
RegexGenerator.Emitter.cs (2)
685helperName = $"IndexOfAny{(negatedCategory ? "Except" : "")}{string.Concat(categories.Slice(0, numCategories).ToArray().Select(c => c.ToString()))}"; 1898writer.WriteLine($"case {string.Join(" or ", setChars.Slice(0, numChars).ToArray().Select(Literal))}:");
src\runtime\src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexFindOptimizations.cs (1)
134chars = scratch.Slice(0, scratchCount).ToArray();
src\runtime\src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (2)
569result.Chars = scratch.Slice(0, count).ToArray(); 1247return (firstChild, ('\0', null, StringComparison.Ordinal, chars.ToArray()));
System.Web.HttpUtility (1)
System\Web\Util\HttpEncoder.cs (1)
238return decodedBytes.Slice(0, decodedBytesCount).ToArray();
System.Windows.Forms.Primitives (1)
Windows\Win32\System\Ole\CADWORD.cs (1)
16: new Span<uint>(pElems, (int)cElems).ToArray();
System.Xaml (1)
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Utility\FrugalList.cs (1)
1503public override T[] ToArray() => _entries.AsSpan(0, _count).ToArray();