Created
April 24, 2018 15:09
-
-
Save peta/5e95d4b05064e101daa47f264a3668b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Xrm.Sdk; | |
namespace Foo.CRM.Integration.Data.Helper | |
{ | |
public static class XrmSdkExtensions | |
{ | |
/// <summary> | |
/// Retrieve formatted value for given key and optionally return default value when key was not found in collection. This method will | |
/// not yield any exceptions when a requested key was not found. | |
/// </summary> | |
/// <param name="collection"></param> | |
/// <param name="key" type="string"></param> | |
/// <param name="defaultValue" type="string"></param> | |
/// <returns></returns> | |
public static string GetValue(this FormattedValueCollection collection, string key, string defaultValue = default(string)) | |
{ | |
string value; | |
return collection.TryGetValue(key, out value) ? value : defaultValue; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment