ListIBanana ibanans = Banans as ListIBanana; ibananas == null ?
Given : interface IBanana {//code ommited} class Banana : IBanana {//code omitted} ListIBanana banans; ListIBanana ibanans = banans as ListIBanana; ibananas == null ? why? Regards Arjang
RE: [OT]Junior Designer/dotnet person required
Check out http://www.careerhub.com.au/ _ From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Anthony Sent: Friday, 4 June 2010 12:10 PM To: 'ozDotNet' Subject: [OT]Junior Designer/dotnet person required Where can i post a job requirement for students..is there a student bulletin board or similar or do i just contact a RMNIT etc? Is http://www.intellixperience.com/signup.aspx your website being IntelliXperienced? regards Anthony (*12QWERNB*) Is your website being IntelliXperienced?
Re: ListIBanana ibanans = Banans as ListIBanana; ibananas == null ?
Cheers Arjang. This seems to be the best way to understand the type variance rules and why they used the terms in/out in the implementation. If all uses of the generic type parameter are in return (or out) positions then you can get out variance. If all uses are in incoming positions (i.e. parameters) then you can get in variance. You cannot have a mix of the two. In the case of IListT there is void .Add(T item) and IEnumeratorT GetEnumerator() so there is no valid variance for IListT for IEnumeratorT though there is only T Current { get; } so you can (and do) get out variance so an IEnumeratorBanana can get cast to IEnumeratorIBanana Hope that helps. Regards, Mike On Fri, Jun 4, 2010 at 2:37 PM, Arjang Assadi arjang.ass...@gmail.comwrote: True Nicely explained. Thank you Michael, On 4 June 2010 16:30, Michael Minutillo michael.minuti...@gmail.com wrote: because of this: class Apple : IBanana { } ibanans.Add(new Apple() as IBanana); On Fri, Jun 4, 2010 at 2:27 PM, Arjang Assadi arjang.ass...@gmail.com wrote: Given : interface IBanana {//code ommited} class Banana : IBanana {//code omitted} ListIBanana banans; ListIBanana ibanans = banans as ListIBanana; ibananas == null ? why? Regards Arjang -- Michael M. Minutillo Indiscriminate Information Sponge Blog: http://wolfbyte-net.blogspot.com -- Michael M. Minutillo Indiscriminate Information Sponge Blog: http://wolfbyte-net.blogspot.com
Re: ListIBanana ibanans = Banans as ListIBanana; ibananas == null ?
Haha. I didn't even read it properly. Pattern Matching FTW! On Fri, Jun 4, 2010 at 3:08 PM, Mark Hurd markeh...@gmail.com wrote: I assume the OP has a typo and he's trying to cast to IList, and all your answers are assuming that! The 'exact' code he's posted does not return null. -- Regards, Mark Hurd, B.Sc.(Ma.)(Hons.) -- Michael M. Minutillo Indiscriminate Information Sponge Blog: http://wolfbyte-net.blogspot.com
Installer serial number validation
Folks, I added a Customer Information dialog to my VS2008 installer project. I expected the serial number the user enters to be present in the Context collection that my Custom Action could validate, but it's not there. All of the data entered in other dialogs is in the Context collection. Has anyone ever put serial number validation in a VS install project without writing C++ DLLs and editing the package with Orca (which is what samples I've found do). The samples hint that a value with key PIDKEY will be created, but it's not stored anywhere that I can find in my Installer derived class. Greg