MVC Helper SuppressFinalize
Bonjour,
J'aimerai savoir pourquoi il faut appeler le GC.SuppressFinalize(this).
Tout les codes que je trouve l'utilise mais impossible pour moi de trouver pourquoi...
Une petit aide serai simpa ;)
Bonne journée
Code du helper MVC
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
namespace MvcPanelExample.Models.Html
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.Web;
public class MvcPanel : IDisposable
{
#region Fields
private bool disposed;
private readonly HttpResponseBase httpResponse;
#endregion
#region CTOR
public MvcPanel(HttpResponseBase httpResponse)
{
if (httpResponse == null)
{
throw new ArgumentNullException("httpResponse");
}
this.httpResponse = httpResponse;
}
#endregion
#region Methods
public void Dispose()
{
Dispose(true /* disposing */);
GC.SuppressFinalize(this); /* <===== Here */
}
protected virtual void Dispose(bool disposing)
{
if (!this.disposed)
{
this.disposed = true;
this.httpResponse.Write("</div>");
}
}
public void EndPanel()
{
Dispose(true);
}
#endregion
}
} |