public XElement Serialize() { var result = new XElement(Constants.XMLNamespaces.SAMLP + "Request", new XAttribute(XNamespace.Xmlns + "samlp", Constants.XMLNamespaces.SAMLP), new XAttribute(XNamespace.Xmlns + "ds", Constants.XMLNamespaces.DS), new XAttribute(XNamespace.Xmlns + "saml", Constants.XMLNamespaces.SAML), new XAttribute("IssueInstant", IssueInstant.ToUTCString()), new XAttribute("MajorVersion", MajorVersion), new XAttribute("MinorVersion", MinorVersion), new XAttribute("RequestID", RequestId)); if (Signature != null) { result.Add(Signature.Serialize()); } if (AttributeQuery != null) { result.Add(AttributeQuery.Serialize()); } return(result); }