Click here to Skip to main content
15,920,468 members
Please Sign up or sign in to vote.
3.00/5 (3 votes)
See more:
Hi,

I have two objects and I dont want to create a wrapper class to have data of this two object, no 'Out' parameter is there any way that I can return more than one object of different type?

Will really appreciate it!!

Thanks
Posted
Updated 1-Mar-10 21:37pm
v2

You can make one of them an out parameter.
 
Share this answer
 
In that case, I'm sorry, but this is a really dumb question. You want to return two objects. You don't want to create a struct to hold them. You don't want to use an out parameter. No, there is quite obviously no other way to do what you want.
 
Share this answer
 
Use two different methods then!
 
Share this answer
 
Yep!@ christian :-D its sound dumb thats why this question is posted here I want to try something new dnt want to use old pattern..
 
Share this answer
 
Thanks !! christian !!

But I dont want to use Out/ref i want to add this return method in my Service....is there any other way..

Thanks
 
Share this answer
 
The different types could be derived from the same (even abstract) type
to be iterated in a collection :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900