FusedQyou
✅ out vs ref keyword usage
All
out
parameters must be assigned a value before the method returns, but an async method effectively returns immediately by returning a Task, meaning the value wouldn't be available yet until the method reaches a point where the value would have been set.47 replies
✅ out vs ref keyword usage
Below the example on the site is also some rules regarding
out
keywords, which FestivalDelGelato already hinted on.
The following limitations apply to using the out keyword:
- out parameters are not allowed in asynchronous methods.
- out parameters are not allowed in iterator methods.
- Properties cannot be passed as out parameters.47 replies
CA1860: Avoid using 'Enumerable.Any()' extension method
You know the whole issue is that an IEnumerable does not define the underlying collection, just how it's iterated. It can't be added there, so at that point you have to either find the underlying collection, or attempt to iterate. This is what
Any
does59 replies