DataSet.Prefix 属性

定义

获取或设置一个 XML 前缀,该前缀是 DataSet 的命名空间的别名。

public:
 property System::String ^ Prefix { System::String ^ get(); void set(System::String ^ value); };
public string Prefix { get; set; }
[System.Data.DataSysDescription("DataSetPrefixDescr")]
public string Prefix { get; set; }
member this.Prefix : string with get, set
[<System.Data.DataSysDescription("DataSetPrefixDescr")>]
member this.Prefix : string with get, set
Public Property Prefix As String

属性值

String

DataSet 命名空间的 XML 前缀。

属性

示例

以下示例设置在 Prefix 调用 ReadXml 该方法之前。

private void ReadData(DataSet thisDataSet)
{
    thisDataSet.Namespace = "CorporationA";
    thisDataSet.Prefix = "DivisionA";

    // Read schema and data.
    string fileName = "CorporationA_Schema.xml";
    thisDataSet.ReadXmlSchema(fileName);
    fileName = "DivisionA_Report.xml";
    thisDataSet.ReadXml(fileName);
}
Private Sub ReadData(thisDataSet As DataSet)
    thisDataSet.Namespace = "CorporationA"
    thisDataSet.Prefix = "DivisionA"

    ' Read schema and data.
    Dim fileName As String = "CorporationA_Schema.xml"
    thisDataSet.ReadXmlSchema(fileName)
    fileName = "DivisionA_Report.xml"
    thisDataSet.ReadXml(fileName)
End Sub

注解

Prefix属性在整个 XML 文档中使用,用于标识属于由属性) 设置 (对象命名空间的DataSetNamespace元素。

适用于

另请参阅