?? behaviour is different in Visual Studio (TEST BUG)
Bug #245330 reported by
Krisztian Gyuris
This bug report was converted into a question: question #38144: ?? behaviour is different in Visual Studio (TEST BUG).
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
WIN Do |
Invalid
|
Undecided
|
Unassigned |
Bug Description
The code is sprinkled with statements like this:
return listOfInts ?? listOfInts = new List<int>;
However this is not accepted by the the C# compiler in Visual Studio. I
To post a comment you must log in.
The following code can replace the statement and it works, although it is much longer:
if(listOfInts == null)
{
listOfInts = new List<int>;
}
return listOFInts;
This works, but is there any way to do this with the use of ?? operator?