工具,比如Reflector做出相當簡單。你甚至可以使用.NET Framework的一部分附帶的ILDASM。
您可以使用這兩種工具之一加載主互操作程序集。反射器示出了C#源爲:
public enum WdCollapseDirection
{
wdCollapseEnd,
wdCollapseStart
}
由於它們沒有明確的值,wdCollapseEnd
是0和wdCollapseStart
是1.我們可以與IL視圖確認:
.class public auto ansi sealed WdCollapseDirection
extends [mscorlib]System.Enum
{
.field public specialname rtspecialname int32 value__
.field public static literal valuetype Microsoft.Office.Interop.Word.WdCollapseDirection wdCollapseEnd = int32(0)
.field public static literal valuetype Microsoft.Office.Interop.Word.WdCollapseDirection wdCollapseStart = int32(1)
}
ILDASM示出了這一點:
.field public static literal valuetype Microsoft.Office.Interop.Word.WdCollapseDirection wdCollapseEnd = int32(0x00000000)
如果您有像Resharper這樣的工具,請按照以下步驟操作:Ctrl + 上。問從Visual Studio中直接顯示了這一點:
![enter image description here](https://i.stack.imgur.com/biwxU.png)
你可以有一個虛擬的項目,你可以用它來查找值。
作爲附加選項,如果你使用LINQPad你可以引用字主Interop大會(的Microsoft.Office.Interop.Word - 應在GAC),並運行此:
void Main()
{
var value = (int) Microsoft.Office.Interop.Word.WdCollapseDirection.wdCollapseStart;
Console.Out.WriteLine("value = {0}", value);
}
謝謝,看起來像這比我想象的要容易。 – ollifant