I need to add some additional query information to file path as query parameter to parse path later during files processing. I though that System.Uri class can help me with this, but it looks like it doesn't give me what I expected for local file paths.
var fileUri = new Uri("file:///c://a.txt?select=10")
// fileUri.AbsoluteUri = "file:///c://a.txt%3Fselect=10"
// fileUri.Query = ""
var httpUri = new Uri("http://someAddress/a.txt?select=10")
// httpUri.AbsoluteUri = "http://someaddress/a.txt?select=10"
// httpUri.Query = "?select=10"
In the case of "ftp://someAddress/a.txt?select=10" - query string is also empty
I understand that System.Uri probably resolves "a.txt?select=10" to correct file name "a.txt%3Fselect=10", but WHY - how to escape this?
Thanks in advance