thank you for looking at my question, to verify what i mean
Console.WriteLine($"Hello {variable}");
I am curious to the effect that the $ has on the output from Console.WriteLine
<< is the left shift operator. It is shifting the number 1 to the left 0 bits, which is equivalent to the number 1 .
In C programming language, %d and %i are format specifiers as where %d specifies the type of variable as decimal and %i specifies the type as integer. In usage terms, there is no difference in printf() function output while printing a number using %d or %i but using scanf the difference occurs.
The && (logical AND) operator indicates whether both operands are true. If both operands have nonzero values, the result has the value 1 . Otherwise, the result has the value 0 . The type of the result is int . Both operands must have an arithmetic or pointer type.
Console.WriteLine($"Hello {variable}");
Is I think equal to:
Console.WriteLine(string.Format("Hello {0}", variable));
It just moves the parameter into the index position as if you were formatting it.
It is a new feature to use in addition to string.Format
It's called Interpolated Strings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With