private static XmlQualifiedName GetXmlQualifiedName(CodeTypeDeclaration typeDeclaration)
        {
            var dataContractAttribute = typeDeclaration.GetDataContractAttribute();

            if (dataContractAttribute == null)
            {
                return(null);
            }

            string name;

            var dataContractNameArgument = dataContractAttribute.FindArgumentByName("Name");

            if (dataContractNameArgument != null)
            {
                name = CodeDomExtensions.GetStringValue(dataContractNameArgument);
            }
            else
            {
                name = typeDeclaration.Name;
            }

            var dataContractNamespaceArgument = dataContractAttribute.FindArgumentByName("Namespace");

            if (dataContractNamespaceArgument == null)
            {
                throw new Exception();
            }

            return(new XmlQualifiedName(name, CodeDomExtensions.GetStringValue(dataContractNamespaceArgument)));
        }