using System.Globalization;
public static void Main()
CultureInfo.CurrentUICulture = new MyCultureInfo("");
Console.WriteLine($"{foo} {foo.ToString()}");
public class MyCultureInfo : CultureInfo
public MyCultureInfo(string name) : base(name) { }
public override object GetFormat(Type formatType)
Console.WriteLine("GETTING FORMAT");
if (formatType == typeof(ICustomFormatter))
return new MyCustomFormatter();
return base.GetFormat(formatType);
public class MyCustomFormatter : ICustomFormatter
public string Format(string format, object arg, IFormatProvider formatProvider)
public int PageSize {get;set;}
public int PageIndex {get;set;}
public override string ToString() => $"PageSize={PageSize}, PageIndex={PageIndex}, ...";