System.SpanTests.ReadOnlySpanTests.PortableCastUIntToUShort C# (CSharp) Method

PortableCastUIntToUShort() private method

private PortableCastUIntToUShort ( ) : void
return void
        public static void PortableCastUIntToUShort()
        {
            uint[] a = { 0x44332211, 0x88776655 };
            ReadOnlySpan<uint> span = new ReadOnlySpan<uint>(a);
            ReadOnlySpan<ushort> asUShort = span.NonPortableCast<uint, ushort>();

            Assert.True(Unsafe.AreSame<ushort>(ref Unsafe.As<uint, ushort>(ref span.DangerousGetPinnableReference()), ref asUShort.DangerousGetPinnableReference()));
            asUShort.Validate<ushort>(0x2211, 0x4433, 0x6655, 0x8877);
        }