用C#代码怎样写xml注释
1个回答
展开全部
namespace MyNameSpace
{
/// <summary>
/// 这是一个普通的类
/// </summary>
public class Person
{
/// <summary>
/// 这是标识的ID
/// </summary>
public string Id { get; protected set; }
/// <summary>
/// 这是姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 这是年龄
/// </summary>
public int Age { get; set; }
/// <summary>
/// 这是构造函数
/// </summary>
/// <param name="id">ID</param>
/// <param name="name">姓名</param>
/// <param name="age">年龄</param>
public Person(string id, string name, int age)
{
this.Id = id;
this.Name = name;
this.Age = age;
}
/// <summary>
/// 介绍自己啦
/// </summary>
public void IntroduceMyself()
{
Console.WriteLine("My name is {0}, My age is {1}", Name, Age);
}
/// <summary>
/// 计算两者之和
/// </summary>
/// <param name="a">左操作数</param>
/// <param name="b">右操作数</param>
/// <returns>两者和</returns>
public int calculate(int a, int b)
{
return a + b;
}
/// <summary>
/// 讲话啦
/// </summary>
/// <param name="msg">讲的内容</param>
public void saySomething(string msg)
{
Console.WriteLine(msg);
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询