语言

XamlReader.Parse 方法

定义

读取指定文本字符串中的标记,并返回与指定标记的根对应的对象。

重载

名称 说明
Parse(String, ParserContext)

读取指定文本字符串(使用指定的 ParserContext)中的 XAML 标记,并返回与指定标记的根对应的对象。

Parse(String)

读取指定文本字符串中的 XAML 输入,并返回与指定标记的根对应的对象。

Parse(String, Boolean)

读取指定文本字符串中的 XAML 输入,并返回相应对象树的根。

Parse(String, ParserContext, Boolean)

使用指定的 ParserContext 文本字符串读取 XAML 输入,并返回相应对象树的根。

Parse(String, ParserContext)

读取指定文本字符串(使用指定的 ParserContext)中的 XAML 标记,并返回与指定标记的根对应的对象。

public:
 static System::Object ^ Parse(System::String ^ xamlText, System::Windows::Markup::ParserContext ^ parserContext);
public static object Parse(string xamlText, System.Windows.Markup.ParserContext parserContext);
static member Parse : string * System.Windows.Markup.ParserContext -> obj
Public Shared Function Parse (xamlText As String, parserContext As ParserContext) As Object

参数

xamlText
String

输入 XAML 作为单个文本字符串。

parserContext
ParserContext

分析器使用的上下文信息。

返回

所创建对象树的根。

注解

从字符串创建流后,实现在内部调用 Load 。 请参阅 Load 其他信息,例如可能的异常。

适用于

Parse(String)

读取指定文本字符串中的 XAML 输入,并返回与指定标记的根对应的对象。

public:
 static System::Object ^ Parse(System::String ^ xamlText);
public static object Parse(string xamlText);
static member Parse : string -> obj
Public Shared Function Parse (xamlText As String) As Object

参数

xamlText
String

输入 XAML 作为单个文本字符串。

返回

所创建对象树的根。

注解

从字符串创建流后,实现在内部调用 Load 。 请参阅 Load 其他信息,例如可能的异常。

适用于

Parse(String, Boolean)

读取指定文本字符串中的 XAML 输入,并返回相应对象树的根。

public:
 static System::Object ^ Parse(System::String ^ xamlText, bool useRestrictiveXamlReader);
public static object Parse(string xamlText, bool useRestrictiveXamlReader);
static member Parse : string * bool -> obj
Public Shared Function Parse (xamlText As String, useRestrictiveXamlReader As Boolean) As Object

参数

xamlText
String

XAML 输入,作为单个文本字符串。

useRestrictiveXamlReader
Boolean

true 限制潜在危险类型的实例化;否则,为 false.

返回

所创建对象树的根。

例外

xamlText 是 null。

注解

限制模式是深层防御措施。 不要将不受信任的 XAML 的限制性分析视为安全或替代低特权沙盒中的隔离。

适用于

Parse(String, ParserContext, Boolean)

使用指定的 ParserContext 文本字符串读取 XAML 输入,并返回相应对象树的根。

public:
 static System::Object ^ Parse(System::String ^ xamlText, System::Windows::Markup::ParserContext ^ parserContext, bool useRestrictiveXamlReader);
public static object Parse(string xamlText, System.Windows.Markup.ParserContext parserContext, bool useRestrictiveXamlReader);
static member Parse : string * System.Windows.Markup.ParserContext * bool -> obj
Public Shared Function Parse (xamlText As String, parserContext As ParserContext, useRestrictiveXamlReader As Boolean) As Object

参数

xamlText
String

XAML 输入,作为单个文本字符串。

parserContext
ParserContext

分析器使用的上下文信息。

useRestrictiveXamlReader
Boolean

true 限制潜在危险类型的实例化;否则,为 false.

返回

所创建对象树的根。

例外

xamlText 是 null。

注解

限制模式是深层防御措施。 不要将不受信任的 XAML 的限制性分析视为安全或替代低特权沙盒中的隔离。

适用于