BO4E/UserPropertiesExtensions.cs
/// <summary>
///     Sets the <paramref name="value" /> as a UserProperty. If a property already exists, the value is overwritten, else
///     a new property is created
/// </summary>
/// <typeparam name="TUserProperty">
///     type expected to be found in the User Property with key
///     <paramref name="userPropertyKey" />
/// </typeparam>
/// <param name="userPropertyKey">key of the <paramref name="parent" />.UserProperties dictionary</param>
/// <typeparam name="TParent">class implementing <see cref="IUserProperties" /></typeparam>
/// <param name="parent">object implementing <see cref="IUserProperties" /></param>
/// <param name="value">Value of the property</param>
/// <returns></returns>
Sets the  as a UserProperty. If a property already exists, the value is overwritten, else
a new property is created
Sets the as a UserProperty . If a property already exists the value is overwritten else a new property is created
public static void SetUserProperty<TUserProperty, TParent>(this TParent parent, string userPropertyKey,
            TUserProperty value) where TParent : IUserProperties
        {
            if (parent.UserProperties == null) parent.UserProperties = new Dictionary<string, object>();
            if (parent.UserProperties.ContainsKey(userPropertyKey)) parent.UserProperties.Remove(userPropertyKey);
            parent.UserProperties.Add(userPropertyKey, value);
        }
public static void SetUserProperty < TUserProperty , TParent > ( this TParent parent , string userPropertyKey , TUserProperty value ) where TParent : IUserProperties { if ( parent . UserProperties == null ) parent . UserProperties = new Dictionary < string , object > ( ) ; if ( parent . UserProperties . ContainsKey ( userPropertyKey ) ) parent . UserProperties . Remove ( userPropertyKey ) ; parent . UserProperties . Add ( userPropertyKey , value ) ; }
Sets the  as a UserProperty.
Sets the as a UserProperty .
// if user properties don't exist already, create them // if there is already an value for the property, delete ist first // set the value
None
TParent
this
userPropertyKey
string
key of the .UserProperties dictionary
key of the . UserProperties dictionary
value
TUserProperty
Value of the property
Value of the property
parent
None
typeparam
type expected to be found in the User Property with key
type expected to be found in the User Property with key
typeparam
None