GenericUriParser(GenericUriParserOptions) GenericUriParser(GenericUriParserOptions) GenericUriParser(GenericUriParserOptions) GenericUriParser(GenericUriParserOptions) Constructor

定义

创建用于分层 URI 的可自定义分析器。Create a customizable parser for a hierarchical URI.

public:
 GenericUriParser(GenericUriParserOptions options);
public GenericUriParser (GenericUriParserOptions options);
new GenericUriParser : GenericUriParserOptions -> GenericUriParser
Public Sub New (options As GenericUriParserOptions)

参数

注解

使用此构造函数的参数 UriParser.Register(UriParser, String, Int32)Use this constructor as an argument to UriParser.Register(UriParser, String, Int32)

如果你想要创建一个分析器基于已知的方案,请使用HttpStyleUriParserFtpStyleUriParserGopherStyleUriParserLdapStyleUriParser,或NewsStyleUriParserIf you want to create a parser based on a well-known scheme, use HttpStyleUriParser, FtpStyleUriParser, GopherStyleUriParser, LdapStyleUriParser, or NewsStyleUriParser.

在创建可自定义分析器时,通过传递中的可用值的按位组合指定分析器行为System.GenericUriParserOptions枚举GenericUriParser构造函数。When creating a customizable parser, the behavior of the parser is specified by passing a bitwise combination of the values available in the System.GenericUriParserOptions enumeration to the GenericUriParser constructor.

现有System.Uri类进行了扩展以提供对国际资源标识符 (IRI) 和国际化域名 (IDN) 的支持。The existing System.Uri class has been extended to provide support for International Resource Identifiers (IRI) and Internationalized Domain Names (IDN). 除非当前用户专门启用 IRI,否则他们看不到任何 NET Framework 2.0 行为的改变。Current users will not see any change from the .NET Framework 2.0 behavior unless they specifically enable IRI. 这确保了 NET Framework 以前版本的应用程序兼容性。This ensures application compatibility with prior versions of the .NET Framework.

所有解析器派生自GenericUriParser不会默认情况下获得 IRI 和 IDN 支持。All parsers derived from GenericUriParser will not gain IRI and IDN support by default. Default选项不包括 IRI 和 IDN 支持。The Default option does not include IRI and IDN support. 两个新值添加到System.GenericUriParserOptions枚举,以指示自定义分析程序支持 IRI 和 IDN。Two new values are added to the System.GenericUriParserOptions enumeration to indicate if a custom parser supports IRI and IDN.

IriParsing 类型表示分析程序支持 RFC 3987 中为国际资源标识符 (IRI) 指定的分析规则。The IriParsing type indicates the parser supports the parsing rules specified in RFC 3987 for International Resource Identifiers (IRI). 是否使用 IRI 由配置值指定。Whether IRI is used is dictated by configuration values.

Idn 类型表示分析程序支持主机名的国际化域名 (IDN) 分析。The Idn type indicates the parser supports Internationalized Domain Name (IDN) parsing (IDN) of host names. 是否使用 IDN 由配置值指定。Whether IDN is used is dictated by configuration values.

配置设置System.Configuration.IdnElement间接受System.Configuration.IriParsingElement配置设置控制中的 IRI 处理System.Uri类。The configuration setting for the System.Configuration.IdnElement is indirectly controlled by the System.Configuration.IriParsingElement configuration setting that controls IRI processing in the System.Uri class. 必须启用 IRI 处理才能进行 IDN 处理。IRI processing must be enabled for IDN processing to be possible. 如果禁用 IRI,IDN 处理将被设置为默认值,这时 NET Framework 2.0 行为用于兼容性,并且 IDN 名称不可用。If IRI processing is disabled, then IDN processing will be set to the default setting where the .NET Framework 2.0 behavior is used for compatibility and IDN names are not used.

国际化域名 (IDN) 属性仅控制 IDN 处理。The Internationalized Domain Name (IDN) attribute only controls IDN processing. 默认情况下执行所有其他 IRI 处理 (例如字符规范化)。All other IRI processing (character normalization, for example) is performed by default.

IRI 和 IDN 支持的详细信息,请参阅备注部分System.Uri类。For more information on IRI and IDN support, see the Remarks section for the System.Uri class.

适用于

另请参阅