Java Generics With a Class & an Interface – Together

Actually, you can do what you want. If you want to provide multiple interfaces or a class plus interfaces, you have to have your wildcard look something like this: <T extends ClassA & InterfaceB> See the Generics Tutorial at sun.com, specifically the Bounded Type Parameters section, at the bottom of the page. You can actually … Read more

A generic list of anonymous class

You could do: var list = new[] { o, o1 }.ToList(); There are lots of ways of skinning this cat, but basically they’ll all use type inference somewhere – which means you’ve got to be calling a generic method (possibly as an extension method). Another example might be: public static List<T> CreateList<T>(params T[] elements) { … Read more

ArrayList vs List in C#

Yes, pretty much. List<T> is a generic class. It supports storing values of a specific type without casting to or from object (which would have incurred boxing/unboxing overhead when T is a value type in the ArrayList case). ArrayList simply stores object references. As a generic collection, List<T> implements the generic IEnumerable<T> interface and can … Read more

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