Code inspection: Redundant empty object or collection initializer
This inspection reports an empty object or collection initializer that does not initialize anything. In that case, the { } adds noise without changing the created value.
Example
using System.Collections;
class C
{
object Create()
{
return new ArrayList() { };
}
}
using System.Collections;
class C
{
object Create()
{
return new ArrayList();
}
}
Quick-fix
The quick-fix removes the empty initializer. When useful, another quick-fix can fill the initializer with writable members instead of removing it.
13 April 2026