Far*_*res 11 c# intellisense visual-studio
当您输入"this"时.,你通常会得到你所在的当前课程的所有例程,事件等等.当你只是站在长列表中的一个例程而不选择一个例程时,你通常会在它旁边得到一个描述.
我怎样才能做到这一点 ?假设我有一个名为CAR的类,它有两个例程:speed_up()和brake().当我输入时,如何让使用我的班级的人看到这两个函数的描述:
CAR mycar = new CAR();
mycar.
Run Code Online (Sandbox Code Playgroud)
Chr*_*ris 24
在类或方法之上,而不是"//"注释.如果您执行"///"三次斜杠(也称为XML注释),它会执行快捷方式以允许您填写有关您正在评论的类或方法的信息.
然后,这会出现在您的代码中
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Method(object sender, EventArgs e)
Run Code Online (Sandbox Code Playgroud)
然后,当您出现描述时,通过intellisense访问类或方法.
为您的课程及其成员提供XML注释,这些注释将出现在intellisense中.在visual studio中执行此操作的最简单方法是在///上面键入要添加注释的内容.
例如:
/// <summary>
/// Class level summary documentation goes here.</summary>
/// <remarks>
/// Longer comments can be associated with a type or member through
/// the remarks tag.</remarks>
public class TestClass : TestInterface
{
/// <summary>
/// Store for the name property.</summary>
private string _name = null;
/// <summary>
/// The class constructor. </summary>
public TestClass() { }
/// <summary>
/// Description for SomeMethod.</summary>
/// <param name="s"> Parameter description for s goes here.</param>
/// <seealso cref="System.String">
/// You can use the cref attribute on any tag to reference a type or member
/// and the compiler will check that the reference exists. </seealso>
public void SomeMethod(string s)
{
}
}
Run Code Online (Sandbox Code Playgroud)
以上是在这里找到的.