mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
add example for verbatim interpolated string
This commit is contained in:
parent
3e072363d9
commit
467f143b9c
@ -955,6 +955,7 @@ on a new line! ""Wow!"", the masses cried";
|
|||||||
|
|
||||||
// String interpolation by prefixing the string with $
|
// String interpolation by prefixing the string with $
|
||||||
// and wrapping the expression you want to interpolate with { braces }
|
// and wrapping the expression you want to interpolate with { braces }
|
||||||
|
// You can also combine both interpolated and verbatim strings with $@
|
||||||
public class Rectangle
|
public class Rectangle
|
||||||
{
|
{
|
||||||
public int Length { get; set; }
|
public int Length { get; set; }
|
||||||
@ -967,6 +968,9 @@ on a new line! ""Wow!"", the masses cried";
|
|||||||
{
|
{
|
||||||
Rectangle rect = new Rectangle { Length = 5, Width = 3 };
|
Rectangle rect = new Rectangle { Length = 5, Width = 3 };
|
||||||
Console.WriteLine($"The length is {rect.Length} and the width is {rect.Width}");
|
Console.WriteLine($"The length is {rect.Length} and the width is {rect.Width}");
|
||||||
|
|
||||||
|
string username = "User";
|
||||||
|
Console.WriteLine($@"C:\Users\{username}\Desktop");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user