Using Integration Studio 9.0 Error in LINQ

Using Integration Studio 9.0 Error in LINQ

  
Here I'm trying to use LINQ in IEnumerable Class which is the RecordList here is the code.
But when I try to run this on my espace this is the error:
Internal Error: Error:
Unable to cast object of type 'OutSystems.NssTreeBuilder.RCNodeRecord' to type 'OutSystems.NssTreeBuilder.RLNodeRecordList'.


What did I do wrong on this?

error-linq
My linq is a bit rusty.

however, the error speaks for itself. you are casting wrong.

there are 2 things that are puzzling me..

1. from RLNodeRecordList i in ssRecordlist
does that mean, ssRecordList is a list of lists?

2. .FirstOrDefault() returns the first element (or default), so that  "should" be a RCNodeRecord ?


to your number 1 question. I cast the "i" to RLNodeRecordList to explicitly assign its type. if I dont do that Visual Studio throws an error that I need to explicitly assign a type to "i".

Forget the FirstOrDefault I already remove that to my query.

what is the correct way to use LINQ in Outsystems RecordList?