Tuesday, April 5, 2022

IDisposable interface in ASP.NET

 https://www.c-sharpcorner.com/UploadFile/b08196/idisposable-interface-in-C-Sharp/#:~:text=IDisposable%20is%20an%20interface%20that,database%20connections%20and%20so%20on.

public class StudentRegisterBulkupload : IDisposable

{

 public bool CheckStudentExistStart(string adhar)
{
//function to do here
}

  private bool m_disposed = false;

    protected virtual void Dispose(bool disposing)

    {

        if (m_disposed)

            return;


        if (disposing)

        {


        }


        m_disposed = true;

    }


    public void Dispose()

    {

        Dispose(true);

        GC.SuppressFinalize(this);

    }



    ~StudentRegisterBulkupload()

    {

        Dispose(false);

    }

}

No comments:

Post a Comment