![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Uri.EscapeDataString(String) Method in C#
The Uri.EscapeDataString() method in C# converts a string to its escaped representation.
Syntax
Following is the syntax −
public static string EscapeDataString (string str);
Above, the string str is the string to escape.
Example
Let us now see an example to implement the Uri.EscapeDataString() method −
using System; public class Demo { public static void Main(){ string URI1 = "https://www.tutorialspoint.com/index.htm"; Console.WriteLine("URI = "+URI1); string URI2 = "https://www.tutorialspoint.com/"; Console.WriteLine("URI = "+URI2); Console.WriteLine("
Escaped string (URI1) = "+Uri.EscapeDataString(URI1)); Console.WriteLine("Escaped string (URI2) = "+Uri.EscapeDataString(URI2)); } }
Output
This will produce the following output −
URI = https://www.tutorialspoint.com/index.htm URI = https://www.tutorialspoint.com/ Escaped string (URI1) = https%3A%2F%2Fwww.tutorialspoint.com%2Findex.htm Escaped string (URI2) = https%3A%2F%2Fwww.tutorialspoint.com%2F
Advertisements