I am trying to include a code snippet in the XML class documentation, but the compiler complains that the xml element is not closed! This is what i am trying to achieve
/// <summary> /// Method documentation here... /// </summary> /// <remarks> /// <para> /// This class should be used as follow: /// <br/> /// ************** PROBLEM IN NEXT LINE ******************** /// <c> MyClass class = new MyClass<String>(); </c> /// </para> /// </remarks> public class MyClass<T>{ .... }
I tried replacing the code snippet with /// <c> MyClass class = new MyClass{String}(); </c>
/// <c> MyClass class = new MyClass{String}(); </c>
Has anyone experienced this before?
thanks for the help
In the xml documentation, you need to replace the triangular braces with curly braces:
/// <summary> /// Calls <see cref="DoSomething{T}"/>. /// </summary> public void CallsDoSomething() { } public void DoSomething<T>() { }
The reason you end up having to do this is because it's really not well-formed xml if you allow triangular braces outside of the element layout.
The correct replacement.
Remarks 4- , , .
Remarks
, , , List<string> List, string XML. List &lt;string&gr;, List<string>, XML.
List<string>
List
string
List &lt;string&gr;
# { } , List{string}, < > 's.
{
}
List{string}
:
<
>
<
>
<remarks>
</remarks>
<see ... />
<seealso ... />
<see cref="SomeMethod{T}(T value)" />
<see cref="SomeMethod{String}(String value)" />
Here is a fixed version of your XML comments:
/// <summary> /// Method documentation here... /// </summary> /// <remarks> /// <note type="implementsinfo"> /// <para>This class should be used as follow:</para> /// <para><c>MyClass class = new MyClass<string<();</c></para> /// </note> /// </remarks> public class MyClass<T> { .... }
Your <remarks>never closes.
It also requires replacing angular brackets, as you have already tried.