Question: I have two Uri objects passed into some code, one is a directory and the other is a filename (or a relative path)

```
var a = new Uri("file:///C:/Some/Dirs");
var b = new Uri("some.file");

```

when I try and combine them like this:

```
var c = new Uri(a,b);

```

I get 

> 
> `file:///C:/Some/some.file`
> 
> 
> 

where I wold expect to get the same effect as with `Path.Combine` (as that is the old code I need to replace):

> 
> `file:///C:/Some/Dirs/some.file`
> 
> 
> 

I can't think of a clean solution to this.

The ugly solution being to add a `/` to the Uri if it's not there

```
string s = a.OriginalString;
if(s[s.Length-1] != '/')
   a = new Uri(s + "/");

```

Answer: 
This should do the trick for you:

```
var baseUri = new Uri("http://www.briankeating.net");
var absoluteUri = new Uri(baseUri, "/api/GetDefinitions");

```

This [constructor](https://msdn.microsoft.com/en-us/library/vstudio/9hst1w91(v=vs.100).aspx) follow the standard relative URI rules so the `/` are important :

* `http://example.net` + `foo` = `http://example.net/foo`
* `http://example.net/foo/bar` + `baz` = `http://example.net/foo/baz`
* `http://example.net/foo/` + `bar` = `http://example.net/foo/bar`
* `http://example.net/foo` + `bar` = `http://example.net/bar`
* `http://example.net/foo/bar/` + `/baz` = `http://example.net/baz`
Why not just inherit from Uri and use that, ie. do in constructor what you need to do to fix it up? Refactoring is cheap assuming this is internal to assembly or within reach..