Search code examples
c#xmlconstructorcomments

How can I reference a constructor from C# XML comment?


Is it possible to reference a constructor from a C# XML comment without resorting to the explicit prefixes (like M: or T:)?

For instance, the following yields compilation warnings, because the compiler does not like ".ctor". Trying "PublishDynamicComponentAttribute.#ctor" is no good,
"PublishDynamicComponentAttribute.PublishDynamicComponentAttribute" is no good too.

/// <summary>
/// Constructs a new <see cref="PublishEntityAttribute"/> instance.
/// </summary>
/// <seealso cref="PublishDynamicComponentAttribute..ctor(Type)"/>
public PublishEntityAttribute(Type entityFactoryType) :
  base(entityFactoryType)
{
}

I am sure the type itself is visible.

So, I am left to use the explicit prefix M:, which removes the compiler verification, so when a type is moved/renamed the cref will be invalid.

Any suggestions?


Solution

  • You specify a constructor as if you are calling it, but with the types of the arguments instead of values for them:

    /// <seealso cref="PublishDynamicComponentAttribute(Type)"/>