File: src\runtime\src\libraries\System.Private.CoreLib\src\System\ByReference.cs
Web Access
Project: src\runtime\src\coreclr\nativeaot\System.Private.CoreLib\src\System.Private.CoreLib.csproj (System.Private.CoreLib)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;
using System.Runtime.Versioning;

namespace System
{
    // ByReference is meant to be used to represent a tracked reference in cases where C#
    // proves difficult. See use in Reflection.
    [NonVersionable]
    internal readonly ref struct ByReference
    {
        public readonly ref byte Value;
        public ByReference(ref byte value) => Value = ref value;

        public static ByReference Create<T>(ref T p) => new ByReference(ref Unsafe.As<T, byte>(ref p));
    }
}