expression - Is there a shorthand for smaller than AND greater than, in C#? -


is there shorthand this:

bool b = (x > 0) && (x < 5); 

something like:

bool b = 0 < x < 5; 

in c#?

nope. can remove brackets:

bool b = 0 < x && x < 5 

or play math:

bool b = x*x < 5*x 

Comments

Popular posts from this blog

ios - Is 'init' forbidden as *part* of a variable name? -

file - Python: AttributeError: 'str' object has no attribute 'readlines' -

c# - Get the Class name in a class with atribute inside a attribute method -