¡@

Home 

c# Programming Glossary: mammal

C# : Why doesn't 'ref' and 'out' support polymorphism?

http://stackoverflow.com/questions/1207144/c-sharp-why-doesnt-ref-and-out-support-polymorphism

the great question. Let's suppose you have classes Animal Mammal Reptile Giraffe Turtle and Tiger with the obvious subclassing.. relationships. Now suppose you have a method void M ref Mammal m . M can both read and write m. Can you pass a variable of.. contain a Turtle but M will assume that it contains only Mammals. A Turtle is not a Mammal. Conclusion 1 Ref parameters cannot..

Contravariance explained

http://stackoverflow.com/questions/1962629/contravariance-explained

operation Animal someAnimal new Giraffe assume returns Mammal also covariant operation someAnimal Mammal.GetSomeMammal The.. assume returns Mammal also covariant operation someAnimal Mammal.GetSomeMammal The return operation here is covariant as we are.. Mammal also covariant operation someAnimal Mammal.GetSomeMammal The return operation here is covariant as we are preserving..

XML Serialization and Inherited Types

http://stackoverflow.com/questions/20084/xml-serialization-and-inherited-types

lightest way possible There seems to be a lot of Animal Mammal Car Bike Truck examples but not a lot of fresh ideas Thanks..