GenericUriParser(GenericUriParserOptions) 构造函数

定义

创建用于分层 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)

参数

options
GenericUriParserOptions

为此 GenericUriParser 指定选项。Specify the options for this GenericUriParser.

注解

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

如果要基于众所周知的方案创建分析器, 请使用HttpStyleUriParser GopherStyleUriParserFtpStyleUriParser LdapStyleUriParser、、或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.IriParsingElementSystem.Uri控制类中的 IRI 处理的配置设置间接控制。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.

适用于

另请参阅