using System; using System.Reflection; using System.Reflection.Emit; namespace System.Linq.Expressions { /// Represents initializing a field or property of a newly created object. // Token: 0x02000024 RID: 36 public sealed class MemberAssignment : MemberBinding { // Token: 0x06000216 RID: 534 RVA: 0x0000B888 File Offset: 0x00009A88 internal MemberAssignment(MemberInfo member, Expression expression) : base(MemberBindingType.Assignment, member) { this.expression = expression; } /// Gets the expression to assign to the field or property. /// The that represents the value to assign to the field or property. // Token: 0x17000023 RID: 35 // (get) Token: 0x06000217 RID: 535 RVA: 0x0000B89C File Offset: 0x00009A9C public Expression Expression { get { return this.expression; } } // Token: 0x06000218 RID: 536 RVA: 0x0000B8A4 File Offset: 0x00009AA4 internal override void Emit(EmitContext ec, LocalBuilder local) { base.Member.OnFieldOrProperty(delegate(FieldInfo field) { this.EmitFieldAssignment(ec, field, local); }, delegate(PropertyInfo prop) { this.EmitPropertyAssignment(ec, prop, local); }); } // Token: 0x06000219 RID: 537 RVA: 0x0000B8F0 File Offset: 0x00009AF0 private void EmitFieldAssignment(EmitContext ec, FieldInfo field, LocalBuilder local) { ec.EmitLoadSubject(local); this.expression.Emit(ec); ec.ig.Emit(OpCodes.Stfld, field); } // Token: 0x0600021A RID: 538 RVA: 0x0000B924 File Offset: 0x00009B24 private void EmitPropertyAssignment(EmitContext ec, PropertyInfo property, LocalBuilder local) { MethodInfo setMethod = property.GetSetMethod(true); if (setMethod == null) { throw new InvalidOperationException(); } ec.EmitLoadSubject(local); this.expression.Emit(ec); ec.EmitCall(setMethod); } // Token: 0x040000A9 RID: 169 private Expression expression; } }