This is a Example for Override ToString Method in C#.Net
To Create a Class File for Convert a integer into string
To Create a Class File for Convert a integer into string
private int idx;
public Class1(int idxs)
{
this.idx = idxs;
}
public Class1(int idxs)
{
this.idx = idxs;
}
public override string ToString()
{
return this.idx.ToString() + " " + "Good";
}
Paste this following code in your main form{
return this.idx.ToString() + " " + "Good";
}
Class1 cls = new Class1(10);
MessageBox.Show(cls.ToString());
Output:
MessageBox.Show(cls.ToString());
Output:
10 Good