Dot-Net

如何讓 Intellisense 顯示列舉值的含義

  • June 20, 2020

我想知道在 Visual Studio 2005 中獲取 Intellisense 以顯示 VB.NET 項目的單個列舉值的含義。對於屬於 .NET 庫的列舉,這已經發生了。

這可能嗎?如果是這樣,我需要如何評論我的列舉才能實現這一點?

在 VS 2008 中,只需使用標準的 XML 註釋語法。我假設(但無法檢查)它在 VS 2005 中是否相同?

   ''' <summary>
   ''' Overall description
   ''' </summary>
   Public Enum Foo AS Integer
       ''' <summary>
       ''' Specific value description
       ''' </summary>
       First,
       ''' <summary>
       ''' etc.
       ''' </summary>
       Second
   End Enum

在 C# 中,您可以這樣做:

enum Test
{
   /// <summary>
   /// The first value.
   /// </summary>
   Val1,
   /// <summary>
   /// The second value
   /// </summary>
   Val2,
   /// <summary>
   /// The third value
   /// </summary>
   Val3
}

因此,在 VB 中,您只需在列舉值上方添加 XML 註釋摘要。

引用自:https://stackoverflow.com/questions/3621502