91 references to Cast
GenerateDocumentationAndConfigFiles (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 145ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3));
ILAssembler (1)
GrammarVisitor.cs (1)
3102ReadOnlySpan<char> bytesAsChars = MemoryMarshal.Cast<byte, char>(bytes);
ILCompiler.Compiler (1)
Compiler\TypePreinit.cs (1)
3489return new string(MemoryMarshal.Cast<byte, char>(
Microsoft.AspNetCore.Razor.Utilities.Shared (2)
Utilities\Hashing\XxHashShared.cs (2)
126ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 144ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.CodeAnalysis (2)
Hashing\XxHashShared.cs (2)
127ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 145ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.CodeAnalysis.Analyzers (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 145ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.CodeAnalysis.AnalyzerUtilities (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 145ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.CodeAnalysis.CodeStyle (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 145ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.CodeAnalysis.CSharp (1)
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (1)
1156MemoryMarshal.Cast<char, short>(charSpan).CopyTo(shortSpan);
Microsoft.CodeAnalysis.ResxSourceGenerator (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 145ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.CodeAnalysis.Workspaces (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 145ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.Data.Analysis (4)
PrimitiveColumnContainer.cs (2)
494mapIndicesLongSpan = MemoryMarshal.Cast<U, long>(mapIndicesSpan); 498mapIndicesIntSpan = MemoryMarshal.Cast<U, int>(mapIndicesSpan);
PrimitiveDataFrameColumn.cs (1)
150ReadOnlySpan<DateTime> valueSpan = MemoryMarshal.Cast<T, DateTime>(valueBuffer.ReadOnlySpan);
ReadOnlyDataFrameBuffer.cs (1)
44get => (MemoryMarshal.Cast<byte, T>(ReadOnlyBuffer.Span)).Slice(0, Length);
Microsoft.ML.Vision (2)
ImageClassificationTrainer.cs (2)
878var labelsSpan = MemoryMarshal.Cast<long, byte>(labels); 890var featureSpan = MemoryMarshal.Cast<float, byte>(row.Item2);
Microsoft.Private.Windows.Core (3)
System\SpanReader.cs (2)
157/// This effectively does a <see cref="MemoryMarshal.Cast{TFrom, TTo}(ReadOnlySpan{TFrom})"/> and the same 180value = MemoryMarshal.Cast<T, TValue>(current);
Windows\Win32\Graphics\Gdi\ARGB.cs (1)
57ToColorArray(MemoryMarshal.Cast<uint, ARGB>(argbColors));
Roslyn.Diagnostics.Analyzers (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 145ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3));
System.Diagnostics.PerformanceCounter (1)
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.PERF_INFO.cs (1)
111: MemoryMarshal.Cast<byte, char>(data.Slice(instance.NameOffset, instance.NameLength - sizeof(char))); // NameLength includes the null-terminator
System.Formats.Asn1 (4)
System\Formats\Asn1\AsnCharacterStringEncodings.net.cs (4)
48ReadOnlySpan<ushort> source = MemoryMarshal.Cast<char, ushort>(chars).Slice(0, available); 289ReadOnlySpan<ushort> source = MemoryMarshal.Cast<char, ushort>(chars).Slice(0, available); 491ReadOnlySpan<ushort> source = MemoryMarshal.Cast<char, ushort>(chars).Slice(0, available); 527ReadOnlySpan<ushort> source = MemoryMarshal.Cast<byte, ushort>(bytes).Slice(0, available);
System.IO.Hashing (2)
System\IO\Hashing\XxHashShared.cs (2)
123ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret); 141ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.Cast<byte, ulong>(DefaultSecret.Slice(3));
System.Net.Primitives (7)
src\runtime\src\libraries\Common\src\System\Net\NetworkInformation\InterfaceInfoPal.Unix.cs (3)
37ReadOnlySpan<char> castInterfaceName = MemoryMarshal.Cast<TChar, char>(interfaceName); 52ReadOnlySpan<byte> castInterfaceName = MemoryMarshal.Cast<TChar, byte>(interfaceName); 58ReadOnlySpan<char> castInterfaceName = MemoryMarshal.Cast<TChar, char>(interfaceName);
System\Net\IPAddressParser.cs (2)
102ReadOnlySpan<byte> castScopeIdSpan = MemoryMarshal.Cast<TChar, byte>(scopeIdSpan); 108ReadOnlySpan<char> castScopeIdSpan = MemoryMarshal.Cast<TChar, char>(scopeIdSpan);
System\Net\IPEndPoint.cs (2)
137isConvertedToInt = uint.TryParse(MemoryMarshal.Cast<TChar, byte>(portSpan), NumberStyles.None, CultureInfo.InvariantCulture, out port); 141isConvertedToInt = uint.TryParse(MemoryMarshal.Cast<TChar, char>(portSpan), NumberStyles.None, CultureInfo.InvariantCulture, out port);
System.Private.CoreLib (18)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (6)
202ReverseEndianness<short, Int16EndiannessReverser>(MemoryMarshal.Cast<ushort, short>(source), MemoryMarshal.Cast<ushort, short>(destination)); 211ReverseEndianness<int, Int32EndiannessReverser>(MemoryMarshal.Cast<uint, int>(source), MemoryMarshal.Cast<uint, int>(destination)); 220ReverseEndianness<long, Int64EndiannessReverser>(MemoryMarshal.Cast<ulong, long>(source), MemoryMarshal.Cast<ulong, long>(destination)); 230ReverseEndianness<long, Int64EndiannessReverser>(MemoryMarshal.Cast<nuint, long>(source), MemoryMarshal.Cast<nuint, long>(destination)); 238ReverseEndianness<long, Int64EndiannessReverser>(MemoryMarshal.Cast<nint, long>(source), MemoryMarshal.Cast<nint, long>(destination)); 376ReverseEndianness(MemoryMarshal.Cast<UInt128, Int128>(source), MemoryMarshal.Cast<UInt128, Int128>(destination));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Decoder.cs (1)
175DecodeFrom(default(Base64DecoderChar), MemoryMarshal.Cast<char, ushort>(source), destination,
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Url\Base64UrlDecoder.cs (1)
202DecodeFrom(default(Base64UrlDecoderChar), MemoryMarshal.Cast<char, ushort>(source), destination,
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipePayloadDecoder.cs (3)
121charPayload = MemoryMarshal.Cast<byte, char>(payload); 126charPayload = MemoryMarshal.Cast<byte, char>(payload.Slice(0, byteCount - 2)); 129decodedFields[i] = BitConverter.IsLittleEndian ? new string(charPayload) : Encoding.Unicode.GetString(MemoryMarshal.Cast<char, byte>(charPayload));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128Exp.cs (1)
38return MemoryMarshal.Cast<ulong, DiyFp128FixedCoefficient>(coefficients);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\SearchValues.cs (1)
86ReadOnlySpan<short> shortValues = MemoryMarshal.Cast<char, short>(values);
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (1)
2124ReadOnlySpan<ushort> sourceSpanUInt16 = MemoryMarshal.Cast<char, ushort>(sourceSpan);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Ascii.CaseConversion.cs (4)
42=> ChangeCase<ushort, ushort, ToUpperConversion>(MemoryMarshal.Cast<char, ushort>(source), MemoryMarshal.Cast<char, ushort>(destination), out charsWritten); 66=> ChangeCase<ushort, byte, ToUpperConversion>(MemoryMarshal.Cast<char, ushort>(source), destination, out bytesWritten); 92=> ChangeCase<ushort, ushort, ToLowerConversion>(MemoryMarshal.Cast<char, ushort>(source), MemoryMarshal.Cast<char, ushort>(destination), out charsWritten); 116=> ChangeCase<ushort, byte, ToLowerConversion>(MemoryMarshal.Cast<char, ushort>(source), destination, out bytesWritten);
System.Private.Windows.Core (4)
System\IO\BinaryReaderExtensions.cs (2)
262writer.Write(MemoryMarshal.Cast<T, char>(span)); 268writer.Write(MemoryMarshal.Cast<T, byte>(span));
System\SpanReader.cs (1)
157/// This effectively does a <see cref="MemoryMarshal.Cast{TFrom, TTo}(ReadOnlySpan{TFrom})"/> and the same
Windows\Win32\Graphics\Gdi\ARGB.cs (1)
57ToColorArray(MemoryMarshal.Cast<uint, ARGB>(argbColors));
System.Runtime.Numerics (21)
System\Number.BigInteger.cs (4)
29? MemoryMarshal.Cast<ulong, nuint>(UInt64PowersOfTen) 30: MemoryMarshal.Cast<uint, nuint>(UInt32PowersOfTenCore); 1280? MemoryMarshal.Cast<ulong, nuint>(LeadingPowers1E9_64) 1281: MemoryMarshal.Cast<uint, nuint>(LeadingPowers1E9_32);
System\Numerics\BigInteger.cs (7)
831return Number.ParseBigInteger(MemoryMarshal.Cast<char, Utf16Char>(value), style, NumberFormatInfo.GetInstance(provider)); 836return Number.ParseBigInteger(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, NumberFormatInfo.GetInstance(provider)); 846return Number.TryParseBigInteger(MemoryMarshal.Cast<char, Utf16Char>(value), style, NumberFormatInfo.GetInstance(provider), out result, out _) == Number.ParsingStatus.OK; 856return Number.TryParseBigInteger(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, NumberFormatInfo.GetInstance(provider), out result, out _) == Number.ParsingStatus.OK; 862return Number.TryParseBigIntegerPartial(MemoryMarshal.Cast<char, Utf16Char>(s.AsSpan()), style, NumberFormatInfo.GetInstance(provider), out result, out charsConsumed) == Number.ParsingStatus.OK; 868return Number.TryParseBigIntegerPartial(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, NumberFormatInfo.GetInstance(provider), out result, out bytesConsumed) == Number.ParsingStatus.OK; 874return Number.TryParseBigIntegerPartial(MemoryMarshal.Cast<char, Utf16Char>(s), style, NumberFormatInfo.GetInstance(provider), out result, out charsConsumed) == Number.ParsingStatus.OK;
System\Numerics\Complex.cs (5)
807return Complex<double>.TryParse(MemoryMarshal.Cast<char, Utf16Char>(s), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out _); 814return Complex<double>.TryParse(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out _); 821return Complex<double>.TryParsePartial(MemoryMarshal.Cast<char, Utf16Char>(s.AsSpan()), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out charsConsumed); 828return Complex<double>.TryParsePartial(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out bytesConsumed); 835return Complex<double>.TryParsePartial(MemoryMarshal.Cast<char, Utf16Char>(s), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out charsConsumed);
System\Numerics\Complex.Generic.cs (5)
1892=> TryParse(MemoryMarshal.Cast<char, Utf16Char>(s), style, provider, out result, out _); 1896=> TryParse(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, provider, out result, out _); 1900=> TryParsePartial(MemoryMarshal.Cast<char, Utf16Char>(s.AsSpan()), style, provider, out result, out charsConsumed); 1904=> TryParsePartial(MemoryMarshal.Cast<byte, Utf8Char>(utf8Text), style, provider, out result, out bytesConsumed); 1908=> TryParsePartial(MemoryMarshal.Cast<char, Utf16Char>(s), style, provider, out result, out charsConsumed);
System.Security.Cryptography (3)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\ECCng.ImportExport.NamedCurve.cs (1)
94KeyBlobMagicNumber magic = (KeyBlobMagicNumber)MemoryMarshal.Cast<byte, int>(ecBlob)[0];
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PqcBlobHelpers.cs (2)
246ref readonly BCRYPT_PQDSA_KEY_BLOB blob = ref MemoryMarshal.Cast<byte, BCRYPT_PQDSA_KEY_BLOB>(blobBytes)[0]; 252parameterSet = MemoryMarshal.Cast<byte, char>(blobBytes.Slice(index, parameterSetLength));
System.Text.Json (1)
System\Text\Json\Writer\Utf8JsonWriter.cs (1)
162return MemoryMarshal.Cast<byte, char>(partialStringDataBytes.Slice(0, length));