How to override ToString() in [] array?

Say, if I need to override ToString method in a custom List, I'd do this:

public class WebUILanguage2 : List<WebUILanguage>
{
    public override string ToString()
    {
        return "Overridden message";
    }
}

but what if I want to override this?

public class WebUILanguage2 : WebUILanguage[]
Jon Skeet
people
quotationmark

You can't. You can't derive from array types.

I'd generally advise against overriding ToString in List<T>, too - usually it's better to use composition than inheritance for things like this, in my experience.

people

See more on this question at Stackoverflow