2025-04-24 20:56:44 +08:00
|
|
|
|
using System.Reflection;
|
2025-04-24 20:56:10 +08:00
|
|
|
|
|
2026-02-21 16:31:24 +08:00
|
|
|
|
namespace ShrlAlgoToolkit.RevitCore.Extensions;
|
2025-04-24 20:56:44 +08:00
|
|
|
|
|
|
|
|
|
|
public static class PointerExtensions
|
2025-04-24 20:56:10 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// 将指针转为句柄.
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 将指针转为句柄.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="p"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public static IntPtr ToIntPtr(this Pointer p)
|
|
|
|
|
|
{
|
|
|
|
|
|
return (IntPtr)p.GetType().GetMethod("GetPointerValue", BindingFlags.NonPublic | BindingFlags.Instance)?.Invoke(p, null)!;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|