The System.Uri
constructor has the ability to parse full file paths and turn them into URI style paths. So you can just do the following:
var uri = new System.Uri("c:\\foo");
var converted = uri.AbsoluteUri;
More Related Contents:
- C# getting the path of %AppData%
- Get current folder path
- Path.Combine for URLs?
- How to check whether a string is a valid HTTP URL?
- Unrecognized escape sequence for path string containing backslashes
- Access to the path is denied
- Better way to check if a Path is a File or a Directory?
- Relocating app.config file to a custom path
- How can I compare (directory) paths in C#?
- Absolute path back to web-relative path
- Check whether a path is valid
- Path.Combine absolute with relative path strings
- Get individual query parameters from Uri [duplicate]
- Invalid URI: The format of the URI could not be determined
- How to check that a uri string is valid
- Access to the path is denied when saving image
- Method to determine if path string is local or remote machine
- Extracting Path from OpenFileDialog path/filename
- Transactions in .net
- How do I deserialize a complex JSON object in C# .NET?
- How to tell Json.Net globally to apply the StringEnumConverter to all enums
- How can I bring my application window to the front? [duplicate]
- Why isn’t my public property serialized by the XmlSerializer?
- Using Razor outside of MVC in .NET Core
- Calling a Javascript function in the C# webBrowser control
- Identifying active network interface
- Why only literal strings saved in the intern pool by default?
- What do ref, val and out mean on method parameters?
- BsonSerializationException when serializing a Dictionary to BSON
- How can I detect when Windows 10 enters tablet mode in a Windows Forms application?