Is it possible to make an anonymous class inherit another class?

No. Anonymous types always implicitly derive from object, and never implement any interfaces.

From section 7.6.10.6 of the C# 5 specificiation:

An anonymous object initializer declares an anonymous type and returns an instance of that type. An anonymous type is a nameless class type that inherits directly from object.

So if you want a different base class or you want to implement an interface, you need a named type.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)