Beispiel #1
0
        private string GetPrefix()
        {
            XElement e = _source as XElement;

            if (e != null)
            {
                string prefix = e.GetPrefixOfNamespace(e.Name.Namespace);
                if (prefix != null)
                {
                    return(prefix);
                }
                return(string.Empty);
            }
            XAttribute a = _source as XAttribute;

            if (a != null)
            {
                if (_parent != null)
                {
                    return(string.Empty); // backcompat
                }
                string prefix = a.GetPrefixOfNamespace(a.Name.Namespace);
                if (prefix != null)
                {
                    return(prefix);
                }
            }
            return(string.Empty);
        }
        private string GetPrefix()
        {
            XElement source = this.source as XElement;

            if (source != null)
            {
                string prefixOfNamespace = source.GetPrefixOfNamespace(source.Name.Namespace);
                if (prefixOfNamespace != null)
                {
                    return(prefixOfNamespace);
                }
                return(string.Empty);
            }
            XAttribute attribute = this.source as XAttribute;

            if (attribute != null)
            {
                if (this.parent != null)
                {
                    return(string.Empty);
                }
                string str2 = attribute.GetPrefixOfNamespace(attribute.Name.Namespace);
                if (str2 != null)
                {
                    return(str2);
                }
            }
            return(string.Empty);
        }