Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I created a search method which can only receive an object to search for. But now another method in which a use enters a string has to send a value to the search method. The problem is I cannot send the string received from the user to the method which receives objects. Is there a way I can create an object that contanis this string, and send it to the search method?
Posted
Comments
Valery Possoz 7-Feb-13 18:06pm    
A string is an object. Object is the ancestor of everything. Everything is an object. Just pass the string.

1 solution

We dont how your search method works or what type of object its expecting.
since you said you want to pass a string (or say other data type) to the search method you can use method overloading[^] in your application to accept different data types.

Construct the actual objects inside these overloaded methods and call the actual Search method from these overloads.
 
Share this answer
 
Comments
ramaphirio 8-Feb-13 4:07am    
Thanks guys. Sorry for the lack of details. Finally got around the problem though

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