BusinessMgr

This commit is contained in:
Andy Howard
2024-11-19 09:48:13 +00:00
parent a7ae1c1762
commit 804a3bd853
12 changed files with 203 additions and 66 deletions
@@ -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