String interpolation and NumberDecimalSeparator

CSharp · Console

/Program.cs

using System;
using System.Linq;

public class Program
{
	readonly static (double lng, double lat)[] Locations = 
	{
		(10.757938, 52.437444),
		(10.764379, 52.437314),
		(10.770562, 52.439067),
		(10.773268, 52.436633),
	};
	
	public static void Main()
	{
		System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("de-DE");
		
		string lngLats = Locations.Aggregate(string.Empty, (str, next) => str + $"{next.Item1:F6},{next.Item2:F6};");
		Console.WriteLine($"lngLats: {lngLats}\n");
		
		double x = 12.3456;
		string result = x.ToString(System.Globalization.CultureInfo.InvariantCulture);
		Console.WriteLine($"A double value: {result}\n");
	}
}
;