BO4E/UserPropertiesExtensions.cs
/// <summary>
///     Apply <paramref name="evaluation" /> to the user property under <paramref name="userPropertyKey" /> if it exists
/// </summary>
/// <typeparam name="TUserProperty">type of the userproperty value</typeparam>
/// <typeparam name="TEvaluationResult">type of the expected result</typeparam>
/// <typeparam name="TParent">class implementing <see cref="IUserProperties" /></typeparam>
/// <param name="parent">object implementing <see cref="IUserProperties" /></param>
/// <param name="userPropertyKey">key under which the value is expected</param>
/// <param name="evaluation">function to generate result from key value if present</param>
/// <returns>result of <paramref name="evaluation" /> if the key exists, default otherwise</returns>
/// <exception cref="ArgumentNullException">iff <paramref name="userPropertyKey" /> is null or whitespace</exception>
Apply  to the user property under  if it exists
Apply to the user property under if it exists
public static TEvaluationResult EvaluateUserProperty<TUserProperty, TEvaluationResult, TParent>(
            this TParent parent, string userPropertyKey, Func<TUserProperty, TEvaluationResult> evaluation)
            where TParent : IUserProperties
        {
            var up = parent.UserProperties;
            if (up == null) throw new ArgumentNullException(nameof(up));
            return parent.TryGetUserProperty<TUserProperty, TParent>(userPropertyKey, out var value)
                ? evaluation(value)
                : default;
        }
public static TEvaluationResult EvaluateUserProperty < TUserProperty , TEvaluationResult , TParent > ( this TParent parent , string userPropertyKey , Func < TUserProperty , TEvaluationResult > evaluation ) where TParent : IUserProperties { var up = parent . UserProperties ; if ( up == null ) throw new ArgumentNullException ( nameof ( up ) ) ; return parent . TryGetUserProperty < TUserProperty , TParent > ( userPropertyKey , out var value ) ? evaluation ( value ) : default ; }
Apply  to the user property under  if it exists
Apply to the user property under if it exists
result of  if the key exists, default otherwise
result of if the key exists default otherwise
iff  is null or whitespace
iff is null or whitespace
TParent
this
userPropertyKey
string
key under which the value is expected
key under which the value is expected
evaluation
Func<TUserProperty, TEvaluationResult>
function to generate result from key value if present
function to generate result from key value if present
parent
None
typeparam
type of the userproperty value
type of the userproperty value
typeparam
type of the expected result
type of the expected result
typeparam
None