91 references to Cast
GenerateDocumentationAndConfigFiles (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127
ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret);
145
ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret.Slice(3));
ILAssembler (1)
GrammarVisitor.cs (1)
3102
ReadOnlySpan<char> bytesAsChars = MemoryMarshal.
Cast
<byte, char>(bytes);
ILCompiler.Compiler (1)
Compiler\TypePreinit.cs (1)
3489
return new string(MemoryMarshal.
Cast
<byte, char>(
Microsoft.AspNetCore.Razor.Utilities.Shared (2)
Utilities\Hashing\XxHashShared.cs (2)
126
ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret);
144
ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.CodeAnalysis (2)
Hashing\XxHashShared.cs (2)
127
ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret);
145
ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.CodeAnalysis.Analyzers (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127
ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret);
145
ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.CodeAnalysis.AnalyzerUtilities (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127
ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret);
145
ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.CodeAnalysis.CodeStyle (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127
ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret);
145
ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.CodeAnalysis.CSharp (1)
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (1)
1156
MemoryMarshal.
Cast
<char, short>(charSpan).CopyTo(shortSpan);
Microsoft.CodeAnalysis.ResxSourceGenerator (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127
ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret);
145
ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.CodeAnalysis.Workspaces (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127
ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret);
145
ReadOnlySpan<ulong> defaultSecret3UInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret.Slice(3));
Microsoft.Data.Analysis (4)
PrimitiveColumnContainer.cs (2)
494
mapIndicesLongSpan = MemoryMarshal.
Cast
<U, long>(mapIndicesSpan);
498
mapIndicesIntSpan = MemoryMarshal.
Cast
<U, int>(mapIndicesSpan);
PrimitiveDataFrameColumn.cs (1)
150
ReadOnlySpan<DateTime> valueSpan = MemoryMarshal.
Cast
<T, DateTime>(valueBuffer.ReadOnlySpan);
ReadOnlyDataFrameBuffer.cs (1)
44
get => (MemoryMarshal.
Cast
<byte, T>(ReadOnlyBuffer.Span)).Slice(0, Length);
Microsoft.ML.Vision (2)
ImageClassificationTrainer.cs (2)
878
var labelsSpan = MemoryMarshal.
Cast
<long, byte>(labels);
890
var 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
180
value = MemoryMarshal.
Cast
<T, TValue>(current);
Windows\Win32\Graphics\Gdi\ARGB.cs (1)
57
ToColorArray(MemoryMarshal.
Cast
<uint, ARGB>(argbColors));
Roslyn.Diagnostics.Analyzers (2)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (2)
127
ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret);
145
ReadOnlySpan<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)
48
ReadOnlySpan<ushort> source = MemoryMarshal.
Cast
<char, ushort>(chars).Slice(0, available);
289
ReadOnlySpan<ushort> source = MemoryMarshal.
Cast
<char, ushort>(chars).Slice(0, available);
491
ReadOnlySpan<ushort> source = MemoryMarshal.
Cast
<char, ushort>(chars).Slice(0, available);
527
ReadOnlySpan<ushort> source = MemoryMarshal.
Cast
<byte, ushort>(bytes).Slice(0, available);
System.IO.Hashing (2)
System\IO\Hashing\XxHashShared.cs (2)
123
ReadOnlySpan<ulong> defaultSecretUInt64 = MemoryMarshal.
Cast
<byte, ulong>(DefaultSecret);
141
ReadOnlySpan<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)
37
ReadOnlySpan<char> castInterfaceName = MemoryMarshal.
Cast
<TChar, char>(interfaceName);
52
ReadOnlySpan<byte> castInterfaceName = MemoryMarshal.
Cast
<TChar, byte>(interfaceName);
58
ReadOnlySpan<char> castInterfaceName = MemoryMarshal.
Cast
<TChar, char>(interfaceName);
System\Net\IPAddressParser.cs (2)
102
ReadOnlySpan<byte> castScopeIdSpan = MemoryMarshal.
Cast
<TChar, byte>(scopeIdSpan);
108
ReadOnlySpan<char> castScopeIdSpan = MemoryMarshal.
Cast
<TChar, char>(scopeIdSpan);
System\Net\IPEndPoint.cs (2)
137
isConvertedToInt = uint.TryParse(MemoryMarshal.
Cast
<TChar, byte>(portSpan), NumberStyles.None, CultureInfo.InvariantCulture, out port);
141
isConvertedToInt = 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)
202
ReverseEndianness<short, Int16EndiannessReverser>(MemoryMarshal.
Cast
<ushort, short>(source), MemoryMarshal.Cast<ushort, short>(destination));
211
ReverseEndianness<int, Int32EndiannessReverser>(MemoryMarshal.
Cast
<uint, int>(source), MemoryMarshal.Cast<uint, int>(destination));
220
ReverseEndianness<long, Int64EndiannessReverser>(MemoryMarshal.
Cast
<ulong, long>(source), MemoryMarshal.Cast<ulong, long>(destination));
230
ReverseEndianness<long, Int64EndiannessReverser>(MemoryMarshal.
Cast
<nuint, long>(source), MemoryMarshal.Cast<nuint, long>(destination));
238
ReverseEndianness<long, Int64EndiannessReverser>(MemoryMarshal.
Cast
<nint, long>(source), MemoryMarshal.Cast<nint, long>(destination));
376
ReverseEndianness(MemoryMarshal.
Cast
<UInt128, Int128>(source), MemoryMarshal.Cast<UInt128, Int128>(destination));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Decoder.cs (1)
175
DecodeFrom(default(Base64DecoderChar), MemoryMarshal.
Cast
<char, ushort>(source), destination,
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Url\Base64UrlDecoder.cs (1)
202
DecodeFrom(default(Base64UrlDecoderChar), MemoryMarshal.
Cast
<char, ushort>(source), destination,
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipePayloadDecoder.cs (3)
121
charPayload = MemoryMarshal.
Cast
<byte, char>(payload);
126
charPayload = MemoryMarshal.
Cast
<byte, char>(payload.Slice(0, byteCount - 2));
129
decodedFields[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)
38
return MemoryMarshal.
Cast
<ulong, DiyFp128FixedCoefficient>(coefficients);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\SearchValues.cs (1)
86
ReadOnlySpan<short> shortValues = MemoryMarshal.
Cast
<char, short>(values);
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (1)
2124
ReadOnlySpan<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)
262
writer.Write(MemoryMarshal.
Cast
<T, char>(span));
268
writer.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)
57
ToColorArray(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)
831
return Number.ParseBigInteger(MemoryMarshal.
Cast
<char, Utf16Char>(value), style, NumberFormatInfo.GetInstance(provider));
836
return Number.ParseBigInteger(MemoryMarshal.
Cast
<byte, Utf8Char>(utf8Text), style, NumberFormatInfo.GetInstance(provider));
846
return Number.TryParseBigInteger(MemoryMarshal.
Cast
<char, Utf16Char>(value), style, NumberFormatInfo.GetInstance(provider), out result, out _) == Number.ParsingStatus.OK;
856
return Number.TryParseBigInteger(MemoryMarshal.
Cast
<byte, Utf8Char>(utf8Text), style, NumberFormatInfo.GetInstance(provider), out result, out _) == Number.ParsingStatus.OK;
862
return Number.TryParseBigIntegerPartial(MemoryMarshal.
Cast
<char, Utf16Char>(s.AsSpan()), style, NumberFormatInfo.GetInstance(provider), out result, out charsConsumed) == Number.ParsingStatus.OK;
868
return Number.TryParseBigIntegerPartial(MemoryMarshal.
Cast
<byte, Utf8Char>(utf8Text), style, NumberFormatInfo.GetInstance(provider), out result, out bytesConsumed) == Number.ParsingStatus.OK;
874
return Number.TryParseBigIntegerPartial(MemoryMarshal.
Cast
<char, Utf16Char>(s), style, NumberFormatInfo.GetInstance(provider), out result, out charsConsumed) == Number.ParsingStatus.OK;
System\Numerics\Complex.cs (5)
807
return Complex<double>.TryParse(MemoryMarshal.
Cast
<char, Utf16Char>(s), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out _);
814
return Complex<double>.TryParse(MemoryMarshal.
Cast
<byte, Utf8Char>(utf8Text), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out _);
821
return Complex<double>.TryParsePartial(MemoryMarshal.
Cast
<char, Utf16Char>(s.AsSpan()), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out charsConsumed);
828
return Complex<double>.TryParsePartial(MemoryMarshal.
Cast
<byte, Utf8Char>(utf8Text), style, provider, out Unsafe.As<Complex, Complex<double>>(ref result), out bytesConsumed);
835
return 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)
94
KeyBlobMagicNumber magic = (KeyBlobMagicNumber)MemoryMarshal.
Cast
<byte, int>(ecBlob)[0];
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PqcBlobHelpers.cs (2)
246
ref readonly BCRYPT_PQDSA_KEY_BLOB blob = ref MemoryMarshal.
Cast
<byte, BCRYPT_PQDSA_KEY_BLOB>(blobBytes)[0];
252
parameterSet = MemoryMarshal.
Cast
<byte, char>(blobBytes.Slice(index, parameterSetLength));
System.Text.Json (1)
System\Text\Json\Writer\Utf8JsonWriter.cs (1)
162
return MemoryMarshal.
Cast
<byte, char>(partialStringDataBytes.Slice(0, length));