Benefits of using the C# conditional ?: (ternary) operator
Not what you're looking for?
Given the expression below:
int variable = ++d >3 ?0:d;
What is the best way to write this as an if-else statement?? What is this code trying to do? What is good about using this approach? Why it is bad?
Purchase this Solution
Solution Summary
This solution discusses on C# condition evaluation ?: statement. It shows the best way to write this as an if-else statement. It explains what the code is trying to do. What is good and bad about using this approach?
Solution Preview
Dear Student,
Conditional ?: Operator implementation is attached.
This is short and compact when handling direct value comparisons and assignments, however it is not flexible as ...
Education
- BSc (Hons), University of Colombo - Sri Lanka
- MEngSc, University of Melbourne
- Certificate IV in Training & Assessment , Australian Business Council
Recent Feedback
- "Thank you!"
- "Thank you."
- "Thanks a lot for you help and support"
- "Sorry about the late payment but the assignment was sufficient and appreciated. Good work"
- "Great description! Thank you for your quick response."
Purchase this Solution
Free BrainMass Quizzes
Word 2010: Table of Contents
Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.
Word 2010: Tables
Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.
Javscript Basics
Quiz on basics of javascript programming language.
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.