G
Guest
I have some custom types and have overloaded the tostring method so i can print it out and get a description of the contenet of the object for debugging purposes not just the default type
however when i have an array of the objects it just uses the type, so where do i overload the tostring for an array of objects
e
class myTyp
public string name
public override string ToString(
return "{" + base.ToString() + "} " + name
myType x = new myType()
x.name = "test"
myType[] y = new myType[10]
//... set name for each on
Console.Writeline(x.ToString())
Console.Writeline(y.ToString())
---
output
{myType} tes
myType[
how can i alter the 2nd tostring output?
however when i have an array of the objects it just uses the type, so where do i overload the tostring for an array of objects
e
class myTyp
public string name
public override string ToString(
return "{" + base.ToString() + "} " + name
myType x = new myType()
x.name = "test"
myType[] y = new myType[10]
//... set name for each on
Console.Writeline(x.ToString())
Console.Writeline(y.ToString())
---
output
{myType} tes
myType[
how can i alter the 2nd tostring output?