C#

C#

Made by DeepSource

Object created is neither assigned to a variable nor passed as an argument but is dropped immediately CS-W1097

Bug risk
Critical

An object was instantiated but was neither assigned to a variable nor passed as an argument and was dropped immediately. This is likely a mistake. Consider utilizing the object appropriately. If the object is not required, remove the instantiation. If the object was instantiated because the constructor has side-effects, it is a bad design pattern. Instead, consider moving the side-effects to a separate method.

Bad Practice

new C();

Recommended

var c = new C();