[324] Type Argument Specification is Redundant
We have the following function in our code base.
public static ReadOnlyCollection ToBo(ReadOnlyCollection items) where T : BusinessObject
{
Converter converter =
new Converter(delegate(T t) { return t as BusinessObject; });
List list = new List(items);
return new ReadOnlyCollection(list.ConvertAll(converter).ToArray());
}
324 is showing me that the type argument specification is redundant in the last line - the list.ConvertAll where is marked as redundant.
I cannot find a List]]>.ConvertAll() that is not generic. Could someone tell me why the type specifier is redundant, please?
Thanks
Sean
Please sign in to leave a comment.
The type argument specifier in invocation is redundant if it could be
inferred from the actual parameter types.
Please refer to C# specs (ECMA-334) part "25.6.4 Inference of type
arguments"
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"sean kearon" <no_reply@jetbrains.com> wrote in message
news:16612512.1165857442551.JavaMail.itn@is.intellij.net...
>
>
>
>
>
Thanks for the quick response, Eugene. I learn quite a lot of new things from using R#.......which is a nice side-benefit :)
Thanks
Sean