c# 托管对象与InPtr互转

时间:2014-11-27 21:56:15   收藏:0   阅读:1262

 

  GCHandle thisHandle = GCHandle.Alloc(this);//this 是  MyClass类型
  IntPtr thisptr = GCHandle.ToIntPtr(thisHandle);

  GCHandle thisHandle = GCHandle.FromIntPtr(thisptr );
  MyClass thisObject = (MyClass)thisHandle.Target;

  

原文:http://www.cnblogs.com/uucode/p/4127117.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!