Can cancel or stop a Task?

ClawRageClawRage Member ✭✭
edited June 3 in Xamarin.Forms

if I use a Task to run somethings ,can I cancel it some way?
maybe like:

int main()
{
CreatBox();
}

async void CreatBox()
{
     for(int i=0:i<100;i++)
    {
    Task.Delay(1000);
    StackLayout.Children.Add(new BoxView());
    }
}

    private void _Button_A_Clicked(object sender, EventArgs e)
    {
        //cancel <CreatBox>,no matter loop times
    }

Best Answers

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    @ClawRage Are there any updates for this issue? If the reply is helpful, please try to mark it as an answer, it will help others who have similar issue.

Sign In or Register to comment.