File: IEnum.cs
Web Access
Project: src\src\runtime\src\native\managed\cdac\Microsoft.Diagnostics.DataContractReader.Legacy\Microsoft.Diagnostics.DataContractReader.Legacy.csproj (Microsoft.Diagnostics.DataContractReader.Legacy)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Microsoft.Diagnostics.DataContractReader.Legacy;

internal interface IEnum<T>
{
    IEnumerator<T> Enumerator { get; }
    TargetPointer LegacyHandle { get; }
    void Dispose() => Enumerator.Dispose();
    long GetHandle()
    {
        GCHandle gcHandle = GCHandle.Alloc(this);
        return GCHandle.ToIntPtr(gcHandle).ToInt64();
    }
}