Is this good or bad:
foreach (Match match in serverNameRegex.Matches(loginPage))
{
....
}
or should I use it like that for better speed:
MatchCollection matches = serverNameRegex.Matches(loginPage);
foreach (Match match in matches)
{
...
}
As long as the MatchCollection
cannot be null, I'd say it's your pick.
But if it turns out null and you don't check it beforehand, you will run into a NullReferenceException
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With