С помощью интерполяции можно напрямую вставлять в строку значения переменных:
string name = "Mark";
var date = DateTime.Now;
// Composite formatting:
Console.WriteLine("Hello, {0}! Today is {1}, it's {2:HH:mm} now.", name, date.DayOfWeek, date);
// String interpolation:
Console.WriteLine($"Hello, {name}! Today is {date.DayOfWeek}, it's {date:HH:mm} now.");
// Both calls produce the same output that is similar to:
// Hello, Mark! Today is Wednesday, it's 19:40 now.
В Debug.Log эта запись будет такой:
public new string name = "New item";
Debug.Log($"Using item: {name}");
DenTNT недавно публиковал (посмотреть все)
- C#: Отобразить Unicode символ - 25.04.2024
- UWP: Visual Studio requires a newer version of Windows to display this content - 10.04.2024
- Воспроизводить треки подряд из всех папок в HiBy Music - 10.04.2024