It is a bit old school, good code, but I prefer generics for that. Or modern advanced records and the like.
So there are better options than using object. Mind you, the code is good, just a bit old fashioned.
Which is not necessarily bad.
Also the code is probably not very memory efficient.