XProcessingInstruction.Data 屬性

定義

取得或設定這個處理指示的字串值。

public:
 property System::String ^ Data { System::String ^ get(); void set(System::String ^ value); };
public string Data { get; set; }
member this.Data : string with get, set
Public Property Data As String

屬性值

String,其中包含這個處理指示的字串值。

例外狀況

字串 valuenull

範例

下列範例會 Data 使用 屬性來擷取處理指示的字串值。

XProcessingInstruction pi =  
    new XProcessingInstruction("xml-stylesheet", "type='text/xsl' href='hello.xsl'");  
Console.WriteLine(pi.Data);  
pi.Data = "type='text/xsl' href='xform.xsl'";  
Console.WriteLine(pi.Data);  
Dim pi As XProcessingInstruction = <?xml-stylesheet type='text/xsl' href='hello.xsl'?>  
Console.WriteLine(pi.Data)  
pi.Data = "type='text/xsl' href='xform.xsl'"  
Console.WriteLine(pi.Data)  

這個範例會產生下列輸出:

type='text/xsl' href='hello.xsl'  
type='text/xsl' href='xform.xsl'  

備註

您可以使用這個屬性來修改 XML 樹狀結構。 這個屬性會導致事件發生。

適用於

另請參閱