Click here to Skip to main content
15,904,156 members

Comments by Close Network (Top 24 by date)

Close Network 26-May-11 6:46am View    
Then, I have a new question. Interface does not hold any definition. Interface can not be instantiated. How can this code be valid ?

IDataReader reader = cmd.ExecuteReader()

cmdExecuteReader returns an object with a value in memory. reader is interface. How can an object be assigned to an interface ? isnt interface just a contract with not method definitions inside ?
Close Network 26-Feb-11 7:47am View    
The problem is in casting. When r1 is cast to inherited type, it must be holding a reference to the Method() of LivingRoom object. That it is just hidden does not mean that there exists no reference to it. Is this correct ?
Close Network 26-Feb-11 7:17am View    
Considering the method only, since int is value type, the newly created object has a reference to its method and this does not have to be assigned to corresponding base object method reference, as the reference to LivingRoom object is assigned to r1 an this already holds the reference to the method too. Is this what you mean ?
Close Network 24-Feb-11 15:10pm View    
Yes, this is an acceptable solution. And also it would be very nice If could do that with generics.
Close Network 24-Feb-11 13:59pm View    
Yes, regular asp.net web service.