Avatar of brgdotnet
brgdotnetFlag for United States of America

asked on 

Decipher some code

I am maintaining some C# code. I see a line of code which seems to be doing a boolean assignment based upon a comparison. I rewrote the code. Is my re-written code lines (10 through 18) the equivalent of lines 1 to 3?


// Before:

1  bool chiso;

2  chiso = aValue == "Yes"


// After :

10 bool chiso = false;

11 if(aValue == "Yes")

12 {

 13  chiso = true;

 14 }

15 else

16 {

17  chiso = false;

18 }

C#

Avatar of undefined
Last Comment
AndyAinscow
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

you don't need the else es 15-18
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
C#
C#

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

98K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo