I am curious about the Uri property:
public bool IsAbsoluteUri { get; }
Is it ever possible for it to be false? It doesn't seem that I can create a Uri that is not absolute. The latter (uriTwo) throws:
var uriOne = new Uri( "http://stackoverflow.com/about" );
var uriTwo = new Uri( "/about" );
Same seems to be true with the builder. What am I missing?
Yes. Try the following
var uri = new Uri("foo.jpg", UriKind.Relative);
Console.WriteLine(uri.IsAbsoluteUri); // prints false
You need to use another constructor that takes a UriKind
, for instance. The constructor that takes just a path assumes absolute kind.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With