XText.Value Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit la valeur de ce nœud.
public:
property System::String ^ Value { System::String ^ get(); void set(System::String ^ value); };
public string Value { get; set; }
member this.Value : string with get, set
Public Property Value As String
Valeur de propriété
String qui contient la valeur de ce nœud.
Exemples
L’exemple suivant montre comment obtenir et définir cette propriété.
XElement root = new XElement("Root", "Some text");
XText txtNode = root.Nodes().OfType<XText>().First();
Console.WriteLine(txtNode.Value);
txtNode.Value = "New text";
Console.WriteLine(txtNode.Value);
root.Value = "Newer text";
txtNode = root.Nodes().OfType<XText>().First();
Console.WriteLine(txtNode.Value);
Dim root As XElement = <Root>Some text</Root>
Dim txtNode As XText = root.Nodes().OfType(Of XText).First()
Console.WriteLine(txtNode.Value)
txtNode.Value = "New text"
Console.WriteLine(txtNode.Value)
root.Value = "Newer text"
txtNode = root.Nodes().OfType(Of XText).First()
Console.WriteLine(txtNode.Value)
Cet exemple produit la sortie suivante :
Some text
New text
Newer text
Remarques
La définition de cette propriété déclenche les Changed événements et Changing .
S’applique à
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de l’année 2024, nous abandonnerons progressivement le mécanisme de retour d’information GitHub Issues pour le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultez :Soumettre et afficher des commentaires pour