C#+VB.net代替Thread.Sleep

VB.net

Public Sub Delay(ByVal mm As Long)
    Dim current = DateTime.Now
    While current.AddMilliseconds(mm) > DateTime.Now
        Application.DoEvents()
    End While
End Sub

C#

public static void Delay(int mm)
{
    DateTime current = DateTime.Now;
    while (current.AddMilliseconds(mm) > DateTime.Now)
    {
        Application.DoEvents();
    }
    return;
}

你可能感兴趣的:(C#+VB.net代替Thread.Sleep)