c# - Linq contains confusion -


I have seen something weird with linq and there is a method involved in it seems to be the method to call on .

  If the above code does not compile with the following error (myString.Contains (strVar, StringComparison.OrdinalIgnoreCase)) {// code here}  

The method argument can not be used by the estimation of 'System.Linq.Enumerable.Contains (System.Collections.Generic.IEnumerable, TSource, System.Collections.Generic. Equipment Comparator)' for the method. is. Try specifying type arguments explicitly.

If I am using the linq statement, then it is happy with (but not all Linux code breaks).

What is the correct syntax to say is the compiler I want to use string. Custom method and not Linq?

Cheers

This is because no is not a string. Accumulation (string, string comparison) The method defined by the BCL and the compiler tries to use an extension method. Only the method is fixed.


Comments

Popular posts from this blog

c++ - QtQuick: QQmlApplicationEngine failed to load component qrc:/main.qml:23 Invalid attached object assignment -

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -