Which is faster in c# either
int a = 10;
bool _IsEven;
if(a%2 == 0)
{
_IsEven = true;
}
else
{
_IsEven = false;
}
Or
int a = 10;
bool _IsEven = a%2 == 0 ? true : false;
UPDATE
I know here I can optimize my code just writing
bool _IsEven = a%2 == 0;
But my question is not about code optimization rather it is regarding about performance of these two statements???
Can you please help me to improve my coding knowledge?
Aucun commentaire:
Enregistrer un commentaire