Tuesday 11 December 2018

c# - Inheriting from List

What is the fastest way to implement a new class that inherits from List?


class Animal {}
class Animals : List {} // (1)

One problem I've encountered: By simply doing (1), I've found that I'm not getting the benefit of inheriting any constructors from List.


In the end, I'd like Animals to behave a lot like a List (e.g., can be constructed, compatibility with Linq). But in addition, I'd also like to be able to add my own custom methods.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...