public static void cout(object g) { //нужно привести параметр к нужному вам типу Instr box = g as Instr; //если получилось, то вывести нужные значения if (box != null) { Console.WriteLine($"{box.НужноеСвойство}"); } }
Or redefine the ToString() method in your Instr class. To do this, write override press the spacebar - the studio will list the available methods for redefining the methods, select ToString() . And then in it write something like
return $"{this.НужноеСвойство1} - {this.НужноеСвойство2}, {this.НужноеСвойство3}";
then you can call ToString() in your public static void cout(object g) method and print the values of all the properties you need.