public void Method() { using var x = new Struct(); var y = new Struct(); // Noncompliant }
public Struct Bar() { using var disposableRefStruct = new Struct(); // Noncompliant return(disposableRefStruct); }
public void Method() { var x = new Struct(); // Compliant - FN this struct needs to be disposed (disposable ref struct) }
public void M2() { using var s = new Struct(); s.Dispose(); // Compliant - FN }
public Struct Bar(string path, string text) { using var disposableRefStruct = new Struct(); // Compliant - FN the resource is returned already disposed return(disposableRefStruct); }