C# Uri IsWellFormedUriString

In this chapter you will learn:

  1. Get to know Uri.IsWellFormedUriString
  2. Syntax for Uri.IsWellFormedUriString
  3. Parameter for Uri.IsWellFormedUriString
  4. Returns for Uri.IsWellFormedUriString
  5. Example - Uri.IsWellFormedUriString

Description

Uri IsWellFormedUriString indicates whether the string is well-formed by attempting to construct a URI with the string and ensures that the string does not require further escaping.

Syntax

Uri.IsWellFormedUriString has the following syntax.


public static bool IsWellFormedUriString(
  string uriString,
  UriKind uriKind
)

Parameters

Uri.IsWellFormedUriString has the following parameters.

  • uriString - The string used to attempt to construct a Uri.
  • uriKind - The type of the Uri in uriString.

Returns

Uri.IsWellFormedUriString method returns A Boolean value that is true if the string was well-formed; else false.

Example


using System;//  w  w w  .  j  a  v  a  2s.  c  om
public class MainClass{
  public static void Main(String[] argv){  
    // Create Uri
    Uri uriAddress = new Uri("http://www.java2s.com/index.htm#search");
    Console.WriteLine(uriAddress.IsWellFormedUriString);
  }
}

Next chapter...

What you will learn in the next chapter:

  1. Get to know Uri.MakeRelative
  2. Syntax for Uri.MakeRelative
  3. Parameter for Uri.MakeRelative
  4. Returns for Uri.MakeRelative
  5. Example - Uri.MakeRelative