我需要为方法Login的返回值创建XML注释。此方法返回对象类型 结果如果登录成功,则此对象包含会话ID,如果登录失败,则包含错误消息。
我不知道如何在XML评论中解释这一点。
/// <summary>
/// Login to server
/// </summary>
/// <param name="name">Name of user</param>
/// <param name="password">User password</param>
/// <returns>
/// This method return object type of Result<Account>
/// If login was successful contains sessions
/// If login was unsuccessful contains error
/// </returns>
Result<Account> Login(string name, string password);
/// <summary>
/// Return value of method
/// </summary>
/// <typeparam name="T">Type of return value</typeparam>
public class Result<T>
{
/// <summary>
/// Return message
/// </summary>
public string ResultMessage { get; set; }
/// <summary>
/// Return value
/// </summary>
public T ReturnValue { get; set; }
}
public class Account
{
public string Name{get;set;}
public string Password {get;set;}
public string Session {get;set;
}
感谢您的建议。
答案 0 :(得分:3)
你会使用:
/// ...
/// This method returns an object of type <see cref="Result{Account}"/>.
/// ...
请参阅cref
Attribute。