see this code:
ChooseGrade ChGrade = new ChooseGrade();
string GrCl = ChGrade.getGrCl().ToString(); // function getGrCl gets "public int[] grad_class=new int[2];" in ChooseGrade Class
MessageBox.Show(GrCl);
But I see in Messagebox this "System.Int32[]" instant container of grade_class Array. Can you Help me?
Enumerate over the ints and add them to a string which you can then show in the MessageBox:
string message = "";
int myArray[] = ChGrade.getGrCl();
foreach(var num in myArray)
message += String.Format("{0} ", num);
MseeageBox.Show(message);
The default ToString()-implementation returns the type. Since the return value of getGrCl() is an array of integer, the ToString()-method returns just this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With