C# node return list

This should be easy, but still I can’t get my head around this. How can I return a simple list?

public override IEnumerable<AssociativeNode> BuildOutputAst(List<AssociativeNode> inputAstNodes)
{          
    if (Items.Count == 0 ||
        Items[0].Name == "BS ApiKey error" ||
        SelectedIndex == -1)
    {
        return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), AstFactory.BuildNullNode()) };
    }
    // get the selected items name
    //var stringNode = AstFactory.BuildStringNode((string)Items[SelectedIndex].Item);
    var node = AstFactory.BuildExprList(BSDoc);
 
    // assign the selected name to an actual enumeration value
    var assign = AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), node);
 
    // return the enumeration value
    return new List<AssociativeNode> { assign };
}

Hi Nicklas, this piece of code looks good. It returns a list (suppose BSDoc here is a list of string) . Doesn’t work?

No my code do not work. I get a list with ”null” for every item in the list. When I debug my code the list (BSDoc) looks fine…

A good tutorial on…C# List

Throt

thank you. I got a reply that helped me going on the dynamo github page.