XElement with colon in the name doesn't work [duplicate]
问题 This question already has answers here : XElement namespaces (How to?) (2 answers) Closed 5 years ago . i'm trying to make something like : new XElement("media:thumbnail", new XAttribute("width", "")) but i doesn't work, and i got a error because of the colon ':'. does anyone know how can I solve the problem ? 回答1: That's not how you create an XName with a namespace. You should create an XNamespace with the right URI, and then you can create the right XName easily - personally I use the +