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?

asked Nov 1, 2013 at 16:33

1 Answer 1

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.