summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-03-01 22:55:03 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2012-03-01 23:19:26 -0800
commit198bffe042a3650095b27bed29d0f8c98bc5c926 (patch)
treebc1b2178b73d4303221ac48d320c758751abe5e9 /src/DotNetOpenAuth.AspNet/Clients/DictionaryExtensions.cs
parent6bc4c6db7529501e8a2c0b7fa54a24fb8e4dbf42 (diff)
downloadDotNetOpenAuth-198bffe042a3650095b27bed29d0f8c98bc5c926.zip
DotNetOpenAuth-198bffe042a3650095b27bed29d0f8c98bc5c926.tar.gz
DotNetOpenAuth-198bffe042a3650095b27bed29d0f8c98bc5c926.tar.bz2
ReSharper code cleanup to help get this AspNet contribution into StyleCop compliance.
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
}
}