Archive

Posts Tagged ‘generics’

Overview of C# 4.0

November 13th, 2008 Buu Nguyen 7 comments

Note: This article is also posted at The Code Project. Refer to this link. There are quite interesting discussions going on there.

The .NET framework 4.0 CTP has just been released and I think it’s a good time to explore the new features of C# 4.0. In this post, I will introduce about the following features: dynamic lookup, generics covariance and contravariance support, optional and named parameters.
Read more…

  • Share/Bookmark

Java and .NET Generics

January 10th, 2007 Buu Nguyen 12 comments

Java 5.0 and .NET 2.0 both support generic types, however, the implementations of generic in these platforms are different. Java makes use of a technique called “code sharing” in which there is just one type to represent all generic versions of that type, for example: ArrayList<Integer> and ArrayList<String> are both compiled down to ArrayList as the compiler perform erasure on generic types. On the other hand, .NET makes use of “JIT code specialization” technique in which there is a separate run-time representation of each version of a generic type (i.e. List<int> and List<string> both have unique representations at run-time). Read more…

  • Share/Bookmark