TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kirti Deshpande
NA
108
17k
How to Optimize the code with ternary conditional operator ?:
May 10 2021 3:55 PM
How can I Optimize below code with ternary conditional operator ?:
I am new to Linq Need to know some optimization with operator ?:
Thank you
private
string
GetFunctionId(FunctionType functionType)
{
string
_Id;
int
_Count;
if
(
functionType
== FunctionType.abc)
{
_Count = Collection.Where(f => f.Function ==
functionType
).Count();
_Id = String.Format(
"{0}{1}"
,
"A"
, Count + 1);
return
_Id;
}
else
{
Count = Collection.Where(f => f.Function != TimeProgramFunctionType.FunctionType).Count();
_Id = String.Format(
"{0}{1}"
,
"B"
, Count + 1);
return
_Id;
}
}
Output should Be
if true A1,A2,A3
else B1,B2,B3
Reply
Answers (
1
)
What type of chart series can I use for creating Bubble chart?
Linq using C# programming