How to force a Documentation <see /> element to reference the type instead of the property with the same name?

StackOverflow https://stackoverflow.com/questions/17338927

  •  01-06-2022
  •  | 
  •  

문제

It is relatively common practice for property names to default to the type name when the type name is significant enough;

public class User { }
public class UserSession
{
    /// <summary>
    /// Creates a <see cref="UserSession" /> instance
    /// with the given <see cref="User" />
    /// </summary>
    public UserSession(User user)
    {
        User = user;
    }

    public User User { get; private set; }
}

My problem is that the <see cref="User" /> element in the XML documentation refers to the UserSession.User property. What should I write in order to reference the User type instead?

도움이 되었습니까?

해결책

Use the full name of the type, including the namespace.

다른 팁

Write the full name of User as shown in <see> (C# Programming Guide) with System.Console.WriteLine(String):

<see cref="YourNamespace.User"/>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top