Click here to Skip to main content
15,884,978 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I would like to write a function with one parameter, however, this parameter can be with different objects type which may be created from different classes at run time. Can I have this kind of function with sample code for reference ? Thanks.
Posted
Updated 29-Mar-11 2:21am
v4

 
Share this answer
 
Comments
Olivier Levrey 29-Mar-11 8:56am    
Voted 5. Using generics can be what OP needs.
Sports Kuo 30-Mar-11 2:42am    
Thanks of your input.
[no name] 31-Mar-11 7:04am    
Y're Most Welcome.
Use the object type. ALL objects in .Net is derived from this type.
 
Share this answer
 
Comments
Olivier Levrey 29-Mar-11 8:55am    
My 5. Good answer.
Sports Kuo 30-Mar-11 7:04am    
Thanks so much.

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