public static XAttribute CreateNamespaceAttribute(XName name, XNamespace ns) { XAttribute xattribute = new XAttribute(name, (object) ns.NamespaceName); xattribute.AddAnnotation((object) ns); return xattribute; }