博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
c# uri.host_C#| Uri.CheckHostName()方法与示例
阅读量:2529 次
发布时间:2019-05-11

本文共 1749 字,大约阅读时间需要 5 分钟。

c# uri.host

Uri.CheckHostName()方法 (Uri.CheckHostName() Method)

Uri.CheckHostName() method is a static method that returns the object of UriHostNameType enum than we need to compare returned enum object with UriHostNameType.Dns. If both are equal then the condition will be true otherwise it will be false.

Uri.CheckHostName()方法是一个静态方法,该方法返回UriHostNameType枚举的对象, 不是我们需要将返回的枚举对象与UriHostNameType.Dns进行比较。 如果两者相等,则条件为true,否则为false

Syntax:

句法:

UriHostNameType Uri.CheckHostName(string Hostname);

Parameter(s):

参数:

  • string Hostname – represents the hostname to be checked, whether it is valid or not.

    字符串Hostname –表示要检查的主机名,无论它是否有效。

Return value:

返回值:

The return type of this method is UriHostNameType, it returns an object of UriHostNameType enum, that is compared with UriHostNameType.Dns to check DNS is valid or not.

此方法的返回类型为UriHostNameType ,它返回UriHostNameType枚举的对象,该对象与UriHostNameType.Dns进行比较以检查DNS是否有效。

Example to demonstrate example of Uri.CheckHostName() method

演示Uri.CheckHostName()方法示例的示例

using System;class UriExample{
//Entry point of Program static public void Main() {
UriHostNameType hostNameType; hostNameType =Uri.CheckHostName("www.includehelp.com"); if (hostNameType == UriHostNameType.Dns) {
Console.WriteLine("It is valid DNS"); } else {
Console.WriteLine("It is not valid DNS"); } hostNameType = Uri.CheckHostName("www.includehelp!com"); if (hostNameType == UriHostNameType.Dns) {
Console.WriteLine("It is valid DNS"); } else {
Console.WriteLine("It is not valid DNS"); } }}

Output

输出量

It is valid DNSIt is not valid DNS

翻译自:

c# uri.host

转载地址:http://zuxzd.baihongyu.com/

你可能感兴趣的文章
“==”运算符与equals()
查看>>
单工、半双工和全双工的定义
查看>>
Hdu【线段树】基础题.cpp
查看>>
时钟系统
查看>>
BiTree
查看>>
5个基于HTML5的加载动画推荐
查看>>
水平权限漏洞的修复方案
查看>>
静态链接与动态链接的区别
查看>>
Android 关于悬浮窗权限的问题
查看>>
如何使用mysql
查看>>
linux下wc命令详解
查看>>
敏捷开发中软件测试团队的职责和产出是什么?
查看>>
在mvc3中使用ffmpeg对上传视频进行截图和转换格式
查看>>
python的字符串内建函数
查看>>
Spring - DI
查看>>
微软自己的官网介绍 SSL 参数相关
查看>>
Composite UI Application Block (CAB) 概念和术语
查看>>
64位MATLAB和C混合编程以及联合调试
查看>>
原生js大总结二
查看>>
PHP基础
查看>>