C# Return Different Types?

The Solution to C# Return Different Types? is

If there is no common base-type or interface, then public object GetAnything() {...} - but it would usually be preferable to have some kind of abstraction such as a common interface. For example if Hello, Computer and Radio all implemented IFoo, then it could return an IFoo.

~ Answered on 2012-01-24 12:43:05

Most Viewed Questions: