Convert file path to file URL

A very short note: I was trying to find an analogue to Java’s File.toURI().toURL() method in .NET, looking through System.IO et al, and not finding it on the lazyweb. To my surprise, all you need use is UriBuilder: new UriBuilder(@”c:\path\to\file.txt”).ToString(); This will output “file://c:/path/to/file.txt“. Simple, but far too much time wasted finding it…


*Reset*

I originally started this blog as a way to push back some of the discoveries I had to the wider community in the hope that it would help prevent others making my (countless) mistakes. Who knows if the second try will work…