+ 1
Using "Double" for Thread.Sleep()
Hello Friends, my question is if it is possible to somehow change the type of variable "v" from INT to DOUBLE for example? I've tried several not really clever ways, but it feels i'm too young in it to understand. So i need your Help! :) public static void Sleep(int v) { const int a = 500; Thread.Sleep(a * v); }
2 Réponses
+ 1
you could cast from double to int after multiplying,
public static void Sleep(double v) {
const int a = 500;
Thread.Sleep((int)(a * v));
}
You could also round it, as casting to int truncates.
+ 1
Great, thank you so much! :)