Is better do:
variable1Type foo; variable2Type baa; foreach(var val in list) { foo = new Foo( ... ); foo.x = FormatValue(val); baa = new B
It doesn't matter, it has no effect on performance whatsoever.
but I really want know to do right way.
Most will tell you inside-the-loop makes the most sense.