[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

相关推荐
我命由我1234532 分钟前
Photoshop - Photoshop 工具栏(2)矩形框选工具
经验分享·笔记·学习·ui·photoshop·ps·美工
序属秋秋秋37 分钟前
《C++进阶之C++11》【异常】
c++·笔记·学习·c++11·异常·新特性
LateFrames2 小时前
用 【C# + Winform + MediaPipe】 实现人脸468点识别
python·c#·.net·mediapipe
张书名3 小时前
《强化学习数学原理》学习笔记6——贝尔曼最优方程的压缩性质
笔记·学习
悠哉悠哉愿意4 小时前
【ROS2学习笔记】话题通信篇:话题通信项目实践——系统状态监测与可视化工具
笔记·学习·ros2
hssfscv4 小时前
JAVA学习笔记——9道综合练习习题+二维数组
java·笔记·学习
长路归期无望8 小时前
C语言小白实现多功能计算器的艰难历程
c语言·开发语言·数据结构·笔记·学习·算法
追逐时光者8 小时前
精选 4 款开源免费、美观实用的 MAUI UI 组件库,助力轻松构建美观且功能丰富的应用程序!
后端·.net
yuxb7310 小时前
Ceph 分布式存储学习笔记(二):池管理、认证和授权管理与集群配置(下)
笔记·ceph·学习
悠哉悠哉愿意10 小时前
【ROS2学习笔记】话题通信篇:python话题订阅与发布
笔记·学习·ros2