tags:

views:

40

answers:

2

I have a Uri that contains a part of the path that i am putting in the if block. Its something like

if (absUri.AbsolutePath.Contains("W3C//DTD%20XHTML%201.1//EN"))

I want to replace .Contains part with something more reliable and robust as if there is some piece of string after //EN, even that will satisfy the if block. The whole path is something like this: C:/Users/a/desktop/fol/W3C//DTD%20XHTML%201.1//EN. Is there any method?

A: 

Well it shouldn't matter if there's something after the "//EN" as the string will still contain your search term.

You mention you want something more reliable & robust so what problem are you seeing?

As you've realised .EndsWith will fail if there is anything after the "//EN" or if that varies, but I don't think it's any more reliable than .Contains. In fact I'd expect them to be as reliable as each other.

ChrisF
+1  A: 

I was looking for something like .EndsWith i guess.