Home » C#

C# | Uri.IsWellFormedOriginalString() Method with Example

Uri.IsWellFormedOriginalString() Method: Here, we are going to learn about the IsWellFormedOriginalString() method of Uri class with example in C#.
Submitted by Nidhi, on March 26, 2020

Uri.IsWellFormedOriginalString() Method

Uri.IsWellFormedOriginalString() method is used to check whether given Uri is well-formed or not, if Uri is well-formed, the method returns true otherwise it returns false.

Syntax:

    bool Uri.IsWellFormedOriginalString();

Parameter(s):

  • It does not accept any parameter.

Return value:

The return type of this method is boolean, it returns true if specified uri is well-formed, otherwise it returns false.

Exception:

    System.InvalidOperationException;

Example to demonstrate example of Uri.IsWellFormedOriginalString() method

using System;

class UriExample
{
    //Entry point of Program
    static public void Main()
    {
        // Create some Uri objects
        Uri uri = new Uri("https://www.includehelp.com/");
        
        if (uri.IsWellFormedOriginalString())
            Console.WriteLine("uri is well-formed.");
        else
            Console.WriteLine("uri is not well-formed.");
    }
}

Output

uri is well-formed.


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.