This gets me a handle (to something), but is probably too slow:
private GCHandle _hndCompare;
private IntPtr _addCompare;
public Utils()
{
Object mcmp = (Object)this.Compare("","");
GCHandle _hndCompare = GCHandle.Alloc(mcmp, GCHandleType.Pinned);
IntPtr _addCompare = _hndCompare.AddrOfPinnedObject();
}
public int Compare(string str1, string str2)
{
int ret = 0;
return ret;
}
~Utils()
{
try
{
if (_hndCompare.IsAllocated)
{
_hndCompare.Free();
_addCompare = IntPtr.Zero;
}
}
catch { }
}