English 中文(简体)
帮助将反射分解成可编纂的法典
原标题:Help translating Reflector deconstruction into compilable code

因此,我反映的是某些框架2.0代码,最后进行以下拆除:

fixed (void* voidRef3 = ((void*) &_someMember))
{
...
}

该奖项按<代码>汇编。 固定声明转让的正确手边不得装成<>/代码>。

我的理解是,反射师只能看一看一看一条明确的道路,但这不是我的经验。

问题:有人试图向我描述什么?

最新情况:

阿曼还看到:

fixed (IntPtr* ptrRef3 = ((IntPtr*) &this._someMember))

最新情况:

因此,正如米奇所说,它不是一个双向的经营者,而是一个地址。 在经营者中。

现在的问题是:

fixed (IntPtr* ptrRef3 = &_someMember)

页: 1 不得含蓄地将Xxx*类转换成系统。 IntPtr*. 存在明确的转换(如果你没有 cast?)汇编错误。

因此,如果我这样做的话,我似乎受到破坏。 任何想法?

<><>UPDATE:

我认为我已经表示过。 顺便提一下正在使用<密码> 撤销*的表述,删除了停止申诉的 cast和VS,而且由于我从这次谈话的参加者那里收集的“密码> 避免*和intptr*是等同的,我简单地夸大了这些内容,因此:

fixed (void* ptrRef3 = &_someMember)

VS停止了申诉。 某人可以核实:

fixed (void* ptrRef3 = &_someMember)

等于

fixed (IntPtr* ptrRef3 = &_someMember)

?

最佳回答

它正在处理<代码>_部分成员,将其投到(撤销*)(即点地址),然后确定地址的位置。

<代码> 固定 标本,并阻止GC将其移至此处。

The & used in this context is the Address Ofters, not Biwise And.

针对最新问题:

您:

fixed (void* voidRef3 = &_someMember) 
{ 
... 
}
问题回答

答复您的最后评论:你的工作是不是?

fixed (IntPtr* ptrRef3 = (IntPtr *) &_someMember)

<><>Edit>/strong>

我不敢肯定你的含义。

that is effectively what reflector gave me

你提到的错误似乎很清楚:如果你提出要求,它可以明确地从(避免)改为(IntPtr*)。 我的榜样是,你不这样做。

在插入<代码>(IntPtr *)时,你是否真的收到同样的错误信息?

<>Another Edit

某人可以核实:

<代码>固定(避免* ptrRef3 = &_someMember)

等于

<代码>固定(IntPtr* ptrRef3 = &_someMember/code>

首先:是,它们具有相同的作用。

第二: 我指的是什么。 我认为,它所知道的比较数字不足以为某些成员提供可移动的参考,因此可以留给C#管理的时间。 为了应对这种情况,它使用<代码>固定,为这一记忆收集可拆卸的垃圾,然后由你在安全处理地点时告诉管理时间。

因此,这并不是说你应该保持下去的:一旦你发现数据线的真正意义和生命范围,就重新使用常规(收集的垃圾)变量。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签