if (a > b) { result = x; } else { result = y; }
yвІ in the following more generic line of code:
What this means is: If Guid is NOT empty, t_Id will equal t_Id.GetHashCode(), otherwise, t_Id will equal Id.GetHashCode().
t_Id != Guid.Empty ? t_Id.GetHashCode() : Id.GetHashCode();
What it does, is this simple operation: if a condition is true, then return one value, otherwise, return another value. For example, in the following piece of code:
I find it in some colleagueвІЂЂЂs code, or I find myself needing to use it, and BAM! I canвІЂЂЂt remember how it works.
Probably the element that I have checked more times than anything else, is the ternary operator.
I might be the only one but I find myself, time after time, needing to go back to some of the most basic elements of programming.
Комментариев нет:
Отправить комментарий