linq - counter in lambda expression streamwriter -
i have follow expression:
mygrid.foreach(sub(model) mystreamwriter.writeline(function(x integer) (x + 1)))
of course it's not working. want write in text file (writeline) sequential number (1, 2, 3, etc.) each record collected in variable vargrid type: list (of mytable)
any idea? it's fine csharp code too.
regards.
you declare counter outside of foreach lambda, declare outside of scope of foreach loop.
var x = 1; mygrid.foreach(model => mystreamwriter.writeline(x++.tostring()));
Comments
Post a Comment