Using IDisposable in expression-bodied member

43 Views Asked by At

ShellFile implements IDisposable.

public string LocalizedName => new ShellFile(Executable).FileDescription;

I was unable to find anything on the internet about using disposable objects in expression-bodied members.
Is the ShellFile instance correctly disposed, or should I do something like this ?

public string LocalizedName
{
    get
    {
        using ShellFile shellFile = new(Executable);
        return shellFile.FileDescription;
    }
}
0

There are 0 best solutions below