Home Dashboard Directory Help
Search

?. Operator by Olmo


Status: 

Closed
 as Won't Fix Help for as Won't Fix


21
1
Sign in
to vote
Type: Suggestion
ID: 296616
Opened: 9/4/2007 9:55:21 AM
Access Restriction: Public
0
Workaround(s)
view

Description

Writing expressions and queries that avoid throwing NullReferenceException are cumbersome. The ternary operator is powerful and the new ?? operator are great. But there’s still place for a new operator
Details
Sign in to post a comment.
Posted by Microsoft on 4/24/2008 at 6:15 PM
Hi,

I'm closing this issue as per Mads and your response.

Thanks for your feedback!

Marcelo Guerra
C# Compiler QA
Posted by Olmo on 4/24/2008 at 5:27 PM
Thanks for the answer Mads, it's the sweettest 'No' I've ever received.

While I still thinking it would be a nice operator, I completely undestand that the feature could not fit so nicely in the C# spec as I thought.

Also my Try extension methods is more general (you can write customer.Try(c=>list.Add(c)) ) and doesn't look so bad. I can live with it.

Thanks for giving us C# 3 and good look en the next version.

Posted by Microsoft on 4/24/2008 at 4:41 PM
Thanks again for your suggestion. After having done feature planning for the next release of C# I regret to say that this feature is not being added. We have to do some harsh prioritization, both because of our implementation and testing resources, but also because we need to keep the number of new langauge features at a manageable level - depending on how you count, we are adding only four language features to C# this time around. Unfortunately many great suggestions just can't make it in because of that.

I apologize that this is a "canned" follow-up answer, sent out as a result of our feature planning for the next release. In most cases I or someone else already replied individually to your suggestion - please let us know if you feel it hasn't been adequately addressed.

Thanks again for taking the time to share your ideas with us. Please keep them coming!

Mads Torgersen, C# Language PM.
Posted by David Liebeherr on 9/24/2007 at 12:05 PM
I vote too for the ?. Operator! This could been an extremely usefull Operator and one further step for .Net to compete against Java.

BTW: Thanks MS for C# 3.0 and especialy for LINQ/DLINQ!
Posted by timlajaunie on 9/11/2007 at 7:35 AM
If ?? made it into the language, ?. should be viewed as a necessity. I agree with Dany_Laporte that ?. would be used far more than ??.
Posted by orangy on 9/11/2007 at 2:58 AM
Could be VERY helpful!
Posted by Microsoft on 9/10/2007 at 4:17 PM
Thank you for your suggestion.

We discussed this exact operator during the design of C# 3.0. We ended up not doing it because we were unsure about the value, and were short on time, but I don't think it is off the table for good. We'll discuss it some more for the next release.

Thanks again,

Mads Torgersen, C# Language PM
Posted by Richard Brunet on 9/5/2007 at 6:00 AM
I'd recommend this operator too.
Posted by Dany Laporte on 9/4/2007 at 10:15 AM
Definitively a very usefull operator. I would use it more than the ?? operator.
Sign in to post a workaround.