小编Tam*_*zin的帖子

C#应用程序未正确关闭(在关闭表单后仍在内存中运行)

我有一个奇怪的情况,我的应用程序进程在关闭我的主窗体后仍然在内存中,我的Program.cs代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;

namespace WindowsFormsApplication1
{
    static class Program
    {    
        [Flags]
        enum MoveFileFlags
        {
            None = 0,
            ReplaceExisting = 1,
            CopyAllowed = 2,
            DelayUntilReboot = 4,
            WriteThrough = 8,
            CreateHardlink = 16,
            FailIfNotTrackable = 32,
        }

        [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
        static extern bool MoveFileEx(
            string lpExistingFileName,
            string lpNewFileName,
            MoveFileFlags dwFlags
        );

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() …
Run Code Online (Sandbox Code Playgroud)

.net c# windows winforms

3
推荐指数
1
解决办法
2082
查看次数

标签 统计

.net ×1

c# ×1

windows ×1

winforms ×1