3

If i have the following function:

void ReadData(Action<DataContext> action) {}

how can i reference it in seealso construct?

<seealso cref="ReadData(Action<DataContext>)"/>

complains "The character '<' cannot be used in an attribute value". Changing '<' and '>' to '{' and '}' works but makes it open generic parameter.

UserControl
  • 14,766
  • 20
  • 100
  • 187

2 Answers2

5
<seealso cref="ReadData(Action{DataContext})"/>
Petar Ivanov
  • 91,536
  • 11
  • 82
  • 95
4

From section A.3.1 of the C# 4 spec:

  • Arguments that use generic type parameters defined on types are encoded using the backtick character followed by the zero-based index of the type parameter.
  • Arguments that use generic type parameters defined in methods use a double-backtick instead of the single backtick used for types.
  • Arguments that refer to constructed generic types are encoded using the generic type, followed by "{", followed by a comma-separated list of type arguments, followed by "}".

(I've written backtick explicitly rather than including the character due to markdown limitations.)

Of these, the last bullet point is what you're after, so Action{DataContext} as per Petar's answer. I only included this answer for extra reference, basically :)

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194