Reputation: 35400
I recall I read this somewhere but am not able to find it in Google results now.
Does the newest C# (VS2013) support any such operator?
SomeObject.?SomeMember = SomeValue;
This is supposed to assign SomeValue
to SomeObject.SomeMember
only if SomeObject
is not null.
N.B: I know we can do this through HasValue
and other ways. I'm just asking about the new operator.
Upvotes: 4
Views: 250
Reputation:
It is available in the Roslyn
compiler and it's called Null-propagation - it's already implemented. Roslyn compiler will be available in VS 14 by default.
Upvotes: 1
Reputation: 4744
No, Visual Studio 2013 does not support such operator. Not out of the box at least.
If you want to use the null propagation operator, or any other C# 6 feature, you will have to install and use the CTP of Roslyn. Roslyn will be the default compile of Visual studio "14" though (we don't know its definitive name yet).
Upvotes: 0
Reputation: 101681
Well it has nothing to do with Nullable
types.It's null propagation operator and will work for each type that can be null, not just for Nullable<T>
, reference types as well.
Does the newest C# (VS2013) support any such operator?
You could install Roslyn end user preview if you are using VS 2013, or Visual Studio 14 CTP 3
Upvotes: 5