summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs')
-rw-r--r--src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs55
1 files changed, 36 insertions, 19 deletions
diff --git a/src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs b/src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs
index e0f2b08..0dfa5d6 100644
--- a/src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs
+++ b/src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs
@@ -9,37 +9,54 @@ namespace DotNetOpenAuth.AspNet.Clients {
using System.Collections.Generic;
using System.Xml.Linq;
+ /// <summary>
+ /// The dictionary extensions.
+ /// </summary>
internal static class DictionaryExtensions {
+ #region Public Methods and Operators
+
+ /// <summary>
+ /// Adds the value from an XDocument with the specified element name if it's not empty.
+ /// </summary>
+ /// <param name="dictionary">
+ /// The dictionary.
+ /// </param>
+ /// <param name="document">
+ /// The document.
+ /// </param>
+ /// <param name="elementName">
+ /// Name of the element.
+ /// </param>
+ public static void AddDataIfNotEmpty(
+ this Dictionary<string, string> dictionary, XDocument document, string elementName) {
+ var element = document.Root.Element(elementName);
+ if (element != null) {
+ dictionary.AddItemIfNotEmpty(elementName, element.Value);
+ }
+ }
+
/// <summary>
/// Adds a key/value pair to the specified dictionary if the value is not null or empty.
/// </summary>
- /// <param name="dictionary">The dictionary.</param>
- /// <param name="key">The key.</param>
- /// <param name="value">The value.</param>
+ /// <param name="dictionary">
+ /// The dictionary.
+ /// </param>
+ /// <param name="key">
+ /// The key.
+ /// </param>
+ /// <param name="value">
+ /// The value.
+ /// </param>
public static void AddItemIfNotEmpty(this IDictionary<string, string> dictionary, string key, string value) {
if (key == null) {
throw new ArgumentNullException("key");
}
- if (!String.IsNullOrEmpty(value)) {
+ if (!string.IsNullOrEmpty(value)) {
dictionary[key] = value;
}
}
- /// <summary>
- /// Adds the value from an XDocument with the specified element name if it's not empty.
- /// </summary>
- /// <param name="dictionary">The dictionary.</param>
- /// <param name="document">The document.</param>
- /// <param name="elementName">Name of the element.</param>
- public static void AddDataIfNotEmpty(
- this Dictionary<string, string> dictionary,
- XDocument document,
- string elementName) {
- var element = document.Root.Element(elementName);
- if (element != null) {
- dictionary.AddItemIfNotEmpty(elementName, element.Value);
- }
- }
+ #endregion
}
}