Case Statement within Linq
var numberText =
(
from n in numbers
where n > 0
select new
{
Number = n,
Text =
(
n == 1 ? "One" :
n == 2 ? "Two" :
n == 3 ? "Three" : "Unknown"
)
}
);
Comments