[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

相关推荐
琳少_4 小时前
java程序开发笔记
java·开发语言·数据库·笔记
Z21-X7 小时前
云原生运维学习笔记:Kubernetes Volume 与 Secret 实验
运维·笔记·学习·云原生·kubernetes
一只大鸽子8 小时前
游戏开发笔记7-Godot RPG游戏基础-场景切换、全局脚本
笔记·游戏·godot
吃我一窝jio12 小时前
Docker+Jenkins+K8s全流程部署
java·开发语言·笔记·python
我超膨胀der.12 小时前
关于如何完整转移LABVIEW源码
笔记·labview
国科安芯12 小时前
FPGA上电偶发不启动:多轨电源时序、PGOOD与并联供电的FAE排查笔记——ASP4644S2B在星载智能处理板中的工程应用分析
笔记·单片机·嵌入式硬件·fpga开发·低轨卫星·抗辐射
Jeff-Tsai14 小时前
Day 26:数值语义、多币种与计量单位
.net·架构设计·erp·definition-driven
一条破秋裤1 天前
【1115】【多线程】【笔记】
前端·chrome·笔记
风云1 天前
两条 Pipe、五个命门:Vane.NET 内核为什么长这样
开源·网络编程·.net·架构设计·vane.net