在C#的成员名称中使用尖括号是什么意思? [英] What do angled brackets mean when used in member name in C#?
问题描述
当我发现以下内容时,我正在使用DotPeek浏览PresentationCore.dll的源代码:
I was browsing through sources of PresentationCore.dll using DotPeek when I found this:
// Type: MS.Internal.TtfDelta.CMAP_HEADER
// Assembly: PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// Assembly location: D:\Windows\Microsoft.NET\assembly\GAC_64\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace MS.Internal.TtfDelta
{
[NativeCppClass]
[StructLayout(LayoutKind.Sequential, Size = 4)]
internal struct CMAP_HEADER
{
private short <alignment member>;
}
}
"private short <alignment member>
"是什么意思?
What does "private short <alignment member>
" mean?
推荐答案
有时反汇编程序不知道代码的实际成员是什么,它将使用猜测"类型.
Sometimes the disassembler doesn't know what a member of the code actually is, and it'll use a "guessed" type.
反汇编程序为我们提供了伪代码,即使在.NET Framework上使用dotPeek时非常准确,但它仍然不是真实的"代码,例如以下HashEntry类中的base.ctor
调用:
Disassemblers provide us with pseudo-code, even though it's very accurate in the case of dotPeek being used on the .NET Framework, it still isn't "real" code, like the base.ctor
call in the following HashEntry class:
private class HashEntry
{
public string[] names;
public ulong[] values;
public HashEntry(string[] names, ulong[] values)
{
base.\u002Ector();
this.names = names;
this.values = values;
}
}
我从mscorlib中选出的一个很好地证明了这一点.
Which I took from mscorlib demonstrates this perfectly.
这篇关于在C#的成员名称中使用尖括号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!