Home » C#

C# | Uri.CheckSchemeName() Method with Example

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

Uri.CheckSchemeName() Method

Uri.CheckSchemeName() method is a static method that returns a boolean value, if the specified scheme is valid then it returns true otherwise it returns false.

Syntax:

    bool Uri.CheckSchemeName(string SchemeName);

Parameter(s):

  • string SchemeName – represents the specified SchemeName to be checked, it is valid or not.

Return value:

The return type of this method is Boolean, it returns a boolean value, if the specified scheme is valid then it returns true otherwise it returns false.

Example to demonstrate example of Uri.CheckSchemeName() method

using System;

class UriExample
{
    //Entry point of Program
    static public void Main()
    {
        bool isValid = false;

        Uri domainUri1;
        
        domainUri1 = new Uri("https://www.includehelp.com/index.html");
        
        isValid=Uri.CheckSchemeName(domainUri1.Scheme);
        if (isValid == true)
            Console.WriteLine("Valid Scheme");
        else
            Console.WriteLine("Invalid Scheme");
    }
}

Output

Valid Scheme


Comments and Discussions!

Load comments ↻





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