Re:Tips and Tricks for Asp.net Core Applications
by mandeepj on Saturday March 02, 2019 @07:10PM
(#19291929)
I think you had misread it. Author was commenting on other developers who have written following code - "How often do .NET developers write something like this:". And, was not promoting this approach.
var someCollection = GetSomeCollectionFromSomewhere();
if (someCollection != null && someCollection.Count > 0)
{
foreach(var item in someCollection)
{
// Do stuff
}
}
var someCollection = GetSomeCollectionFromSomewhere();
if (someCollection != null && someCollection.Count > 0) { foreach(var item in someCollection) { // Do stuff } }