I want to do something like this. I know it wrong:
var a = from h in xdoc.Root.Elements() where h.Element().value like = "1234" select h;
var a = from h in xdoc.Root.Elements() where h.Element.value.Contains("1234") select h
This will create a "LIKE" statement in the background.
I think you want to get the elements Contains value 1234 :
Contains
1234
var a = from h in xdoc.Root.Elements() where h.Element().Value.Contains("1234") // like '%1234%' select h;
For SQL-ish like '%value' you can use EndsWith and for like 'value%' StartsWith
like '%value'
like 'value%'
Use the String class helper methods such as StartsWith or EndsWith .
StartsWith
EndsWith
Here I am using the StartsWith () method to do the same.
var CountryNames = from city in xdoc.Descendants("countries").Elements("city") where city.Value.StartsWith(prefixText) select city.Value;