Click here to Skip to main content
15,886,919 members

The Insider News

   

The Insider News is for breaking IT and Software development news. Post your news, your alerts and your inside scoops. This is an IT news-only forum - all off-topic, non-news posts will be removed. If you wish to ask a programming question please post it here.

Get The Daily Insider direct to your mailbox every day. Subscribe now!

 
GeneralRe: The new ?. Operator in C# 6 Pin
Mike Hankey19-Apr-15 6:50
mveMike Hankey19-Apr-15 6:50 
GeneralRe: The new ?. Operator in C# 6 Pin
PIEBALDconsult19-Apr-15 6:54
mvePIEBALDconsult19-Apr-15 6:54 
GeneralRe: The new ?. Operator in C# 6 Pin
Ranjan.D19-Apr-15 7:22
professionalRanjan.D19-Apr-15 7:22 
AnswerRe: The new ?. Operator in C# 6 Pin
Afzaal Ahmad Zeeshan19-Apr-15 7:40
professionalAfzaal Ahmad Zeeshan19-Apr-15 7:40 
GeneralRe: The new ?. Operator in C# 6 Pin
Richard Deeming20-Apr-15 4:14
mveRichard Deeming20-Apr-15 4:14 
GeneralRe: The new ?. Operator in C# 6 Pin
Marc Clifton19-Apr-15 9:48
mvaMarc Clifton19-Apr-15 9:48 
GeneralRe: The new ?. Operator in C# 6 Pin
PIEBALDconsult19-Apr-15 10:05
mvePIEBALDconsult19-Apr-15 10:05 
GeneralRe: The new ?. Operator in C# 6 Pin
BillWoodruff19-Apr-15 22:13
professionalBillWoodruff19-Apr-15 22:13 
Marc Clifton wrote:
"WTF am I writing this? I better have a damn good reason.
A "damn good reason" could be that you will have no control over the code/behavior of other people who will use/abuse your code ! Or, your code may access resources/data/feed you have no control over which could be null.

I would distinguish between cases where:
  1. checking for null is a "benign" requirement, like checking the result of a TryParse call
  2. cases where checking for null means something may be "wrong" but you still want to continue for example: when your program depends on an externally supplied object which you have no control over.
  3. cases where checking for null is essential because if the result is null then there is something totally "wrong" with the current state, and you do not want to continue.
In the third case, I would throw an error.

By the way, I recall reading comments on a StackOverFlow thread claiming that using the Ternary operator is extremely slow compared to using 'if/else. See: [^]

cheers, Bill
«To kill an error's as good a service, sometimes better than, establishing new truth or fact.» Charles Darwin in "Prospero's Precepts"


modified 20-Apr-15 6:09am.

NewsMeet Sam the creepiest talking head yet ... from Hanson Robotics Pin
BillWoodruff18-Apr-15 11:23
professionalBillWoodruff18-Apr-15 11:23 
GeneralRe: Meet Sam the creepiest talking head yet ... from Hanson Robotics Pin
DaveX8618-Apr-15 13:10
DaveX8618-Apr-15 13:10 
NewsGaming Startup Code Kingdoms exits beta on a quest to get kids coding Pin
Kent Sharkey16-Apr-15 13:30
staffKent Sharkey16-Apr-15 13:30 
GeneralRe: Gaming Startup Code Kingdoms exits beta on a quest to get kids coding Pin
den2k8816-Apr-15 21:12
professionalden2k8816-Apr-15 21:12 
NewsBing Reaches 20 Percent Search Market Share Milestone In US Pin
Kent Sharkey16-Apr-15 13:28
staffKent Sharkey16-Apr-15 13:28 
GeneralRe: Bing Reaches 20 Percent Search Market Share Milestone In US Pin
Agent__00716-Apr-15 17:10
professionalAgent__00716-Apr-15 17:10 
NewsIT Skills & Salary Report 2015: Skills gap is also an opportunity Pin
Kent Sharkey16-Apr-15 13:27
staffKent Sharkey16-Apr-15 13:27 
GeneralRe: IT Skills & Salary Report 2015: Skills gap is also an opportunity Pin
PIEBALDconsult16-Apr-15 13:54
mvePIEBALDconsult16-Apr-15 13:54 
NewsMIT develops wireless trackpad for your thumbnail Pin
Kent Sharkey16-Apr-15 13:22
staffKent Sharkey16-Apr-15 13:22 
NewsMoore's Law at 50: The past and future Pin
Kent Sharkey16-Apr-15 11:13
staffKent Sharkey16-Apr-15 11:13 
GeneralRe: Moore's Law at 50: The past and future Pin
Mark_Wallace16-Apr-15 23:08
Mark_Wallace16-Apr-15 23:08 
GeneralRe: Moore's Law at 50: The past and future Pin
Bassam Abdul-Baki17-Apr-15 1:15
professionalBassam Abdul-Baki17-Apr-15 1:15 
NewsIt's an open-source world: ​78 percent of companies run open-source software Pin
Kent Sharkey16-Apr-15 11:05
staffKent Sharkey16-Apr-15 11:05 
NewsMessage Closed Pin
16-Apr-15 10:59
Irit Gillath16-Apr-15 10:59 
GeneralMessage Removed Pin
16-Apr-15 11:11
Galileo100016-Apr-15 11:11 
GeneralMessage Removed Pin
17-Apr-15 2:12
mveDave Kreskowiak17-Apr-15 2:12 
NewsDocker launches command line interface for Windows Pin
Kent Sharkey16-Apr-15 10:49
staffKent Sharkey16-Apr-15 10:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.