about the Uri relative path

F

fairyvoice

hi, i just want to know when i new a Uri instance using the UriKind.Relative
para in construtor, where is the root path, for example, a local file
Uri u=new Uri("a.txt",UriKind.Relative);
then where is it? I thought it would be in the "object\debug" directory
where the exe file exists but nope
Can anyone tell me? I just want to get some local file using Uri with
relative path.
Thx in advanced
 
P

Peter Ritchie [C# MVP]

When you create a Uri as Relative it doesn't have any context. You have to
provide the context by merging a Relative Uri with an Absolute Uri. Your Uri
only contains "a.txt" (and many of the properties will throw an exception if
you try to use them).

It's a way of using a method that takes a Uri parameter without providing a
string or an Absolute Uri.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top