jgd1234567
Programmer
Hi, i haven't been programming in c# for long and was wondering how i could rewrite the code below to be alot nice:
I haven't quite mastered the art of casting. Appreciate your help. Thanks
Code:
int width = 100;
int height = 130;
float ratio = (float)image.Width / (float)image.Height;
if ((float)width / (float)height > ratio)
width = (int)Math.Round((float)height * (float)ratio);
else
height = (int)Math.Round((float)width / (float)ratio);
I haven't quite mastered the art of casting. Appreciate your help. Thanks