NuGet.Settings.GetOrCreateSection C# (CSharp) Method

GetOrCreateSection() private static method

private static GetOrCreateSection ( System.Xml.Linq.XElement parentElement, string sectionName ) : System.Xml.Linq.XElement
parentElement System.Xml.Linq.XElement
sectionName string
return System.Xml.Linq.XElement
        private static XElement GetOrCreateSection(XElement parentElement, string sectionName)
        {
            sectionName = XmlConvert.EncodeLocalName(sectionName);
            var section = parentElement.Element(sectionName);
            if (section == null)
            {
                section = new XElement(sectionName);
                parentElement.Add(section);
            }
            return section;
        }