given a delegate like
Func<string,string,string> MyFunc = (firstName,lastName) => string.Format("Given Name:{0} Surname:{1}",
firstName,
lastName);
How would you can you document the parameters of firstName and lastName, so they show up in intellisense (like method descriptions and parameters do)?
Example:
/// <summary>
/// My Method
/// </summary>
/// <param name="firstName">The first name.</param>
/// <param name="lastName">The last name.</param>
/// <returns></returns>
public string MyMethod(string firstName, string lastName)
{
return string.Format("Given Name:{0} Surname:{1}",firstName,lastName);
}
I want to hover over the delegate or have intellisense popup when I type and tell me the descriptions for the the delegate parameters, like it would with the above method.
A field of a delegate type is still a field and not a method—it doesn't take parameters in itself. The parameters belong to the delegate type, not the delegate field. You can write the comments for parameters when you delegate types if you want.
/// <summary>
/// Tests something.
/// </summary>
/// <param name="test">Something that's going to be tested.</param>
delegate void Test(int test);
Func<string,string,string>
is a general delegate for functions with three parameters. For specific purposes, you can always declare your own delegate type that represents the abstracted method more specifically and add comments to its parameters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With