[OT] C# can do all the interpolated strings now
forkit at gmail.com
Thu Dec 9 22:42:35 UTC 2021
On Wednesday, 8 December 2021 at 22:10:32 UTC, Steven
> But there are plenty of examples where the string-blueprint
> form is less readable (the INSERT form where you specify fields
> first, and then parameters later is kind of a terrible syntax
> to begin with).
> e.g. (from a real line of code in my codebase):
> conn.exec("UPDATE organization SET loc_lat = ?, loc_lon = ?
> WHERE id = ?", loc_latitude, loc_longitude, id);
> // compare to:
> conn.exec(i"UPDATE organization SET loc_lat = $loc_latitude,
> loc_lon = $loc_longitude WHERE id = $id");
Well, for me, the first example you presented is so much more
conn.exec("UPDATE organization SET loc_lat = ?, loc_lon = ? WHERE
id = ?", loc_latitude, loc_longitude, id);
My brain straight away looks for that comma, and I immediately
see what the parameters are.
The other way, I have to read and parse the ENTIRE string!
More information about the Digitalmars-d