change property return type dynamically
-
I have create a property of System.object return type I want to change its Type at runtime according to my need. for example I want to convert it into System.String or System.Enum. is it possible ? Thanks.
-
I have create a property of System.object return type I want to change its Type at runtime according to my need. for example I want to convert it into System.String or System.Enum. is it possible ? Thanks.
You can write a generic method, I'm not sure if you can write one where the generic type specifies the return type, but I expect so. Or you can cast your object to whatever you like, but the real kicker is, how do you get the method to return objects of different types all the time ? Generics will do that, but how do you define the instance of the object to have the value you want, if it could be any type of object ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
You can write a generic method, I'm not sure if you can write one where the generic type specifies the return type, but I expect so. Or you can cast your object to whatever you like, but the real kicker is, how do you get the method to return objects of different types all the time ? Generics will do that, but how do you define the instance of the object to have the value you want, if it could be any type of object ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
I want to implement dropdown list in web parts in asp.net 2.0, so that i can implement personalization. there must be Enum to use dropdown list. I have created Enum Dynamically. I already created a Propert of System.object return type. now i want to change its return type as per Enum, i created dynamically. Thats why i need some solution of it. if you have any idea, please let me know. Thanks.
-
I want to implement dropdown list in web parts in asp.net 2.0, so that i can implement personalization. there must be Enum to use dropdown list. I have created Enum Dynamically. I already created a Propert of System.object return type. now i want to change its return type as per Enum, i created dynamically. Thats why i need some solution of it. if you have any idea, please let me know. Thanks.
I already told you the only solution that might possibly work.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.