I need to create an extension that completes Contains
Posted on 2011-02-16
How can I create an extension to convert a string in many conditions in the Where part of a Linq. Look at this example:
from x in data where x.name.MyFunction("john Mary")...
My function should translate this to:
from x in data where x.name.Contains("john") || x.name.Contains("Mary") ...
I belive that the extension is like this, but I'm stuck!
public MyFunction(string str)
foreach (var element in str.ToUpper().Split(" "))
Can someone help me?