[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 小时前
Linux环境编程第六天笔记--system-V IPC
linux·笔记
乌恩大侠4 小时前
【笔记】USRP 5G 和 6G 参考架构
笔记·5g
biuyyyxxx5 小时前
Python自动化办公学习笔记(一) 工具安装&教程
笔记·python·学习·自动化
舟舟亢亢5 小时前
Java集合笔记总结
java·笔记
A_nanda6 小时前
c# MOdbus rto读写串口,如何不相互影响
算法·c#·多线程
丝斯20116 小时前
AI学习笔记整理(66)——多模态大模型MOE-LLAVA
人工智能·笔记·学习
kida_yuan7 小时前
【Linux】运维实战笔记 — 我常用的方法与命令
linux·运维·笔记
码云数智-园园8 小时前
使用 C# 将 PowerPoint 演示文稿高效转换为 PDF 格式
c#
laplace01238 小时前
Claude Skills 笔记整理
人工智能·笔记·agent·rag·skills
三块可乐两块冰8 小时前
【第二十八周】机器学习笔记二十九
笔记