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

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -