Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using C#'s XML comment cref attribute with params syntax

In C#, I am trying to use <see cref="blah"/> to reference a method signature that contains the params keyword. I know this converts the parameter list to an array, but I can't even figure out how to refer to an array in a CREF attribute. I am finding nothing in my searches and no one I know has any idea, either. The compiler is choking on the square brackets. I've tried all kinds of different combinations, using curly braces, using the Array class, but nothing is working. Does anyone know this?

like image 993
Matt H Avatar asked Apr 17 '09 16:04

Matt H


People also ask

What is C in used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

Why do we use using in C#?

In C#, the using keyword has two purposes: The first is the using directive, which is used to import namespaces at the top of a code file. The second is the using statement. C# 8 using statements ensure that classes that implement the IDisposable interface call their dispose method.

Is C used nowadays?

There is at least one C compiler for almost every existent architecture. And nowadays, because of highly optimized binaries generated by modern compilers, it's not an easy task to improve on their output with hand written assembly.


1 Answers

According to the B.3.1 ID string format article, referencing an array is done with [square brackets] (with optional lowerbound:size specifiers) but if you just want to refer to an array of a certain type (or even an Object array), you can't just write

<see cref="Object[]"/>

instead you need to specify you're making a type reference with the T: prefix, like

<see cref="T:Object[]"/>

This does not seem to apply when referencing a specific overload of a method, such as

<seealso cref="String.Join(String, String[])"/>

like image 68
Olivier Dagenais Avatar answered Sep 18 '22 08:09

Olivier Dagenais