Resolver fail to detect invalid method call

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 10 years ago by Nicolas
Version: 13.2.0590
Platform: .NET 4.5
Environment: Windows 7 (64-bit)

Considering a class "MyClass" having a string member "MyStringField".

The C# code below is invalid because method Sum<T>(Func<T,string>) doesn't exist.

IEnumerable<MyClass> myCollection;

var result = myCollection.Sum(myClassInstance => myClassInstance.MyStringField)

But the SyntaxEditor C# resolver say that "Sum" correspond to the extension method Enumerable.Sum<MyClass>(Func<MyClass,int>) and that variable "result" is of type "int" !?!

Comments (1)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Nicolas,

If it fails to find an overload with the exact parameter types it will fall back and assume you mean another overload with the same method name, but with the closest available parameters.  That is by design.

Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.