Archive

Posts Tagged ‘tricks’

C# 4.0: Covariance and Contravariance

April 13th, 2009

In this article I’ll try to cover one of the C# 4.0 innovations. One of the new features is covariance and contravariance on type parameters that is now supported by generic delegates and generic interfaces. First let’s see what does these words mean :)

Generally if we have some entity (interface or delegate) that is generic on type T – some Entity<T>, and two concrete entities Entity<A> and Entity<B> where B inherits from A, then there are no inheritance relationships between Entity<A> and Entity<B>. Covariance (and contravariance) adds such relationships:

Read more…

.NET , , ,

iPhone Simulator Looks Confusing

December 24th, 2008

A week ago I found some annoying thing about iPhone OS and iPhone simulator. As a result you cannot be really sure that application that works great on simulator whould even be compiled for device.

Unpretty thing that I found is that NSCalendarDate and NSURLDownload classes are not supported on iPhone OS. But they are do supported on simulator! Code is not compiled in device mode with error that class is unknown. Seems to be a simulator bug :(

Please, be careful, and do not use NSCalendarDate and NSURLDownload. Also test your application on a device regularly. If you do not have a device, just build your app (Cmd-B) in device mode, to be sure it is successfully compiled.

iPhone , , ,