Null coalescing operator IList, Array, Enumerable.Empty in foreach

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
6
down vote

favorite
1












In this question I found the following:



int array = null;

foreach (int i in array ?? Enumerable.Empty<int>())

System.Console.WriteLine(string.Format("0", i));



and



int returnArray = Do.Something() ?? new int ;


and



... ?? new int[0]


In a NotifyCollectionChangedEventHandler I wanted to apply the Enumerable.Empty like so:



foreach (DrawingPoint drawingPoint in e.OldItems ?? Enumerable.Empty<DrawingPoint>())
this.RemovePointMarker(drawingPoint);


Note: OldItems is of the type IList



And it gives me:




Operator '??' cannot be applied to operands of type 'System.Collections.IList' and System.Collections.Generic.IEnumerable<WWSmartAufmassWpf.Data.DrawingPoint>




However



foreach (DrawingPoint drawingPoint in e.OldItems ?? new int[0])


and



foreach (DrawingPoint drawingPoint in e.OldItems ?? new int )


works just fine.



Why is that?

Why does IList ?? T work but IList ?? IEnumerable<T> doesn't?










share|improve this question



















  • 2




    T is an IList<T>, but there is no guarantee that your object that implements IEnumerable<T> implements IList<T>. You will have to cast your IList<T> object to IEnumerable<T> to use it with ?? Enumerable.Empty<T>.
    – Lasse Vågsæther Karlsen
    33 mins ago















up vote
6
down vote

favorite
1












In this question I found the following:



int array = null;

foreach (int i in array ?? Enumerable.Empty<int>())

System.Console.WriteLine(string.Format("0", i));



and



int returnArray = Do.Something() ?? new int ;


and



... ?? new int[0]


In a NotifyCollectionChangedEventHandler I wanted to apply the Enumerable.Empty like so:



foreach (DrawingPoint drawingPoint in e.OldItems ?? Enumerable.Empty<DrawingPoint>())
this.RemovePointMarker(drawingPoint);


Note: OldItems is of the type IList



And it gives me:




Operator '??' cannot be applied to operands of type 'System.Collections.IList' and System.Collections.Generic.IEnumerable<WWSmartAufmassWpf.Data.DrawingPoint>




However



foreach (DrawingPoint drawingPoint in e.OldItems ?? new int[0])


and



foreach (DrawingPoint drawingPoint in e.OldItems ?? new int )


works just fine.



Why is that?

Why does IList ?? T work but IList ?? IEnumerable<T> doesn't?










share|improve this question



















  • 2




    T is an IList<T>, but there is no guarantee that your object that implements IEnumerable<T> implements IList<T>. You will have to cast your IList<T> object to IEnumerable<T> to use it with ?? Enumerable.Empty<T>.
    – Lasse Vågsæther Karlsen
    33 mins ago













up vote
6
down vote

favorite
1









up vote
6
down vote

favorite
1






1





In this question I found the following:



int array = null;

foreach (int i in array ?? Enumerable.Empty<int>())

System.Console.WriteLine(string.Format("0", i));



and



int returnArray = Do.Something() ?? new int ;


and



... ?? new int[0]


In a NotifyCollectionChangedEventHandler I wanted to apply the Enumerable.Empty like so:



foreach (DrawingPoint drawingPoint in e.OldItems ?? Enumerable.Empty<DrawingPoint>())
this.RemovePointMarker(drawingPoint);


Note: OldItems is of the type IList



And it gives me:




Operator '??' cannot be applied to operands of type 'System.Collections.IList' and System.Collections.Generic.IEnumerable<WWSmartAufmassWpf.Data.DrawingPoint>




However



foreach (DrawingPoint drawingPoint in e.OldItems ?? new int[0])


and



foreach (DrawingPoint drawingPoint in e.OldItems ?? new int )


works just fine.



Why is that?

Why does IList ?? T work but IList ?? IEnumerable<T> doesn't?










share|improve this question















In this question I found the following:



int array = null;

foreach (int i in array ?? Enumerable.Empty<int>())

System.Console.WriteLine(string.Format("0", i));



and



int returnArray = Do.Something() ?? new int ;


and



... ?? new int[0]


In a NotifyCollectionChangedEventHandler I wanted to apply the Enumerable.Empty like so:



foreach (DrawingPoint drawingPoint in e.OldItems ?? Enumerable.Empty<DrawingPoint>())
this.RemovePointMarker(drawingPoint);


Note: OldItems is of the type IList



And it gives me:




Operator '??' cannot be applied to operands of type 'System.Collections.IList' and System.Collections.Generic.IEnumerable<WWSmartAufmassWpf.Data.DrawingPoint>




However



foreach (DrawingPoint drawingPoint in e.OldItems ?? new int[0])


and



foreach (DrawingPoint drawingPoint in e.OldItems ?? new int )


works just fine.



Why is that?

Why does IList ?? T work but IList ?? IEnumerable<T> doesn't?







c# .net collections null-coalescing-operator






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 40 mins ago









Gilad Green

28.7k52953




28.7k52953










asked 41 mins ago









IDarkCoder

1417




1417







  • 2




    T is an IList<T>, but there is no guarantee that your object that implements IEnumerable<T> implements IList<T>. You will have to cast your IList<T> object to IEnumerable<T> to use it with ?? Enumerable.Empty<T>.
    – Lasse Vågsæther Karlsen
    33 mins ago













  • 2




    T is an IList<T>, but there is no guarantee that your object that implements IEnumerable<T> implements IList<T>. You will have to cast your IList<T> object to IEnumerable<T> to use it with ?? Enumerable.Empty<T>.
    – Lasse Vågsæther Karlsen
    33 mins ago








2




2




T is an IList<T>, but there is no guarantee that your object that implements IEnumerable<T> implements IList<T>. You will have to cast your IList<T> object to IEnumerable<T> to use it with ?? Enumerable.Empty<T>.
– Lasse Vågsæther Karlsen
33 mins ago





T is an IList<T>, but there is no guarantee that your object that implements IEnumerable<T> implements IList<T>. You will have to cast your IList<T> object to IEnumerable<T> to use it with ?? Enumerable.Empty<T>.
– Lasse Vågsæther Karlsen
33 mins ago













2 Answers
2






active

oldest

votes

















up vote
6
down vote



accepted










When using this expression:



a ?? b


Then b either must be the same type as a, or it must be implicitly castable to that type, which with references means that it has to implement or inherit from whatever type a is.



These work:



SomethingThatIsIListOfT ?? new T[0]
SomethingThatIsIListOfT ?? new T


because T is an IList<T>, the array type implements that interface.



However, this won't work:



SomethingThatIsIListOfT ?? SomethingThatImplementsIEnumerableOfT


because the type of the expression will be the a type, and the compiler is obviously unable to guarantee that SomethingThatImplementsIEnumerableOfT also implements IList<T>.



You're going to have to cast one of the two sides so that you have compatible types:



(IEnumerable<T>)SomethingThatIsIListOfT ?? SomethingThatImplementsIEnumerableOfT


Now the type of the expression is IEnumerable<T> and the ?? operator can do its thing.




The "type of the expression will be the type of a" is a bit simplified, the full text from the specification is as follows:




The type of the expression a ?? b depends on which implicit conversions are available on the operands. In order of preference, the type of a ?? b is A0, A, or B, where A is the type of a (provided that a has a type), B is the type of b (provided that b has a type), and A0 is the underlying type of A if A is a nullable type, or A otherwise. Specifically, a ?? b is processed as follows:



  • If A exists and is not a nullable type or a reference type, a compile-time error occurs.

  • If b is a dynamic expression, the result type is dynamic. At runtime, a is first evaluated. If a is not null, a is converted to a dynamic type, and this becomes the result. Otherwise, b is evaluated, and the outcome becomes the result.

  • Otherwise, if A exists and is a nullable type and an implicit conversion exists from b to A0, the result type is A0. At runtime, a is first evaluated. If a is not null, a is unwrapped to type A0, and it becomes the result. Otherwise, b is evaluated and converted to type A0, and it becomes the result.

  • Otherwise, if A exists and an implicit conversion exists from b to A, the result type is A. At runtime, a is first evaluated. If a is not null, a becomes the result. Otherwise, b is evaluated and converted to type A, and it becomes the result.

  • Otherwise, if b has a type B and an implicit conversion exists from a to B, the result type is B. At runtime, a is first evaluated. If a is not null, a is unwrapped to type A0 (if A exists and is nullable) and converted to type B, and it becomes the result. Otherwise, b is evaluated and becomes the result.

  • Otherwise, a and b are incompatible, and a compile-time error occurs.





share|improve this answer






















  • Thank you. In the .NET Documentation on the Array Class you can see that it implements System.Collections.IList. Is there in equivalent for Enumerable.Empty<T> for IList?
    – IDarkCoder
    26 mins ago











  • Other than new T[0], I don't know of any, there could be something that I don't know about of course.
    – Lasse Vågsæther Karlsen
    20 mins ago

















up vote
1
down vote













I believe that it determines the type of result by the firs member which in your case is IList. The first case works because an array implements IList. With IEnumerable it's not true.



It's just my speculation, as there are no details in the documentation for ?? operator online.



UPD. As it pointed out in accepted question, there are a lot more details on the topic in C# Specification (ECMA or on GitHub)






share|improve this answer


















  • 1




    The C# specification has explicit details, I've included it in my own answer.
    – Lasse Vågsæther Karlsen
    23 mins ago










  • @LasseVÃ¥gsætherKarlsen, oh cool, thanks!
    – Stas Ivanov
    20 mins ago










Your Answer





StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52380876%2fnull-coalescing-operator-ilist-array-enumerable-empty-in-foreach%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
6
down vote



accepted










When using this expression:



a ?? b


Then b either must be the same type as a, or it must be implicitly castable to that type, which with references means that it has to implement or inherit from whatever type a is.



These work:



SomethingThatIsIListOfT ?? new T[0]
SomethingThatIsIListOfT ?? new T


because T is an IList<T>, the array type implements that interface.



However, this won't work:



SomethingThatIsIListOfT ?? SomethingThatImplementsIEnumerableOfT


because the type of the expression will be the a type, and the compiler is obviously unable to guarantee that SomethingThatImplementsIEnumerableOfT also implements IList<T>.



You're going to have to cast one of the two sides so that you have compatible types:



(IEnumerable<T>)SomethingThatIsIListOfT ?? SomethingThatImplementsIEnumerableOfT


Now the type of the expression is IEnumerable<T> and the ?? operator can do its thing.




The "type of the expression will be the type of a" is a bit simplified, the full text from the specification is as follows:




The type of the expression a ?? b depends on which implicit conversions are available on the operands. In order of preference, the type of a ?? b is A0, A, or B, where A is the type of a (provided that a has a type), B is the type of b (provided that b has a type), and A0 is the underlying type of A if A is a nullable type, or A otherwise. Specifically, a ?? b is processed as follows:



  • If A exists and is not a nullable type or a reference type, a compile-time error occurs.

  • If b is a dynamic expression, the result type is dynamic. At runtime, a is first evaluated. If a is not null, a is converted to a dynamic type, and this becomes the result. Otherwise, b is evaluated, and the outcome becomes the result.

  • Otherwise, if A exists and is a nullable type and an implicit conversion exists from b to A0, the result type is A0. At runtime, a is first evaluated. If a is not null, a is unwrapped to type A0, and it becomes the result. Otherwise, b is evaluated and converted to type A0, and it becomes the result.

  • Otherwise, if A exists and an implicit conversion exists from b to A, the result type is A. At runtime, a is first evaluated. If a is not null, a becomes the result. Otherwise, b is evaluated and converted to type A, and it becomes the result.

  • Otherwise, if b has a type B and an implicit conversion exists from a to B, the result type is B. At runtime, a is first evaluated. If a is not null, a is unwrapped to type A0 (if A exists and is nullable) and converted to type B, and it becomes the result. Otherwise, b is evaluated and becomes the result.

  • Otherwise, a and b are incompatible, and a compile-time error occurs.





share|improve this answer






















  • Thank you. In the .NET Documentation on the Array Class you can see that it implements System.Collections.IList. Is there in equivalent for Enumerable.Empty<T> for IList?
    – IDarkCoder
    26 mins ago











  • Other than new T[0], I don't know of any, there could be something that I don't know about of course.
    – Lasse Vågsæther Karlsen
    20 mins ago














up vote
6
down vote



accepted










When using this expression:



a ?? b


Then b either must be the same type as a, or it must be implicitly castable to that type, which with references means that it has to implement or inherit from whatever type a is.



These work:



SomethingThatIsIListOfT ?? new T[0]
SomethingThatIsIListOfT ?? new T


because T is an IList<T>, the array type implements that interface.



However, this won't work:



SomethingThatIsIListOfT ?? SomethingThatImplementsIEnumerableOfT


because the type of the expression will be the a type, and the compiler is obviously unable to guarantee that SomethingThatImplementsIEnumerableOfT also implements IList<T>.



You're going to have to cast one of the two sides so that you have compatible types:



(IEnumerable<T>)SomethingThatIsIListOfT ?? SomethingThatImplementsIEnumerableOfT


Now the type of the expression is IEnumerable<T> and the ?? operator can do its thing.




The "type of the expression will be the type of a" is a bit simplified, the full text from the specification is as follows:




The type of the expression a ?? b depends on which implicit conversions are available on the operands. In order of preference, the type of a ?? b is A0, A, or B, where A is the type of a (provided that a has a type), B is the type of b (provided that b has a type), and A0 is the underlying type of A if A is a nullable type, or A otherwise. Specifically, a ?? b is processed as follows:



  • If A exists and is not a nullable type or a reference type, a compile-time error occurs.

  • If b is a dynamic expression, the result type is dynamic. At runtime, a is first evaluated. If a is not null, a is converted to a dynamic type, and this becomes the result. Otherwise, b is evaluated, and the outcome becomes the result.

  • Otherwise, if A exists and is a nullable type and an implicit conversion exists from b to A0, the result type is A0. At runtime, a is first evaluated. If a is not null, a is unwrapped to type A0, and it becomes the result. Otherwise, b is evaluated and converted to type A0, and it becomes the result.

  • Otherwise, if A exists and an implicit conversion exists from b to A, the result type is A. At runtime, a is first evaluated. If a is not null, a becomes the result. Otherwise, b is evaluated and converted to type A, and it becomes the result.

  • Otherwise, if b has a type B and an implicit conversion exists from a to B, the result type is B. At runtime, a is first evaluated. If a is not null, a is unwrapped to type A0 (if A exists and is nullable) and converted to type B, and it becomes the result. Otherwise, b is evaluated and becomes the result.

  • Otherwise, a and b are incompatible, and a compile-time error occurs.





share|improve this answer






















  • Thank you. In the .NET Documentation on the Array Class you can see that it implements System.Collections.IList. Is there in equivalent for Enumerable.Empty<T> for IList?
    – IDarkCoder
    26 mins ago











  • Other than new T[0], I don't know of any, there could be something that I don't know about of course.
    – Lasse Vågsæther Karlsen
    20 mins ago












up vote
6
down vote



accepted







up vote
6
down vote



accepted






When using this expression:



a ?? b


Then b either must be the same type as a, or it must be implicitly castable to that type, which with references means that it has to implement or inherit from whatever type a is.



These work:



SomethingThatIsIListOfT ?? new T[0]
SomethingThatIsIListOfT ?? new T


because T is an IList<T>, the array type implements that interface.



However, this won't work:



SomethingThatIsIListOfT ?? SomethingThatImplementsIEnumerableOfT


because the type of the expression will be the a type, and the compiler is obviously unable to guarantee that SomethingThatImplementsIEnumerableOfT also implements IList<T>.



You're going to have to cast one of the two sides so that you have compatible types:



(IEnumerable<T>)SomethingThatIsIListOfT ?? SomethingThatImplementsIEnumerableOfT


Now the type of the expression is IEnumerable<T> and the ?? operator can do its thing.




The "type of the expression will be the type of a" is a bit simplified, the full text from the specification is as follows:




The type of the expression a ?? b depends on which implicit conversions are available on the operands. In order of preference, the type of a ?? b is A0, A, or B, where A is the type of a (provided that a has a type), B is the type of b (provided that b has a type), and A0 is the underlying type of A if A is a nullable type, or A otherwise. Specifically, a ?? b is processed as follows:



  • If A exists and is not a nullable type or a reference type, a compile-time error occurs.

  • If b is a dynamic expression, the result type is dynamic. At runtime, a is first evaluated. If a is not null, a is converted to a dynamic type, and this becomes the result. Otherwise, b is evaluated, and the outcome becomes the result.

  • Otherwise, if A exists and is a nullable type and an implicit conversion exists from b to A0, the result type is A0. At runtime, a is first evaluated. If a is not null, a is unwrapped to type A0, and it becomes the result. Otherwise, b is evaluated and converted to type A0, and it becomes the result.

  • Otherwise, if A exists and an implicit conversion exists from b to A, the result type is A. At runtime, a is first evaluated. If a is not null, a becomes the result. Otherwise, b is evaluated and converted to type A, and it becomes the result.

  • Otherwise, if b has a type B and an implicit conversion exists from a to B, the result type is B. At runtime, a is first evaluated. If a is not null, a is unwrapped to type A0 (if A exists and is nullable) and converted to type B, and it becomes the result. Otherwise, b is evaluated and becomes the result.

  • Otherwise, a and b are incompatible, and a compile-time error occurs.





share|improve this answer














When using this expression:



a ?? b


Then b either must be the same type as a, or it must be implicitly castable to that type, which with references means that it has to implement or inherit from whatever type a is.



These work:



SomethingThatIsIListOfT ?? new T[0]
SomethingThatIsIListOfT ?? new T


because T is an IList<T>, the array type implements that interface.



However, this won't work:



SomethingThatIsIListOfT ?? SomethingThatImplementsIEnumerableOfT


because the type of the expression will be the a type, and the compiler is obviously unable to guarantee that SomethingThatImplementsIEnumerableOfT also implements IList<T>.



You're going to have to cast one of the two sides so that you have compatible types:



(IEnumerable<T>)SomethingThatIsIListOfT ?? SomethingThatImplementsIEnumerableOfT


Now the type of the expression is IEnumerable<T> and the ?? operator can do its thing.




The "type of the expression will be the type of a" is a bit simplified, the full text from the specification is as follows:




The type of the expression a ?? b depends on which implicit conversions are available on the operands. In order of preference, the type of a ?? b is A0, A, or B, where A is the type of a (provided that a has a type), B is the type of b (provided that b has a type), and A0 is the underlying type of A if A is a nullable type, or A otherwise. Specifically, a ?? b is processed as follows:



  • If A exists and is not a nullable type or a reference type, a compile-time error occurs.

  • If b is a dynamic expression, the result type is dynamic. At runtime, a is first evaluated. If a is not null, a is converted to a dynamic type, and this becomes the result. Otherwise, b is evaluated, and the outcome becomes the result.

  • Otherwise, if A exists and is a nullable type and an implicit conversion exists from b to A0, the result type is A0. At runtime, a is first evaluated. If a is not null, a is unwrapped to type A0, and it becomes the result. Otherwise, b is evaluated and converted to type A0, and it becomes the result.

  • Otherwise, if A exists and an implicit conversion exists from b to A, the result type is A. At runtime, a is first evaluated. If a is not null, a becomes the result. Otherwise, b is evaluated and converted to type A, and it becomes the result.

  • Otherwise, if b has a type B and an implicit conversion exists from a to B, the result type is B. At runtime, a is first evaluated. If a is not null, a is unwrapped to type A0 (if A exists and is nullable) and converted to type B, and it becomes the result. Otherwise, b is evaluated and becomes the result.

  • Otherwise, a and b are incompatible, and a compile-time error occurs.






share|improve this answer














share|improve this answer



share|improve this answer








edited 16 mins ago

























answered 30 mins ago









Lasse Vågsæther Karlsen

279k80509707




279k80509707











  • Thank you. In the .NET Documentation on the Array Class you can see that it implements System.Collections.IList. Is there in equivalent for Enumerable.Empty<T> for IList?
    – IDarkCoder
    26 mins ago











  • Other than new T[0], I don't know of any, there could be something that I don't know about of course.
    – Lasse Vågsæther Karlsen
    20 mins ago
















  • Thank you. In the .NET Documentation on the Array Class you can see that it implements System.Collections.IList. Is there in equivalent for Enumerable.Empty<T> for IList?
    – IDarkCoder
    26 mins ago











  • Other than new T[0], I don't know of any, there could be something that I don't know about of course.
    – Lasse Vågsæther Karlsen
    20 mins ago















Thank you. In the .NET Documentation on the Array Class you can see that it implements System.Collections.IList. Is there in equivalent for Enumerable.Empty<T> for IList?
– IDarkCoder
26 mins ago





Thank you. In the .NET Documentation on the Array Class you can see that it implements System.Collections.IList. Is there in equivalent for Enumerable.Empty<T> for IList?
– IDarkCoder
26 mins ago













Other than new T[0], I don't know of any, there could be something that I don't know about of course.
– Lasse Vågsæther Karlsen
20 mins ago




Other than new T[0], I don't know of any, there could be something that I don't know about of course.
– Lasse Vågsæther Karlsen
20 mins ago












up vote
1
down vote













I believe that it determines the type of result by the firs member which in your case is IList. The first case works because an array implements IList. With IEnumerable it's not true.



It's just my speculation, as there are no details in the documentation for ?? operator online.



UPD. As it pointed out in accepted question, there are a lot more details on the topic in C# Specification (ECMA or on GitHub)






share|improve this answer


















  • 1




    The C# specification has explicit details, I've included it in my own answer.
    – Lasse Vågsæther Karlsen
    23 mins ago










  • @LasseVÃ¥gsætherKarlsen, oh cool, thanks!
    – Stas Ivanov
    20 mins ago














up vote
1
down vote













I believe that it determines the type of result by the firs member which in your case is IList. The first case works because an array implements IList. With IEnumerable it's not true.



It's just my speculation, as there are no details in the documentation for ?? operator online.



UPD. As it pointed out in accepted question, there are a lot more details on the topic in C# Specification (ECMA or on GitHub)






share|improve this answer


















  • 1




    The C# specification has explicit details, I've included it in my own answer.
    – Lasse Vågsæther Karlsen
    23 mins ago










  • @LasseVÃ¥gsætherKarlsen, oh cool, thanks!
    – Stas Ivanov
    20 mins ago












up vote
1
down vote










up vote
1
down vote









I believe that it determines the type of result by the firs member which in your case is IList. The first case works because an array implements IList. With IEnumerable it's not true.



It's just my speculation, as there are no details in the documentation for ?? operator online.



UPD. As it pointed out in accepted question, there are a lot more details on the topic in C# Specification (ECMA or on GitHub)






share|improve this answer














I believe that it determines the type of result by the firs member which in your case is IList. The first case works because an array implements IList. With IEnumerable it's not true.



It's just my speculation, as there are no details in the documentation for ?? operator online.



UPD. As it pointed out in accepted question, there are a lot more details on the topic in C# Specification (ECMA or on GitHub)







share|improve this answer














share|improve this answer



share|improve this answer








edited 14 mins ago

























answered 31 mins ago









Stas Ivanov

195211




195211







  • 1




    The C# specification has explicit details, I've included it in my own answer.
    – Lasse Vågsæther Karlsen
    23 mins ago










  • @LasseVÃ¥gsætherKarlsen, oh cool, thanks!
    – Stas Ivanov
    20 mins ago












  • 1




    The C# specification has explicit details, I've included it in my own answer.
    – Lasse Vågsæther Karlsen
    23 mins ago










  • @LasseVÃ¥gsætherKarlsen, oh cool, thanks!
    – Stas Ivanov
    20 mins ago







1




1




The C# specification has explicit details, I've included it in my own answer.
– Lasse Vågsæther Karlsen
23 mins ago




The C# specification has explicit details, I've included it in my own answer.
– Lasse Vågsæther Karlsen
23 mins ago












@LasseVågsætherKarlsen, oh cool, thanks!
– Stas Ivanov
20 mins ago




@LasseVågsætherKarlsen, oh cool, thanks!
– Stas Ivanov
20 mins ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52380876%2fnull-coalescing-operator-ilist-array-enumerable-empty-in-foreach%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

List of Gilmore Girls characters

One-line joke