Determines whether the end of the first sequence is equivalent to the second sequence.
The following example checks whether the segments of a URL's path component end with a particular sequence or not:
var tail = new[] { "foo/", "bar/" };
var url1 = new Uri("http://example.com/foo/bar/");
WriteLine(url1.Segments.EndsWith(tail)); // True
var url2 = new Uri("http://example.com/foo/bar/baz/");
WriteLine(url2.Segments.EndsWith(tail)); // False
The same example as above is expressed as a single query expression below:
from url in new[]
{
"http://example.com/foo/bar/",
"http://example.com/foo/bar/baz/",
}
select new Uri(url) into url
select new
{
Url = url,
EndsWithFooBar = url.Segments.EndsWith(new[] { "foo/", "bar/" }),
}
For more details, see the documentation.
✏ Edit this page if you see a typo or wish to contribute an improvement. Alternatively, you can also report an issue you see.