BusinessMgr
This commit is contained in:
@@ -82,6 +82,21 @@ namespace Sarand.Net.Standard.Base.Utils
|
||||
dictToAdd.ForEach(x => dict[x.Key] = x.Value);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Removing
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Remove items from a dictionary that comply with the specified predicate.
|
||||
/// <para>- Ref. https://stackoverflow.com/questions/469202/best-way-to-remove-multiple-items-matching-a-predicate-from-a-net-dictionary</para>
|
||||
/// </summary>
|
||||
public static void RemoveAll<TKey, TValue>(this Dictionary<TKey, TValue> source,
|
||||
Predicate<KeyValuePair<TKey, TValue>> predicate)
|
||||
{
|
||||
foreach (var pair in source)
|
||||
if (predicate(pair))
|
||||
source.Remove(pair.Key);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Orderd Dictionary
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -179,6 +179,10 @@ namespace Sarand.Net.Standard.Base.Utils
|
||||
if (!IsBlank(value)) return value;
|
||||
return "";
|
||||
}
|
||||
public static String NullOnBlank(String value)
|
||||
{
|
||||
return StringUtil.IsBlank(value) ? null : value;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// C o n t e n t
|
||||
|
||||
Reference in New Issue
Block a user