代码之家  ›  专栏  ›  技术社区  ›  Steven de Beer

IntelliSense和折叠的XML注释未按需要在designview中显示

  •  0
  • Steven de Beer  · 技术社区  · 7 年前

    我正在尝试为IntelliSense创建XML注释,并使用以下操作:

    '''<summary>Units
    ''' <para>MinOccurs: '0'</para>
    ''' </summary>
    Public Property S_Units As String = Nothing
    

    已折叠,如下所示:

    '''<summary>BinLocation
    Public Property B_BinLocation As String = Nothing
    

    我想做的是添加一个XMLcomment,当它被折叠时,它会模拟在深入研究像Microsoft这样的系统属性时它的显示方式 String.Padright 属性(我知道这只是常规评论,但需要相同的效果)

    '
    ' Summary:
    '     Returns a new string that left-aligns the characters in this string by padding
    '     them on the right with a specified Unicode character, for a specified total length.
    '
    ' Parameters:
    '   totalWidth:
    '     The number of characters in the resulting string, equal to the number of original
    '     characters plus any additional padding characters.
    '
    '   paddingChar:
    '     A Unicode padding character.
    '
    ' Returns:
    '     A new string that is equivalent to this instance, but left-aligned and padded
    '     on the right with as many paddingChar characters as needed to create a length
    '     of totalWidth. However, if totalWidth is less than the length of this instance,
    '     the method returns a reference to the existing instance. If totalWidth is equal
    '     to the length of this instance, the method returns a new string that is identical
    '     to this instance.
    '
    ' Exceptions:
    '   T:System.ArgumentOutOfRangeException:
    '     totalWidth is less than zero.
    Public Function PadRight(totalWidth As Integer, paddingChar As Char) As [String]
    

    已折叠,如下所示:

    ...Public Function PadRight(totalWidth As Integer) As [String]
    

    注意椭圆与函数声明一致 如果我模拟这里使用的结构,我会得到以下结果:

    '
    ' Summary:
    '    Summary Line
    '
    ' Returns:
    '     Returns Line
    Public Property S_Units As String = Nothing
    

    导致坍塌:

    ' ...
    Public Property S_Units As String = Nothing
    

    请注意属性声明上方的椭圆。 值得注意的一点是,我从 System 名称空间和VS选项卡显示 String [from metadata]

    这可能是它表现不同的原因吗?或者我在什么地方遗漏了一些导入或引用?

    有什么我可以试试的吗?

    1 回复  |  直到 7 年前
        1
  •  1
  •   TnTinMn    7 年前

    您将一个特殊的可视化工具视图混淆为xml注释的可选视图。

    在VS2015之前,这个特定的可视化工具在VB中并不存在,而“转到定义”将带您进入“对象浏览器”。此视图由“文本编辑器”选项“转到定义”控制。

    enter image description here

    正如描述所述,此视图是从类型的元数据和xml文档文件(如果它存在于引用路径中)构建的。您可以在以下文章中阅读此元数据: Metadata and Self-Describing Components .

    无法为主代码编辑器启用此视图。如果您要将代码编译到库中并在另一个解决方案中引用它,那么当您单击“转到定义”时,就会看到此可视化工具视图。