NuGet.Settings.GetValue C# (CSharp) Method

GetValue() public method

public GetValue ( string section, string key ) : string
section string
key string
return string
        public string GetValue(string section, string key)
        {
            if (String.IsNullOrEmpty(section))
            {
                throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "section");
            }

            if (String.IsNullOrEmpty(key))
            {
                throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key");
            }

            // Get the section and return null if it doesn't exist
            var sectionElement = GetSection(_config.Root, section);
            if (sectionElement == null)
            {
                return null;
            }
           
            // Get the add element that matches the key and return null if it doesn't exist
            var element = FindElementByKey(sectionElement, key);
            if (element == null)
            {
                return null;
            }

            // Return the optional value which if not there will be null;
            return element.GetOptionalAttributeValue("value");
        }