Class List Keeps Printing Out As Class Name In Console?

C# doesn’t know anything about the SharePrices other than the class name. If you want it to display something specific, you will need to override the ToString() method like so:

public override string ToString()
{
    return "SharePrice: " + theDate.ToString() + ": " + sharePrice.ToString();
}

Of course, you can format it however you like, that is the beauty of it. If you only care about the price and not the date, only return the sharePrice.

Leave a Comment