154 references to Span
InMemory.FunctionalTests (3)
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (3)
73return new Span<T>(AllocAsPointer<T>(count), count); 128return new Span<byte>(Alloc(sizeHint), sizeHint); 138return new Span<byte>(_currentBlock, _currentBlockCount);
Microsoft.AspNetCore.Components.Server (1)
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\SequenceReaderExtensions.cs (1)
76Span<byte> tempSpan = new Span<byte>(&buffer, sizeof(T));
Microsoft.AspNetCore.DataProtection (1)
KeyManagement\KeyRingBasedDataProtector.cs (1)
295var span = new Span<byte>(ptr, sizeof(Guid));
Microsoft.AspNetCore.Http.Connections.Common (1)
src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
118_encoder.Convert(new Span<char>(&value, 1), destination, false, out charsUsed, out bytesUsed, out _);
Microsoft.AspNetCore.OpenApi (1)
src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
118_encoder.Convert(new Span<char>(&value, 1), destination, false, out charsUsed, out bytesUsed, out _);
Microsoft.AspNetCore.Server.HttpSys (7)
RequestProcessing\Response.cs (3)
534unknownHeaders = new Span<HTTP_UNKNOWN_HEADER>(unknownAlloc, numUnknownHeaders); 565knownHeaderInfo = new Span<HTTP_RESPONSE_INFO>(responseAlloc, numKnownMultiHeaders); 579var nativeHeaderValues = new Span<HTTP_KNOWN_HEADER>(headerAlloc, headerValues.Count);
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (3)
73return new Span<T>(AllocAsPointer<T>(count), count); 128return new Span<byte>(Alloc(sizeHint), sizeHint); 138return new Span<byte>(_currentBlock, _currentBlockCount);
src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (1)
833return new Span<T>(_pointer, _length);
Microsoft.AspNetCore.Server.IIS (5)
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (3)
73return new Span<T>(AllocAsPointer<T>(count), count); 128return new Span<byte>(Alloc(sizeHint), sizeHint); 138return new Span<byte>(_currentBlock, _currentBlockCount);
src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (2)
278return new Span<byte>(NativeRequest->pRawUrl, NativeRequest->RawUrlLength); 833return new Span<T>(_pointer, _length);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (3)
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (3)
73return new Span<T>(AllocAsPointer<T>(count), count); 128return new Span<byte>(Alloc(sizeHint), sizeHint); 138return new Span<byte>(_currentBlock, _currentBlockCount);
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (3)
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (3)
73return new Span<T>(AllocAsPointer<T>(count), count); 128return new Span<byte>(Alloc(sizeHint), sizeHint); 138return new Span<byte>(_currentBlock, _currentBlockCount);
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (3)
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (3)
73return new Span<T>(AllocAsPointer<T>(count), count); 128return new Span<byte>(Alloc(sizeHint), sizeHint); 138return new Span<byte>(_currentBlock, _currentBlockCount);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (3)
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (3)
73return new Span<T>(AllocAsPointer<T>(count), count); 128return new Span<byte>(Alloc(sizeHint), sizeHint); 138return new Span<byte>(_currentBlock, _currentBlockCount);
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (3)
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (3)
73return new Span<T>(AllocAsPointer<T>(count), count); 128return new Span<byte>(Alloc(sizeHint), sizeHint); 138return new Span<byte>(_currentBlock, _currentBlockCount);
Microsoft.AspNetCore.Shared.Tests (2)
src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (2)
278return new Span<byte>(NativeRequest->pRawUrl, NativeRequest->RawUrlLength); 833return new Span<T>(_pointer, _length);
Microsoft.AspNetCore.SignalR.Common (1)
src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
118_encoder.Convert(new Span<char>(&value, 1), destination, false, out charsUsed, out bytesUsed, out _);
Microsoft.AspNetCore.SignalR.Protocols.Json (1)
src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
118_encoder.Convert(new Span<char>(&value, 1), destination, false, out charsUsed, out bytesUsed, out _);
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
118_encoder.Convert(new Span<char>(&value, 1), destination, false, out charsUsed, out bytesUsed, out _);
PresentationCore (1)
System\Windows\Media\StreamAsIStream.cs (1)
602var span = new Span<byte>(buffer.ToPointer(), (int) cb);
System.Diagnostics.DiagnosticSource (1)
System\Diagnostics\Activity.cs (1)
1985ActivityTraceId.SetToRandomBytes(new Span<byte>(&id, sizeof(ulong)));
System.Diagnostics.Process (1)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.ForkAndExecProcess.cs (1)
70int bytesWritten = Encoding.UTF8.GetBytes(str, new Span<byte>(arrPtr[i], byteLength));
System.Formats.Asn1 (2)
System\Formats\Asn1\AsnCharacterStringEncodings.cs (2)
123new Span<byte>(bytes, byteCount), 158new Span<char>(chars, charCount),
System.Formats.Cbor (1)
src\libraries\Common\src\System\Memory\PointerMemoryManager.cs (1)
23return new Span<T>(_pointer, _length);
System.IO.Hashing (9)
System\IO\Hashing\XxHashShared.cs (9)
117Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 168DefaultSecret.CopyTo(new Span<byte>(secret, SecretLengthBytes)); 251source.CopyTo(new Span<byte>(buffer + state.BufferedCount, source.Length)); 266source.Slice(0, loadSize).CopyTo(new Span<byte>(buffer + state.BufferedCount, loadSize)); 305source.Slice(sourceIndex - StripeLengthBytes, StripeLengthBytes).CopyTo(new Span<byte>(buffer + InternalBufferLengthBytes - StripeLengthBytes, StripeLengthBytes)); 318source.Slice(sourceIndex - StripeLengthBytes, StripeLengthBytes).CopyTo(new Span<byte>(buffer + InternalBufferLengthBytes - StripeLengthBytes, StripeLengthBytes)); 322Span<byte> remaining = new Span<byte>(buffer, source.Length - sourceIndex); 381new ReadOnlySpan<byte>(buffer + InternalBufferLengthBytes - catchupSize, catchupSize).CopyTo(new Span<byte>(lastStripe, StripeLengthBytes)); 382new ReadOnlySpan<byte>(buffer, (int)state.BufferedCount).CopyTo(new Span<byte>(lastStripe + catchupSize, (int)state.BufferedCount));
System.IO.Pipes (1)
System\IO\Pipes\PipeStream.cs (1)
116return Read(new Span<byte>(&b, 1)) > 0 ? b : -1;
System.Memory (1)
System\Buffers\SequenceReaderExtensions.Binary.cs (1)
43Span<byte> tempSpan = new Span<byte>(&buffer, sizeof(T));
System.Net.NameResolution (2)
src\libraries\Common\src\System\Net\InteropIPAddressExtensions.Unix.cs (1)
15ipAddress.TryWriteBytes(new Span<byte>(nativeIPAddress.Address, Interop.Sys.IPv6AddressBytes), out int bytesWritten);
System\Net\NameResolutionPal.Unix.cs (1)
165addr.TryWriteBytes(new Span<byte>(rawAddress, rawAddressLength), out int bytesWritten);
System.Net.Ping (1)
System\Net\NetworkInformation\Ping.RawSocket.cs (1)
446new Span<byte>(&ipHeader, sizeof(IpHeader)).CopyTo(result);
System.Net.Quic (8)
System\Net\Quic\Internal\MsQuicHelpers.cs (1)
41Span<byte> addressBytes = new Span<byte>(quicAddress, SocketAddressPal.IPv6AddressSize);
System\Net\Quic\Internal\MsQuicTlsSecret.cs (5)
59? new Span<byte>(_tlsSecrets->ClientHandshakeTrafficSecret, _tlsSecrets->SecretLength) 63? new Span<byte>(_tlsSecrets->ServerHandshakeTrafficSecret, _tlsSecrets->SecretLength) 67? new Span<byte>(_tlsSecrets->ClientTrafficSecret0, _tlsSecrets->SecretLength) 71? new Span<byte>(_tlsSecrets->ServerTrafficSecret0, _tlsSecrets->SecretLength) 75? new Span<byte>(_tlsSecrets->ClientEarlyTrafficSecret, _tlsSecrets->SecretLength)
System\Net\Quic\Interop\msquic.cs (1)
23public readonly Span<byte> Span => new(Buffer, (int)Length);
System\Net\Quic\QuicConnection.cs (1)
526_negotiatedApplicationProtocol = new SslApplicationProtocol(new Span<byte>(data.NegotiatedAlpn, data.NegotiatedAlpnLength).ToArray());
System.Net.Security (4)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (1)
668var clientList = new Span<byte>(inp, (int)inlen);
System\Net\NegotiateAuthenticationPal.ManagedNtlm.cs (1)
446md5.AppendData(new Span<byte>((void*)cbtData, cbtDataSize));
System\Net\Security\Pal.Managed\SafeChannelBindingHandle.cs (1)
41cbtPrefix.CopyTo(new Span<byte>((byte*)cbtPrefixPtr, cbtPrefix.Length));
System\Net\Security\SslStream.cs (1)
976return new Span<byte>(_pointer, _length);
System.Net.Sockets (6)
src\libraries\Common\src\System\Net\InteropIPAddressExtensions.Unix.cs (1)
15ipAddress.TryWriteBytes(new Span<byte>(nativeIPAddress.Address, Interop.Sys.IPv6AddressBytes), out int bytesWritten);
System\Net\Sockets\NetworkStream.cs (1)
264return Read(new Span<byte>(&b, 1)) == 0 ? -1 : b;
System\Net\Sockets\SocketAsyncContext.Unix.cs (2)
547bool completed = SocketPal.TryCompleteReceiveFrom(context._socket, new Span<byte>(BufferPtr, Length), null, Flags, SocketAddress.Span, out int socketAddressLen, out BytesTransferred, out ReceivedFlags, out ErrorCode); 604bool completed = SocketPal.TryCompleteReceiveMessageFrom(context._socket, new Span<byte>(BufferPtr, Length), null, Flags, SocketAddress!, out int socketAddressLen, IsIPv4, IsIPv6, out BytesTransferred, out ReceivedFlags, out IPPacketInformation, out ErrorCode);
System\Net\Sockets\SocketPal.Unix.cs (2)
761received = SysReceive(socket, flags | SocketFlags.Peek, new Span<byte>(&oneBytePeekBuffer, 1), out errno); 829received = SysReceive(socket, flags | SocketFlags.Peek, new Span<byte>(&oneBytePeekBuffer, 1), socketAddress, out receivedSocketAddressLength, out receivedFlags, out errno);
System.Net.WebSockets (1)
System\Net\WebSockets\Compression\WebSocketInflater.cs (1)
218if (Inflate(stream, new Span<byte>(&b, 1), FlushCode.SyncFlush) == 0)
System.Private.CoreLib (62)
src\libraries\Common\src\Interop\Windows\Kernel32\Interop.FormatMessage.cs (1)
64return GetAndTrimString(new Span<char>((char*)nativeMsgPtr, length));
src\libraries\Common\src\System\Number.NumberBuffer.cs (2)
34public readonly Span<byte> Digits => new Span<byte>(DigitsPtr, DigitsLength); 36public NumberBuffer(NumberBufferKind kind, byte* digits, int digitsLength) : this(kind, new Span<byte>(digits, digitsLength))
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipe.cs (1)
120Span<EventPipeProviderConfigurationNative> providersNative = new Span<EventPipeProviderConfigurationNative>((void*)Marshal.AllocCoTaskMem(sizeof(EventPipeProviderConfigurationNative) * providers.Length), providers.Length);
src\libraries\System.Private.CoreLib\src\System\Globalization\TextInfo.cs (1)
382s.AsSpan(0, i).CopyTo(new Span<char>(pResult, result.Length));
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (14)
325var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize)); 353var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize)); 919var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize)); 978var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize)); 1033var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize)); 1090var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize)); 1149var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize)); 1210var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize)); 1265var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize)); 1322var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize)); 1383var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize)); 1444var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize)); 1501var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize)); 1558var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize));
src\libraries\System.Private.CoreLib\src\System\Reflection\MethodBaseInvoker.cs (2)
211shouldCopyBack = new Span<bool>(pArgStorage + _argCount, _argCount); 248shouldCopyBack = new Span<bool>(pStorage + _argCount * 2, _argCount);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.cs (7)
233new Span<T>(source, startIndex, length).CopyTo(new Span<T>((void*)destination, length)); 286new Span<T>((void*)source, length).CopyTo(new Span<T>(destination, startIndex, length)); 959s.CopyTo(new Span<char>((char*)ptr, s.Length)); 977int nbWritten = Encoding.UTF8.GetBytes(s, new Span<byte>(pbMem, nb)); 1000s.CopyTo(new Span<char>((char*)ptr, s.Length)); 1018int nbWritten = Encoding.UTF8.GetBytes(s, new Span<byte>(pbMem, nb)); 1230s.CopyTo(new Span<char>((char*)bstr, s.Length)); // AllocBSTR already included the null terminator
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.Unix.cs (1)
39int convertedBytes = Encoding.UTF8.GetBytes(s, new Span<byte>(buffer, bufferLength));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\AnsiStringMarshaller.cs (2)
28Span<byte> buffer = new(mem, exactByteCount); 85buffer = new Span<byte>((byte*)NativeMemory.Alloc((nuint)exactByteCount), exactByteCount);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ArrayMarshaller.cs (2)
61=> new Span<TUnmanagedElement>(unmanaged, numElements); 150_span = new Span<TUnmanagedElement>(_allocatedMemory, array.Length);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\BStrStringMarshaller.cs (1)
99managed.CopyTo(new Span<char>(ptrToFirstChar, managed.Length));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ComVariant.cs (1)
84public Span<T> AsSpan() => new(_data, _numElements);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\PointerArrayMarshaller.cs (2)
62=> new Span<TUnmanagedElement>(unmanaged, numElements); 151_span = new Span<TUnmanagedElement>(_allocatedMemory, array.Length);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ReadOnlySpanMarshaller.cs (1)
71=> new Span<TUnmanagedElement>(unmanaged, numElements);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\SpanMarshaller.cs (2)
66=> new Span<TUnmanagedElement>(unmanaged, numElements); 149_span = new Span<TUnmanagedElement>(_allocatedMemory, managed.Length);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\Utf8StringMarshaller.cs (2)
29Span<byte> buffer = new(mem, exactByteCount); 89buffer = new Span<byte>((byte*)NativeMemory.Alloc((nuint)exactByteCount), exactByteCount);
src\libraries\System.Private.CoreLib\src\System\Security\SecureString.cs (7)
290return new Span<char>((byte*)buffer.DangerousGetHandle(), (int)(buffer.ByteLength / 2)); 323span.Slice(0, length).CopyTo(new Span<char>((void*)ptr, length)); 334new Span<char>((void*)ptr, length).Clear(); 379Span<char> resultSpan = new Span<char>((void*)ptr, byteLength / sizeof(char)); 385Marshal.GetAnsiStringBytes(span, new Span<byte>((void*)ptr, byteLength)); 397new Span<byte>((void*)ptr, byteLength).Clear(); 464new Span<byte>((void*)handle, _byteLength).Clear();
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.cs (2)
722new ReadOnlySpan<byte>(arrByte, 0, byteCount).CopyTo(new Span<byte>(bytes, byteCount)); 871new ReadOnlySpan<char>(arrChar, 0, charCount).CopyTo(new Span<char>(chars, charCount));
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.Internal.cs (4)
500bytes: new Span<byte>(pOriginalBytes, originalByteCount).Slice(bytesWrittenSoFar), 532Span<byte> bytes = new Span<byte>(pOriginalBytes, originalByteCount).Slice(bytesWrittenSoFar); 1096chars: new Span<char>(pOriginalChars, originalCharCount).Slice(charsWrittenSoFar), 1134Span<char> chars = new Span<char>(pOriginalChars, originalCharCount).Slice(charsWrittenSoFar);
src\System\Reflection\Emit\DynamicILGenerator.cs (3)
909m_code = new Span<byte>(code, codeSize).ToArray(); 926m_exceptions = new Span<byte>(exceptions, exceptionsSize).ToArray(); 941m_localSignature = new Span<byte>(localSignature, signatureSize).ToArray();
src\System\RuntimeType.CoreCLR.cs (1)
654new Span<bool>(overrides, numVirtuals).Clear();
src\System\StubHelpers.cs (1)
444Span<char> native = new Span<char>((char*)nativeHome, length);
src\System\Text\StringBuilder.CoreCLR.cs (2)
36new Span<char>(newBuffer, newLength).CopyTo(m_ChunkChars); 107CopyTo(0, new Span<char>((char*)dest, charLen), charLen);
System.Reflection.Metadata (3)
System\Reflection\Internal\Utilities\ReadOnlyUnmanagedMemoryStream.cs (1)
45new Span<byte>(_data + _position, bytesRead).CopyTo(buffer);
System\Reflection\Internal\Utilities\StreamExtensions.netcoreapp.cs (1)
11=> stream.Read(new Span<byte>(buffer, size));
System\Reflection\PortableExecutable\PEReader.EmbeddedPortablePdb.cs (1)
103actualLength = deflate.TryReadAll(new Span<byte>(decompressed.Pointer, decompressed.Size));
System.Runtime.Numerics (2)
src\libraries\Common\src\System\Number.NumberBuffer.cs (2)
34public readonly Span<byte> Digits => new Span<byte>(DigitsPtr, DigitsLength); 36public NumberBuffer(NumberBufferKind kind, byte* digits, int digitsLength) : this(kind, new Span<byte>(digits, digitsLength))
System.Security.Cryptography (5)
Microsoft\Win32\SafeHandles\SafePasswordHandle.cs (1)
52Span<char> dest = new Span<char>((void*)handle, spanLen);
src\libraries\Common\src\System\Memory\PointerMemoryManager.cs (1)
23return new Span<T>(_pointer, _length);
System\Security\Cryptography\FixedMemoryKeyBox.cs (2)
15key.CopyTo(new Span<byte>(memory, key.Length)); 24CryptographicOperations.ZeroMemory(new Span<byte>((void*)handle, _length));
System\Security\Cryptography\X509Certificates\UnixPkcs12Reader.cs (1)
50Span<byte> tmpSpan = new Span<byte>((byte*)tmpPtr, encodedData.Length);
System.Security.Cryptography.Cose (1)
src\libraries\Common\src\System\Memory\PointerMemoryManager.cs (1)
23return new Span<T>(_pointer, _length);
System.Text.Encoding.CodePages (1)
System\Text\BaseCodePageEncoding.netcoreapp.cs (1)
53Span<byte> pCodePageIndex = new Span<byte>(&codePageIndex, sizeof(CodePageIndex));
System.Text.Encodings.Web (2)
System\Text\Encodings\Web\AllowedBmpCodePointsBitmap.cs (1)
69Span<uint> thisAllowedCharactersBitmap = new Span<uint>(pBitmap, BitmapLengthInDWords);
System\Text\Encodings\Web\OptimizedInboxTextEncoder.cs (1)
86Span<char> destination = new Span<char>(buffer, bufferLength);