protected override void ParseElement(XElement element) { var objectParser = new ObjectParser(State); objectParser.Parse(element); var addExpression = new CodeMethodInvokeExpression( new CodePropertyReferenceExpression(new CodeVariableReferenceExpression(Parent.VariableName), Name), "Add", new CodeVariableReferenceExpression(objectParser.VariableName)); State.AddStatement(new CodeExpressionStatement(addExpression)); }
protected override void ParseElement(XElement element) { if (!m_firstElement) throw new InvalidOperationException(); var objectParser = new ObjectParser(State); objectParser.Parse(element); var left = new CodePropertyReferenceExpression( new CodeVariableReferenceExpression(Parent.VariableName), Name); var right = new CodeVariableReferenceExpression(objectParser.VariableName); var assignment = new CodeAssignStatement(left, right); State.AddStatement(assignment); }
protected override void ParseElement(XElement element) { if (!m_firstElement) { throw new InvalidOperationException(); } var objectParser = new ObjectParser(State); objectParser.Parse(element); var left = new CodePropertyReferenceExpression( new CodeVariableReferenceExpression(Parent.VariableName), Name); var right = new CodeVariableReferenceExpression(objectParser.VariableName); var assignment = new CodeAssignStatement(left, right); State.AddStatement(assignment); }