How to detect when a moving rectangle is tapped.

Hello there.

I am new in monogame. I am currently developing a simple game, just to learn some basis of the monogame development. I have a problem on which i can’t find an answer at.

I struggle to get this code to work, the idea is to detect whether i tapped on a rectangle (moving sprite) and return true if i did or false if i didn’t, but it always returns false, even if I tap on that moving sprite.

    //In update function
 protected override void Update(GameTime gameTime)
        {
    touches = TouchPanel.GetState();

            if (CheckRectangleTouch(arlington.BoundingBox, touches))
                arlington.spritePosition = new Vector2(200, 200);
            else
                arlington.spritePosition = new Vector2(100, 100);
    }
    //This is the function 
    private bool CheckRectangleTouch(Rectangle target, TouchCollection touchCollection)
        {
            if (touchCollection.Count > 0)
                if (target.Contains(touchCollection[0].Position))
                    return true;
                
            return false;
        }

Any idea how should i detect whether I tap on a moving sprite (rectangle)?

Thanks.

Are you updating the BoundingBox and not only spritePosition?
Also, I would iterate through all touch locations and not just check the first.