شرط یک خطی در c#
Sounds like you really want a Dictionary<int, string>
or possibly a switch
statement...
You can do it with the conditional operator though:
userType = user.Type == 0 ? "Admin"
: user.Type == 1 ? "User"
: user.Type == 2 ? "Employee"
: "The default you didn't specify";
While you could put that in one line, I'd strongly urge you not to.
I would normally only do this for different conditions though - not just several different possible values, which is better handled in a map.
1392/11/12 00000 Single line if statement with 2 actions مطالب آموزشی , ASP.NET , C#
اولین مرکز تخصصی غربالگری اتیسم شهر تهران در مرکز اختلال طیف اُتیسم فریحا www.AutismFariha.ir
مرکز اختلال طیف اُتیسم فریحا
پایگاه اطلاع رسانی مسعود حیدرنیا
پایگاه اطلاع رسانی مسعود حیدرنیا
وبلاگ پرهاست
چهل تکه دوزی با شادی در شادی دوز
7Agahi.ir سامانه آگهی رایگان هفت آگهی
چرکنویس ها و یاداشت های من
گروه فنی مهندسی پرهاست