How would you also check to see if the value you are passing into into an SOE is an integer as well?
This checks for string, but returns 0 when passing number:
string searchValStr;
int searchValInt;
found = operationInput.TryGetString("searchVal", out searchValStr);
if (!found || string.IsNullOrEmpty(searchValStr))
// check for int
Int32.TryParse("searchVal", out searchValInt);
How would I check for int and string using same input?
1 Answer 1
Try this:
string searchValStr;
int searchValInt;
found = operationInput.TryGetString("searchVal", out searchValStr);
if (!found || string.IsNullOrEmpty(searchValStr))
// check for int
bool isNum = Int32.TryParse("searchVal", out searchValInt);
if (isNum)
{
MessageBox.Show("input is an int");
}
else
{
Messagebox.Show("input is not an int");
}
answered Nov 4, 2013 at 22:01
Explore related questions
See similar questions with these tags.
lang-cs