Without this, additional items could be added in the future which wouldn't be included in the check. Move the check out of the loop since this is such an unlikely situation that checking every iteration isn't needed. Also remove redundant casts.
Without this, additional items could be added in the future which wouldn't be included in the check. Move the check out of the loop since this is such an unlikely situation that checking every iteration isn't needed. Also remove redundant casts.