I have this prog开发者_开发问答ram, which prints a sine wave but it's too fast, how can I slow down the console's line printing speed?
Sub Main()
Dim x As Double = 0
Do
Console.Write(times(" ", Math.Sin(x) * 10 + 30))
Console.WriteLine("@")
x += 0.1
Loop
End Sub
Private Function times(ByVal ch As Char, ByVal t As Integer) As String
Dim result As String = ""
For i = 0 To t
result += ch
Next
Return result
End Function
You can write Thread.Sleep(TimeSpan.FromHours(1))
.
(Although you may want FromSeconds
instead)
I usually prefer: System.Threading.Thread.Sleep(miliseconds)
, easier syntax in my own opinion of course. ;-)
精彩评论