Esempio n. 1
0
        public static void Bind <T>(this ImmutableUpdate update, T obj)
        {
            // todo - fix invalid stack-frame when optimized
            // var isCalledByImmutableUpdateCtor = new StackFrame(1).GetMethod() == ImmutableUpdateConstructor(typeof(T));
            // if (!isCalledByImmutableUpdateCtor)
            // {
            //     throw new InvalidOperationException($"You can call '{nameof(Bind)}' only from within an ImmutableUpdate constructor.");
            // }

            foreach (var(property, value) in update)
            {
                GetBackingField <T>(property.Name)?.SetValue(obj, value);
            }
        }
Esempio n. 2
0
 public UriString([NotNull] ImmutableUpdate update)
 {
     update.Bind(this);
 }