[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

相关推荐
M78佐菲5 分钟前
ARM学习笔记(五)
linux·arm开发·笔记·嵌入式硬件·学习
志尊宝19 分钟前
Vue3 零基础每日笔记(052):路由常见坑一次排雷——404、刷新丢参数、部署白屏
前端·javascript·vue.js·笔记·html5
Ztt6666666661 小时前
一抹霞红停在圆肩壶上,留白让颜色更醒目
经验分享·笔记·其他·百度·微信公众平台
何以解忧唯有撸码2 小时前
【开源】c#造个轮子-日程安排工具
c#·自定义控件
摇滚侠2 小时前
《Spring Boot 3:高级与架构设计》第 2 章 IOC容器的高级机制 Environment 个人理解 4
java·spring boot·笔记·后端
周杰伦fans2 小时前
CAD菜单栏和工具栏都不见了,怎么显示?
其他·c#
曹牧2 小时前
C#:HashSet<T> 去重
c#
czhc11400756632 小时前
起点、口径与因果:今天用错的七把尺子
c#
Demons_kirit2 小时前
cookie的samesite机制
笔记·note
那个松鼠很眼熟w2 小时前
填充word文档【Apache POI】
笔记