public static class Exts {
public static string Arr(this string self, params object[] args)
return string.Format(self, args);
public static string Inst(this string self, int arg)
return string.Format(self, arg);
public static string Obj(this string self, Object arg)
return string.Format(self, arg);
public static string ExtArrWithBoxingEnabled(DateTime i)
return "{0:0000}".Arr(i.Month);
public static string ExtInstWithBoxingEnabled(DateTime i)
return "{0:0000}".Inst(i.Month);
public static string ExtObjWithBoxingEnabled(DateTime i)
return "{0:0000}".Obj(i.Month);
public static string RegularCallWithBoxingEnabled(DateTime i)
return string.Format("{0:0000}",i.Month);
public static void Main()
var x = new System.DateTime(2001, 2, 3);
if (ExtArrWithBoxingEnabled(x) != "0002") {
Console.WriteLine("[1] didn't get expected value");
Console.WriteLine("[2] call failed");
if (ExtInstWithBoxingEnabled(x) != "0002") {
Console.WriteLine("[3] didn't get expected value");
Console.WriteLine("[4] call failed");
if (ExtObjWithBoxingEnabled(x) != "0002") {
Console.WriteLine("[5] didn't get expected value");
Console.WriteLine("[6] call failed");
if (RegularCallWithBoxingEnabled(x) != "0002") {
Console.WriteLine("[7] didn't get expected value");
Console.WriteLine("[8] call failed");
Console.WriteLine("outcome: "+ (bug == 0 ? "success" : "error(s)"));