using System;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Reflection.Emit;
namespace System.Linq.Expressions
{
/// Represents an initializer for a single element of an collection.
// Token: 0x02000018 RID: 24
public sealed class ElementInit
{
// Token: 0x06000160 RID: 352 RVA: 0x00009110 File Offset: 0x00007310
internal ElementInit(MethodInfo add_method, ReadOnlyCollection arguments)
{
this.add_method = add_method;
this.arguments = arguments;
}
/// Gets the instance method that is used to add an element to an collection.
/// A that represents an instance method that adds an element to a collection.
// Token: 0x1700001B RID: 27
// (get) Token: 0x06000161 RID: 353 RVA: 0x00009128 File Offset: 0x00007328
public MethodInfo AddMethod
{
get
{
return this.add_method;
}
}
/// Gets the collection of arguments that are passed to a method that adds an element to an collection.
/// A of objects that represent the arguments for a method that adds an element to a collection.
// Token: 0x1700001C RID: 28
// (get) Token: 0x06000162 RID: 354 RVA: 0x00009130 File Offset: 0x00007330
public ReadOnlyCollection Arguments
{
get
{
return this.arguments;
}
}
/// Returns a textual representation of an object.
/// A textual representation of the object.
// Token: 0x06000163 RID: 355 RVA: 0x00009138 File Offset: 0x00007338
public override string ToString()
{
return ExpressionPrinter.ToString(this);
}
// Token: 0x06000164 RID: 356 RVA: 0x00009140 File Offset: 0x00007340
private void EmitPopIfNeeded(EmitContext ec)
{
if (this.add_method.ReturnType == typeof(void))
{
return;
}
ec.ig.Emit(OpCodes.Pop);
}
// Token: 0x06000165 RID: 357 RVA: 0x00009170 File Offset: 0x00007370
internal void Emit(EmitContext ec, LocalBuilder local)
{
ec.EmitCall(local, this.arguments, this.add_method);
this.EmitPopIfNeeded(ec);
}
// Token: 0x04000062 RID: 98
private MethodInfo add_method;
// Token: 0x04000063 RID: 99
private ReadOnlyCollection arguments;
}
}