1

I have a asp.net mvc page with an array of checkboxes that gets posted to an insert-method.

And I have this string[] UsergroupIDs, that gets mapped properly, but it contatins "false"-values, and is in string[].

Is there some easy way of cast it to int[] and remove the "false"-values?

Using the .Select and .Where if possible? :)

/M

1 Answer 1

3

First, filter the false values. Then parse them:

var intValues = stringValues.Where(x => x != "false").Select(x => int.Parse(x));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.