Question Specifying a datatype in signature of a function

hydroparadise

New member
Joined
Jul 10, 2009
Messages
1
Programming Experience
1-3
I am trying to define a function that I would like to specify a datatype as in input of the function. The only/best way I evision doing this is by making a enum with the range of datatypes the function will accept and us the enum as part of the function's signature.

example code:

VB.NET:
Enum MyDataTypes[INDENT]String
Int32
DbNull
DateTime[/INDENT]
End Enum

Function MyFunction(UnknownObject as Object, OutputDataType as MyDataType) As Object

'Code using GetType to identify the unkown object,
'performs certain actions based on its datatype and 
'outputs an object specified by OutputDataType in 
'fucntion signature
End Function

Seems like there could be a better way, and any suggestions would be appreciated.
 
Back
Top