Refactoring the ARM Hardware Intrinsics based on the latest design decisions. (#26895)
[mono-project.git] / netcore / System.Private.CoreLib / shared / System / ByReference.cs
blob82d4e5cf2190440b6e10aa3bb05d35a79083f3a9
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 using System.Runtime.CompilerServices;
6 using System.Runtime.Versioning;
8 namespace System
10 // ByReference<T> is meant to be used to represent "ref T" fields. It is working
11 // around lack of first class support for byref fields in C# and IL. The JIT and
12 // type loader has special handling for it that turns it into a thin wrapper around ref T.
13 [NonVersionable]
14 internal readonly ref struct ByReference<T>
16 #pragma warning disable CA1823, 169 // private field '{blah}' is never used
17 private readonly IntPtr _value;
18 #pragma warning restore CA1823, 169
20 [Intrinsic]
21 public ByReference(ref T value)
23 // Implemented as a JIT intrinsic - This default implementation is for
24 // completeness and to provide a concrete error if called via reflection
25 // or if intrinsic is missed.
26 throw new PlatformNotSupportedException();
29 public ref T Value
31 // Implemented as a JIT intrinsic - This default implementation is for
32 // completeness and to provide a concrete error if called via reflection
33 // or if the intrinsic is missed.
34 [Intrinsic]
35 get => throw new PlatformNotSupportedException();