PC Review


Reply
Thread Tools Rate Thread

What is better?

 
 
omtechguy
Guest
Posts: n/a
 
      3rd Feb 2012
What is better in terms of performence and what is the reason?

dr.IsRecommendToFriend =
Boolean.Parse((Request["IsRecommendToFriend"].ToString().Equals("1")) ?
"true" : Request["IsRecommendToFriend"].ToString());

or

string IsRecommendToFriend =
Request["IsRecommendToFriend"].ToString();
dr.IsRecommendToFriend =
Boolean.Parse((IsRecommendToFriend.Equals("1")) ? "true" :
IsRecommendToFriend);

Any better way to write the above?
 
Reply With Quote
 
 
 
 
Arne Vajhøj
Guest
Posts: n/a
 
      17th Feb 2012
On 2/7/2012 3:14 AM, Peter Duniho wrote:
> On Fri, 3 Feb 2012 05:15:00 -0800 (PST), omtechguy wrote:
>> What is better in terms of performence and what is the reason?

>
> The best way to answer a performance question is to test the performance of
> your available implementation choices in a real-world scenario.


It is the fastest way to get a result that looks more useful than
throwing a dice.

But in most cases the result is not more useful than throwing a
dice.

Getting results that truly reflects the performance for
the lifetime of the code is hard work.

>> Any better way to write the above?

>
> The right way to write the code is to write it in a way that is most easily
> understood and which does the best job helping anyone who might visit the
> code later to avoid breaking it.


Yep.

Arne

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:19 AM.