Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
In Line IF - Speed question or compiler issue
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00922714
Message ID:
00922721
Vues:
20
Just a guess but I would imagine that the normal if would be faster than the inline if in this case. You do 3 variable assignments in both cases but in the normal if case you only evaluate TestExpression once comared to 3 times in the inline if.

Just my 2 pennies worth.

Einar

>I have seen some code that uses the In-line IF (My words not the help file)
>
>
>expression ? trueCondition : falseCondition
>
>
>What is faster in code execution in line or straight IF structure?
>
>i.e.
>
>Is this faster than :
>
>if (TestExpression)
>{
>   DoSomething1 = true;
>   Dosomething2 = true;
>   DoSomething3 = false;
>}
>else
>{
>   DoSomething1 = false;
>   Dosomething2 = false;
>   DoSomething3 = true;
>
>}
>
>
>this..
>
>
>DoSomething1 = TestExpression ? true : false;
>Dosomething2 = TestExpression ? true : false;
>DoSomething3 = TestExpression ? false : true;
>
>
>
>
>Thanks!
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform