Click here to Skip to main content
15,914,225 members
Home / Discussions / C#
   

C#

 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
Sascha Lefèvre20-Jan-16 7:03
professionalSascha Lefèvre20-Jan-16 7:03 
AnswerRe: String Formatting / Interpolation --- Opinions Pin
phil.o20-Jan-16 4:26
professionalphil.o20-Jan-16 4:26 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
Sascha Lefèvre20-Jan-16 4:36
professionalSascha Lefèvre20-Jan-16 4:36 
AnswerRe: String Formatting / Interpolation --- Opinions Pin
PIEBALDconsult20-Jan-16 4:34
mvePIEBALDconsult20-Jan-16 4:34 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
Sascha Lefèvre20-Jan-16 5:41
professionalSascha Lefèvre20-Jan-16 5:41 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
PIEBALDconsult20-Jan-16 5:49
mvePIEBALDconsult20-Jan-16 5:49 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
Sascha Lefèvre20-Jan-16 5:55
professionalSascha Lefèvre20-Jan-16 5:55 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
PIEBALDconsult20-Jan-16 5:59
mvePIEBALDconsult20-Jan-16 5:59 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
Sascha Lefèvre20-Jan-16 7:43
professionalSascha Lefèvre20-Jan-16 7:43 
JokeRe: String Formatting / Interpolation --- Opinions Pin
Richard Deeming20-Jan-16 7:50
mveRichard Deeming20-Jan-16 7:50 
AnswerRe: String Formatting / Interpolation --- Opinions Pin
Richard Deeming20-Jan-16 4:41
mveRichard Deeming20-Jan-16 4:41 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
Sascha Lefèvre20-Jan-16 5:38
professionalSascha Lefèvre20-Jan-16 5:38 
AnswerRe: String Formatting / Interpolation --- Opinions Pin
BillWoodruff20-Jan-16 6:40
professionalBillWoodruff20-Jan-16 6:40 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
Sascha Lefèvre20-Jan-16 7:02
professionalSascha Lefèvre20-Jan-16 7:02 
AnswerRe: String Formatting / Interpolation --- Opinions Pin
GravityPhazer21-Jan-16 23:53
professionalGravityPhazer21-Jan-16 23:53 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
Sascha Lefèvre22-Jan-16 1:59
professionalSascha Lefèvre22-Jan-16 1:59 
AnswerRe: String Formatting / Interpolation --- Opinions Pin
GravityPhazer22-Jan-16 4:11
professionalGravityPhazer22-Jan-16 4:11 
Ah sorry, withdraw that. I thought I had a problem using conditional with strings:
C#
Write($"Test is {(isTest ? "enabled" : "disabled")}");

But I obviously just mixed up something with the brackets.

That, though, is something that's clearly some kind of disadvantage: Using something like this makes it kinda difficult to read ore more like difficult to find the error if you place any bracket wrong (or have any other kind of syntax issue). At least if you use a lot and/or complex expressions.

But I still prefer interpolation Wink | ;)

I personally had to get used to it first, though. I think it's nicer to use than string.Format() and although I built a string extension method which let's me quick format a string, I think this is better to use. I think it's definetly an advantage that you actually see which variable or value you have at that spot. With format you just see the index there and have to check which value is actually being set (especially when you got >4 elements with an object array).

But like I said, in the beginning I forgot most of the time to first write the indicator sign $, and thus had to go back - which is indeed more time consuming then. But that's just temporary.
GeneralRe: String Formatting / Interpolation --- Opinions Pin
Sascha Lefèvre22-Jan-16 4:29
professionalSascha Lefèvre22-Jan-16 4:29 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
GravityPhazer22-Jan-16 4:37
professionalGravityPhazer22-Jan-16 4:37 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
Sascha Lefèvre22-Jan-16 4:48
professionalSascha Lefèvre22-Jan-16 4:48 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
GravityPhazer22-Jan-16 5:21
professionalGravityPhazer22-Jan-16 5:21 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
jschell22-Jan-16 13:55
jschell22-Jan-16 13:55 
AnswerRe: String Formatting / Interpolation --- Opinions Pin
jschell22-Jan-16 14:01
jschell22-Jan-16 14:01 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
Sascha Lefèvre22-Jan-16 23:06
professionalSascha Lefèvre22-Jan-16 23:06 
GeneralRe: String Formatting / Interpolation --- Opinions Pin
jschell28-Jan-16 12:48
jschell28-Jan-16 12:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.