How to exit multiselect Command?

Hi,

I want to provide a function that allows the user to select an unknown number of points. I achieved this by using the following code. However, I don't know, how to exit the function. Ideally, I would capture, when the escape key is beeing pressed, but I don't know how to do this.

 while (true)
    {
        PromptResult pointCode;

        PromptPointOptions pop = new PromptPointOptions("Select Point");
        PromptPointResult res = editor.GetPoint(pop);
        Punktbezeichnung = editor.GetString("Enter Point Code:");

        Application.ShowAlertDialog(pointCode+ " " + res.ToString());
    }

Thanks!