File: Windows\Win32\Foundation\IPointer.cs
Web Access
Project: src\src\System.Private.Windows.Core\src\System.Private.Windows.Core.csproj (System.Private.Windows.Core)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
namespace Windows.Win32.Foundation;
 
/// <summary>
///  Used to indicate ownership of a native resource pointer.
/// </summary>
/// <remarks>
///  <para>
///   This should never be put on a struct.
///  </para>
/// </remarks>
internal unsafe interface IPointer<TPointer> where TPointer : unmanaged
{
    // This interface method must return a nint instead of a typed pointer directly because
    // C++/CLI cannot compile when it encounters generic pointers, even in internal interfaces.
    // System.Private.Windows.Core is included in the ref.
    // See https://github.com/dotnet/winforms/issues/11983 for more details.
    [Obsolete("Use extension method GetPointer on IPointer<T> to get the typed pointer instead.")]
    nint Pointer { get; }
}