Visual studio 设计时所需的输出,Visual Studio 2008(vb)

Visual studio 设计时所需的输出,Visual Studio 2008(vb),visual-studio,visual-studio-2008,design-time,Visual Studio,Visual Studio 2008,Design Time,是否可以选择在设计时运行特定代码?我希望能够显示在特定表单和菜单中使用的枚举列表。这可能吗?如有任何答复,将不胜感激。 提前谢谢 不确定确切需要什么,但在(CTRL+ALT+I)中可以键入以下类型的命令: ? System.Enum.GetNames(GetType(System.AttributeTargets)) …将产生此输出: {Length=16} (0): "Assembly" (1): "Module" (2): "Class" (3): "Str

是否可以选择在设计时运行特定代码?我希望能够显示在特定表单和菜单中使用的枚举列表。这可能吗?如有任何答复,将不胜感激。
提前谢谢

不确定确切需要什么,但在(CTRL+ALT+I)中可以键入以下类型的命令:

? System.Enum.GetNames(GetType(System.AttributeTargets))
…将产生此输出:

{Length=16}
    (0): "Assembly"
    (1): "Module"
    (2): "Class"
    (3): "Struct"
    (4): "Enum"
    (5): "Constructor"
    (6): "Method"
    (7): "Property"
    (8): "Field"
    (9): "Event"
    (10): "Interface"
    (11): "Parameter"
    (12): "Delegate"
    (13): "ReturnValue"
    (14): "GenericParameter"
    (15): "All"
只需将
System.AttributeTargets
替换为您喜爱的枚举即可

通过一点创造性,您可以从代码中获取各种值,并以相同的方式调用方法(这里仅举几个简单的示例):


当然,在这里可以执行的复杂操作有一定的限制,但为了更简单的调试目的,它工作得很好。

@Macros;不,这就是即时窗口的重点。通过指向MSDN文档的链接更新了答案。
' print the value of a property '
? (New VBWindowsApplication1.Form1()).Text

' call some method '
? (New VBWindowsApplication1.Form1()).SomeMethod()