unchecked -keyword in C#

UPDATE: This question was the subject of my blog in April 2015; thanks for the interesting question! Your first question is: The checked keyword is useful, but how about the unchecked keyword? I really can’t find a use for it. Is there any? The C# design team is not in the habit of adding features … Read more

How do I fix “The expression of type List needs unchecked conversion…’?

This is a common problem when dealing with pre-Java 5 APIs. To automate the solution from erickson, you can create the following generic method: public static <T> List<T> castList(Class<? extends T> clazz, Collection<?> c) { List<T> r = new ArrayList<T>(c.size()); for(Object o: c) r.add(clazz.cast(o)); return r; } This allows you to do: List<SyndEntry> entries = … Read more