Uri.CheckSchemeName(String) Method is used to determine whether the specified scheme name is valid or not.
Syntax: public static bool CheckSchemeName (string schemeName);
Here, it takes the scheme name to validate.Return Value: This method returns a Boolean value true if the scheme name is valid otherwise, false.
Below programs illustrate the use of Uri.CheckSchemeName() Method:
Example 1:
// C# program to demonstrate the // Uri.CheckSchemeName(string) Method using System;
using System.Globalization;
class GFG {
// Main Method
public static void Main()
{
// Declaring and initializing Uri
// Determining the Scheme of the Uri
string scheme = uri.Scheme;
// using CheckSchemeName() method
bool value = Uri.CheckSchemeName(scheme);
// Displaying the result
if (value)
Console.WriteLine( "Scheme name is valid" );
else
Console.WriteLine( "Scheme name is invalid" );
}
} |
Output:
Scheme name is valid
Example 2:
// C# program to demonstrate the // Uri.CheckSchemeName(string) Method using System;
using System.Globalization;
class GFG {
// Main Method
public static void Main()
{
// Declaring and initializing Uri
// Determining the Scheme of the Uri
string scheme = uri.Scheme;
// using CheckSchemeName() method
bool value = Uri.CheckSchemeName(scheme);
// Displaying the result
if (value)
Console.WriteLine( "Scheme name is valid" );
else
Console.WriteLine( "Scheme name is invalid" );
}
} |
Output:
Scheme name is valid
Reference: