Thursday, June 9, 2022

c# - How to format interpolated strings

This example writes double value with two decimal places.
double zoom = this.ZoomFactor * 100.0;
LStatusZoom.Text = $"Zoom: {zoom:0.##} %";
Output:
Zoom: 80.25 %

No comments:

Post a Comment