Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing a class instead of object?
Message
 
To
11/12/2003 05:03:51
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00858007
Message ID:
00858445
Views:
15
You can pass in a Type reference of the type in question, which can then be created. Alternately you can use a string and then load from an assembly (but you have to know where the object lives or in the current assembly).

I'm not sure what you gain by this though. Why can't you just pass in the reference as an Object and return the result back out as an object? That way it's generic and your code inside only needs to cast to the proper object type as required.

+++ Rick ---


>Hi
>
>I need to pass a parameter to a method, this parameter will dictate the return type (there are 3 overloaded methods in total).
>
>Is there a way of passing the class as a parameter or something similar, without instantiating it? Each of the 3 methods would therefore take in a different type of parameter.
>
>Hope that makes sense.
>
>Thanks
>Kev
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform