English 中文(简体)
我在c#中增加一个方法的参数评论
原标题:how do I add parameter comments for a method in c#
  • 时间:2011-11-24 12:24:22
  •  标签:
  • c#
  • .net

当我使用任何“网络”方法时,对方法及其参数的解释很少。

我如何为我自己的方法实现同样的行为? 是否有视频演播室特征使我能够补充这些内容?

最佳回答

“名称”指XML comments。 在你们的方法之前,只有哪类//或右面才会产生一些微米标签。 这些仪器将用来显示仪器和参数内光。

/// <summary>
/// this will be the tooltip
/// </summary>
/// <param name="args">args will be passed when starting this program</param>
static void Main(string[] args)
{

}

Screenshot of my VS2010 when calling method add. As you can see, xml comments are shown. Screenshot of my VS2010 when calling method ADD

问题回答

是的。 例如:

/// <summary>
/// My super method
/// </summary>
/// <param name="myNumber">My number parameter</param>
/// <returns>My result</returns>
private int myMethod(int myNumber)
{
   return myNumber
}

1. 自动生成在贵方法、财产、类别等之上的xml评论。 here建议贴上文件标签。 也可以使用

它称作XML文件。 您在签名方法上必须撰写以下评论:

/// <summary>
/// Performs a custom action: ...
/// </summary>
/// <param name="x">
/// An integer representing the ...
/// </param>
/// <param name="y">
/// A boolean representing the ...
/// </param>
public void MyMethod(int x, bool y) {
    //...
}

页: 1

///<summary>my Description</summary>
public void mymethod()

Like described on msdn http://msdn.microsoft.com/en-us/library/b2s063f7(v=VS.100).aspx

你可以做事,在你的职责中增加一个特别的评论(考虑到3个冲突)。 这方面的例子很短:

 /// <summary>
 /// This is my special function
 /// </summary>
 /// <param name="myParameter">Very important parameter.</param>
 /// <returns>Always returns 42.</returns>
 public int MyFunction(string myParameter)
 {
       return 42;
 }

Explanation: << summary >> Is the tag for to explain the functionality

<< param name=”>> 解释一堂教区

<< Return >> 解释报复价值的标签。

还有几个方面,视像演播室将在你发表评论时向大家展示。

如果你在超过你的手法/财产视觉演播室时三次发出闪电,就会产生一份XML评论摘要,然后用相关的信息收集。

另外一个很好的预兆是,如果你去项目财产,然后,你会看到“建筑”向底层,则有“产出”部分。 如果你每当项目设计一个XML文件,供您使用,则将与其他消费你的转录器的开发商一道产生巨大损失。 这也意味着视觉演播室将向尚未发表评论或评论的公众发出警告。

是的。 缩略语





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签