using System; using System.Reflection; using System.Reflection.Emit; namespace System.Linq.Expressions { /// Provides the base class from which the classes that represent bindings that are used to initialize members of a newly created object derive. // Token: 0x02000025 RID: 37 public abstract class MemberBinding { /// Initializes a new instance of the class. /// The that discriminates the type of binding that is represented. /// The that represents a field or property to be initialized. // Token: 0x0600021B RID: 539 RVA: 0x0000B960 File Offset: 0x00009B60 protected MemberBinding(MemberBindingType binding_type, MemberInfo member) { this.binding_type = binding_type; this.member = member; } /// Gets the type of binding that is represented. /// One of the values. // Token: 0x17000024 RID: 36 // (get) Token: 0x0600021C RID: 540 RVA: 0x0000B978 File Offset: 0x00009B78 public MemberBindingType BindingType { get { return this.binding_type; } } /// Gets the field or property to be initialized. /// The that represents the field or property to be initialized. // Token: 0x17000025 RID: 37 // (get) Token: 0x0600021D RID: 541 RVA: 0x0000B980 File Offset: 0x00009B80 public MemberInfo Member { get { return this.member; } } /// Returns a textual representation of the . /// A textual representation of the . // Token: 0x0600021E RID: 542 RVA: 0x0000B988 File Offset: 0x00009B88 public override string ToString() { return ExpressionPrinter.ToString(this); } // Token: 0x0600021F RID: 543 internal abstract void Emit(EmitContext ec, LocalBuilder local); // Token: 0x06000220 RID: 544 RVA: 0x0000B990 File Offset: 0x00009B90 internal LocalBuilder EmitLoadMember(EmitContext ec, LocalBuilder local) { ec.EmitLoadSubject(local); return this.member.OnFieldOrProperty((FieldInfo field) => this.EmitLoadField(ec, field), (PropertyInfo prop) => this.EmitLoadProperty(ec, prop)); } // Token: 0x06000221 RID: 545 RVA: 0x0000B9E0 File Offset: 0x00009BE0 private LocalBuilder EmitLoadProperty(EmitContext ec, PropertyInfo property) { MethodInfo getMethod = property.GetGetMethod(true); if (getMethod == null) { throw new NotSupportedException(); } LocalBuilder localBuilder = ec.ig.DeclareLocal(property.PropertyType); ec.EmitCall(getMethod); ec.ig.Emit(OpCodes.Stloc, localBuilder); return localBuilder; } // Token: 0x06000222 RID: 546 RVA: 0x0000BA2C File Offset: 0x00009C2C private LocalBuilder EmitLoadField(EmitContext ec, FieldInfo field) { LocalBuilder localBuilder = ec.ig.DeclareLocal(field.FieldType); ec.ig.Emit(OpCodes.Ldfld, field); ec.ig.Emit(OpCodes.Stloc, localBuilder); return localBuilder; } // Token: 0x040000AA RID: 170 private MemberBindingType binding_type; // Token: 0x040000AB RID: 171 private MemberInfo member; } }