Possible Duplicate:
How can I pass an anonymous type to a method?
I have the following LINQ Statement, whose output has to be processed in another method:
var data = from lines in File.ReadAllLines(TrainingDataFile)
.Skip(ContainsHeader ? 1 : 0)
let f = lines.Split(new[] { FieldSeparator }).ToList<String>()
let target = f[TargetVariablePositionZeroBased]
select new { F=f, T=target };
What should be the datatype of the parameter in the method that will take this data?
You can’t very easily pass anonymous types around. You can either create a class, or since your data has only two properties, use a
Tuple:If I have the data types correct, then the data type of the parameter would be:
and you would reference
FandTusing theTuplepropertiesItem1andItem2.