soundvision/CylVision/Assets/ThridParty/KinectScript/NativeWrapper.cs

28 lines
648 B
C#
Raw Normal View History

2019-06-30 12:46:10 +00:00
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
public static class NativeWrapper
{
public static System.IntPtr GetNativePtr(Object obj)
{
if(obj == null)
{
return System.IntPtr.Zero;
}
var nativeWrapperIface = obj as INativeWrapper;
if(nativeWrapperIface != null)
{
return nativeWrapperIface.nativePtr;
}
else
{
throw new ArgumentException("Object must wrap native type");
}
}
}
}