XName.ToString Méthode
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.
Retourne le nom XML développé au format {namespace}localname
.
public:
override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String
Retours
String qui contient le nom XML développé au format {namespace}localname
.
Exemples
L’exemple suivant appelle WriteLine, en passant un XName. Cela entraîne l’appel de la ToString méthode.
XNamespace ns = "http://www.adventure-works.com";
XElement root = new XElement(ns + "Root", "content");
Console.WriteLine(root.Name);
Console.WriteLine(root.Name.LocalName);
Console.WriteLine(root.Name.Namespace);
Imports <xmlns="http://www.adventure-works.com">
Module Module1
Sub Main()
Dim root As XElement = <Root>content</Root>
Console.WriteLine(root.Name)
Console.WriteLine(root.Name.LocalName)
Console.WriteLine(root.Name.Namespace)
End Sub
End Module
Cet exemple produit la sortie suivante :
{http://www.adventure-works.com}Root
Root
http://www.adventure-works.com
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