Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void
示例#1
0
 /// <summary>
 /// 登陆窗体
 /// </summary>
 /// <returns></returns>
 private bool UserLogin()
 {
     frmLogin frmLogin = new frmLogin();
     try
     {
         DialogResult result = frmLogin.ShowDialog(this);
         if (result == DialogResult.OK)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     finally
     {
         frmLogin.Dispose();
     }
 }
示例#2
0
        /// <summary>
        /// 登陆窗体
        /// </summary>
        /// <returns></returns>
        private bool UserLogin()
        {
            frmLogin frmLogin = new frmLogin();

            try
            {
                DialogResult result = frmLogin.ShowDialog(this);
                if (result == DialogResult.OK)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            finally
            {
                frmLogin.Dispose();
            }
        }