Following seems old fashioned. There must be some less verbose boolean logic?
Dim intMaxQuantityToShow as integer=10
IF x > intMaxQuantityToShow Then
x = intMaxQuantityToShow
End If
Debug.Writeline(x)
this is vb.net code. if you want to write it in c# and write it in 1 line code then use ternary operator (if i call it correctly) x = x > someValue ? someValue : x ;
Answer I got from another channel: x = Math.Min(x, intMaxQuantityToShow);
this is better way.
math classses will give you some useful funcs
Обсуждают сегодня