ASP.NET C# Multiple possible return types
Hey Everyone,
I'm wanting to create a fuction that has 2 or more possible return types if thats possible. I.E
PHP Code:
public String, Boolean testfunction(string input, string returntype="boolean"){
if(input == "String" && returntype=="boolean")
return true;
else
return false;
if(input == "String" && returntype=="string")
return "string is equal to string";
else
return "string is not equal to string";
}
Thanks for any help you can give
ASP.NET VB Multiple possible return types
This is by far not the best way but it would work...
Create three functions that will do the checks for you. I hope this helps
Code:
Public Overridable Function CheckThis(ByVal input As Object) As Object
Dim something As Object = Nothing
If isBool(input) = True Then
something = True
ElseIf isString(input) = "yes" Then
something = "Is String"
End If
Return something
End Function
Public Overridable Function isBool(ByVal input As Object) As Object
If TypeOf input Is Boolean Then
Return True
Else
Return False
End If
End Function
Public Overridable Function isString(ByVal input As Object) As Object
If TypeOf input Is String Then
Return "yes"
Else
Return "not string"
End If
End Function
Thanks,
Matt
inCase Studio
http://incasestudio.com