[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>

二、格式参考

代码:

cs 复制代码
/// <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

相关推荐
2301_801821712 分钟前
标签分类调研
笔记
im_AMBER10 分钟前
HTTP 02 会话 | 消息 | MIME类型
网络·笔记·网络协议·学习·http
梦里不知身是客1116 分钟前
kafka作为Sink
c#·linq
猿来是你_L18 分钟前
C# Dictionary 转换成 List
windows·c#·list
循环过三天1 小时前
7.5、Python-匿名函数lambda
笔记·python·学习
kokunka1 小时前
C#类修饰符功能与范围详解
java·开发语言·c#
mudtools1 小时前
.NET驾驭Excel之力:工作簿与工作表操作基础
c#·.net·excel
mudtools1 小时前
.NET驾驭Excel之力:单元格与区域操作详解
c#·.net·excel
不会写代码的里奇3 小时前
VMware Ubuntu 22.04 NAT模式下配置GitHub SSH完整教程(含踩坑实录+报错_成功信息对照)
linux·经验分享·笔记·git·ubuntu·ssh·github
_不会dp不改名_3 小时前
HCIP笔记5--OSPF域间路由、虚链路、认证
网络·笔记·hcip