[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

相关推荐
ouliten2 小时前
cuda编程笔记(33)--Thrust库的使用
笔记·cuda
摇滚侠7 小时前
Spring Boot 3零基础教程,新特性 ProblemDetails,笔记50
spring boot·笔记
一只一只7 小时前
Unity 3D笔记(进阶部分)——《B站阿发你好》
笔记·3d·unity·游戏引擎
月临水7 小时前
Git 学习笔记
笔记·git·学习·1024程序员节
朝新_9 小时前
【SpringBoot】详解Maven的操作与配置
java·spring boot·笔记·后端·spring·maven·javaee
追逐时光者10 小时前
C#/.NET/.NET Core技术前沿周刊 | 第 59 期(2025年10.20-10.26)
后端·.net
-Excalibur-10 小时前
形象解释关于TCP/IP模型——层层封装MAC数据帧的过程
linux·c语言·网络·笔记·单片机·网络协议·tcp/ip
想唱rap12 小时前
C++ list 类的使用
c语言·开发语言·数据结构·c++·笔记·算法·list
朝新_12 小时前
【EE初阶】JVM
java·开发语言·网络·jvm·笔记·算法·javaee
赵庆明老师13 小时前
C# 结合Redis Cache 访问MySQL数据库
数据库·redis·c#