首页 新闻 会员 周边

c#中指针的用法

0
悬赏园豆:10 [已解决问题] 解决于 2012-11-22 16:11

希望能举个一小段代码的例子加文字说明,谢谢爱心人士啦~~

C#
乖乖ll0的主页 乖乖ll0 | 初学一级 | 园豆:177
提问于:2012-09-12 20:08
< >
分享
最佳答案
1
 1 internal static unsafe IntPtr InterlockedExchangePointer(IntPtr lpAddress, IntPtr lpValue)
 2         {
 3             IntPtr ptr2;
 4             IntPtr ptr = *((IntPtr*)lpAddress.ToPointer());
 5             do
 6             {
 7                 ptr2 = ptr;
 9                 ptr = Interlocked.CompareExchange(ref ptr, lpValue, ptr2);
10             }
11             while (ptr != ptr2);
12             return ptr;
13         }
收获园豆:10
Launcher | 高人七级 |园豆:45045 | 2012-09-13 09:01

用到了  unsafe   thank you~

乖乖ll0 | 园豆:177 (初学一级) | 2012-09-13 09:03
其他回答(1)
0

没有必要使用指针,在c#中

chenping2008 | 园豆:9836 (大侠五级) | 2012-09-12 21:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册