[C#学习笔记]注释

官方文档:Documentation comments - C# language specification | Microsoft Learn

一、常用标记总结

1.1 将文本设置为代码风格的字体:<c>

1.2 源代码或程序输出:<code>

1.3 异常指示:<exception>

1.4 段落 <para>

1.5 换行<br>

1.6 方法参数<paramref> 

1.7 返回值<returns>

1.8 生成条目<see> 

1.9 生成子条目<seealso> 

1.10 描述泛型类或方法<typeparam> 

1.11 属性描述<value>

 

1.12 引用其他注释<inheritdoc>

1.13 额外注释<remarks>

1.14 高亮文本<langword>

二、格式参考

 代码:

/// <summary>
/// this is a converter function which converts <see langword="bool"/> into a <see cref="Visibility"/>
/// </summary>
/// <remarks>
/// <para>
/// This converter will receive a <see langword="bool"/> value and return a <see cref="Visibility"/> depending on the value.<br/>
/// If the value is <see langword="true"/>, the return value will be <see cref="Visibility.Visible"/>;<br/>
/// Otherwise, the return value will be <see cref="Visibility.Collapsed"/>
/// </para>
/// </remarks>
/// <example>
/// This is as example of how to use this converter in XAML
/// <code lang="xaml">
/// <![CDATA[
/// <Window>
///     <Window.Resources>
///       <local:BoolToVisibilityConverter x:Key="converter"/>
///     </Window.Resources>
///     <CheckBox Name="check"/>
///     <Image Visibility={Binding ElementName=check, Path=IsChecked, Converter={StaticResource converter}}" />
/// </Window>
/// ]]>
/// </code>
/// </example>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
    throw new NotImplementedException();
}

预览1 

预览2 

  • 8
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值