S
Simon Woods
Hi
I am storing data type information in a config file as a string. I think
the queation I want to ask is "Is it possible to convert it into a
Generic Type".
So, e.g., I may have a selection of objects in a dictionary
Object 1 holds and returns a Boolean
Object 2 holds and returns a String
Object 3 holds and returns an Integer
However, each object gets it return type from the config file. I know
that I will have to do a Select Case on the config value at some stage, e.g.
Select Case Config.ReturnType
Case "Boolean"
Return GetType(Boolean)
Case "String"
Return GetType(String)
etc etc
I was wanting to store this information so I could issue, e.g.
dim myvar = Object1.DataValue(Of Object1.DataType)
(yes I know this command is illegal but it sort of shows what I am
trying to achieve)
so all the type information is completely in each object and I don't
have to expose
If Object1.IsBoolean Then
Return Object1.BooleanValue
etc etc
I was hoping not to have to implement "DataValue() as Object" but have
"stronger" typing on it
I don't know whether this is possible, or in fact whether I am going
round the houses to something which could be implemented in a much
easier way.
Thx in advance
Simon
I am storing data type information in a config file as a string. I think
the queation I want to ask is "Is it possible to convert it into a
Generic Type".
So, e.g., I may have a selection of objects in a dictionary
Object 1 holds and returns a Boolean
Object 2 holds and returns a String
Object 3 holds and returns an Integer
However, each object gets it return type from the config file. I know
that I will have to do a Select Case on the config value at some stage, e.g.
Select Case Config.ReturnType
Case "Boolean"
Return GetType(Boolean)
Case "String"
Return GetType(String)
etc etc
I was wanting to store this information so I could issue, e.g.
dim myvar = Object1.DataValue(Of Object1.DataType)
(yes I know this command is illegal but it sort of shows what I am
trying to achieve)
so all the type information is completely in each object and I don't
have to expose
If Object1.IsBoolean Then
Return Object1.BooleanValue
etc etc
I was hoping not to have to implement "DataValue() as Object" but have
"stronger" typing on it
I don't know whether this is possible, or in fact whether I am going
round the houses to something which could be implemented in a much
easier way.
Thx in advance
Simon