resharper suggestions in common project

This commit is contained in:
Luke Pulverenti
2013-04-10 11:38:23 -04:00
parent 70da0b6ae9
commit 7806ccd42f
12 changed files with 47 additions and 269 deletions

View File

@@ -12,37 +12,6 @@ namespace MediaBrowser.Common.Extensions
/// </summary>
public static class BaseExtensions
{
/// <summary>
/// Tries the add.
/// </summary>
/// <typeparam name="TKey">The type of the T key.</typeparam>
/// <typeparam name="TValue">The type of the T value.</typeparam>
/// <param name="dictionary">The dictionary.</param>
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
public static bool TryAdd<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, TValue value)
{
if (dictionary.ContainsKey(key))
{
return false;
}
dictionary.Add(key, value);
return true;
}
/// <summary>
/// Provides an additional overload for string.split
/// </summary>
/// <param name="val">The val.</param>
/// <param name="separator">The separator.</param>
/// <param name="options">The options.</param>
/// <returns>System.String[][].</returns>
public static string[] Split(this string val, char separator, StringSplitOptions options)
{
return val.Split(new[] { separator }, options);
}
/// <summary>
/// Strips the HTML.
@@ -55,17 +24,6 @@ namespace MediaBrowser.Common.Extensions
const string pattern = @"<(.|\n)*?>";
return Regex.Replace(htmlString, pattern, string.Empty).Trim();
}
/// <summary>
/// Shuffles an IEnumerable
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="list">The list.</param>
/// <returns>IEnumerable{``0}.</returns>
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> list)
{
return list.OrderBy(x => Guid.NewGuid());
}
/// <summary>
/// Gets the M d5.