internal override void GenerateMethodBody(TypeCompilationState compilationState, DiagnosticBag diagnostics) { // Method body: // // { // Object..ctor(); // this.backingField_1 = arg1; // ... // this.backingField_N = argN; // } SyntheticBoundNodeFactory F = this.CreateBoundNodeFactory(compilationState, diagnostics); int paramCount = this.ParameterCount; // List of statements BoundStatement[] statements = new BoundStatement[paramCount + 2]; int statementIndex = 0; // explicit base constructor call BoundExpression call = MethodCompiler.GenerateObjectConstructorInitializer(this, diagnostics); if (call == null) { // This may happen if Object..ctor is not found or is unaccessible return; } statements[statementIndex++] = F.ExpressionStatement(call); if (paramCount > 0) { AnonymousTypeTemplateSymbol anonymousType = (AnonymousTypeTemplateSymbol)this.ContainingType; Debug.Assert(anonymousType.Properties.Length == paramCount); // Assign fields for (int index = 0; index < this.ParameterCount; index++) { // Generate 'field' = 'parameter' statement statements[statementIndex++] = F.Assignment(F.Field(F.This(), anonymousType.Properties[index].BackingField), F.Parameter(this.parameters[index])); } } // Final return statement statements[statementIndex++] = F.Return(); // Create a bound block F.CloseMethod(F.Block(statements)); }