0

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

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");
            }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.