I need to have a function that if a string is = "" return "" else return the cint of the string. I wrote the function below:
Function returnIntWithNull(intString As String )
Return If(intString="","",CInt(intString ))
End Function
But I get the below warning
Function without an 'As' clause; return type of Object assumed
and
Cannot infer a common type because more than one type is possible; 'Object' assumed.
In my code I need to call the function as :
New JArray({returnIntWithNull(getRow.getDrawOffsets)})),
i need that the Jproperty if the GetDrawOffsets return "" will be equal to "advancedraws":[] else if return a string that contain a number must be in the format "advancedraws":[65]
.ToString()on the input parameter, so that you can use your function as is? (it requires string). Then I'd useInt.TryParse(). It may be well possible thatTryCastacceptsObject, but I can't easily test the scenario, especially with your conditions.