Why? appear in IEnumerable <int>?. ToList ()?
I was looking at the code and I came across the following line of code:
List authorIntList = authorIds?.ToList();
In the above example, authorIds is IEnumerable. What is the purpose of ?the line of code above? I'm not sure I have ever seen this template before. What does it do and in what version of .NET was it implemented?
+4
4 answers
Null correction Conditional statement https://msdn.microsoft.com/en-us/library/dn986595.aspx
I like to say that authorId is not null, then executing ToList () else returns null.
-1