Both variables userManager
and signInManager
are class-level instance members that could be instantiated, or could be null.
Is it safe to replace this:
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (this.userManager != null)
{
this.userManager.Dispose();
this.userManager = null;
}
if (this.signInManager != null)
{
this.signInManager.Dispose();
this.signInManager = null;
}
}
base.Dispose(disposing);
}
with this:
protected override void Dispose(bool disposing)
{
if (disposing)
{
this.userManager?.Dispose();
this.signInManager?.Dispose();
}
base.Dispose(disposing);
}
Personally I don't see the point in explicitly assigning the variables to null after disposing them, as they are not static, as far as I am aware, it doesn't do anything.