加载:
    GeoMedia_CL.Frm_MapView gisfrm  = new GeoMedia_CL.Frm_MapView();
我早退出时:
            if(gisfrm!=null)
            {
                gisfrm.Close();
                gisfrm.Dispose();
            }
结果在:Application.Run(new frmMain());
出错,问题肯定是因为加载了dll的窗体并显示了,
可是我释放了为啥还出错?

解决方案 »

  1.   

    gisfrm不支持close,dispose吧!
    如果是.net的类库,那么内存的释放是不需要做任何事,如果想加快内存回收,可以把Assembly的加载,以及其中类型的调用封装到一个类中,然后此类型继承IDisposable接口
    如果是其他的DLL,你就需要删除应用程序域(appdomain)
    (有.NET的工作给我介绍一个啊,^_^)
      

  2.   

    下面的示例新建名为 MyDomain 的应用程序域,并将一些信息输出至控制台,然后卸载应用程序域。请注意,然后代码会尝试将卸载的应用程序域的友好名称输出至控制台。此操作将生成由程序结尾处的 try/catch 语句处理的异常
    using System;
    using System.Reflection;
    class AppDomain2
    {
    public static void Main()
    {
     Console.WriteLine("Creating new AppDomain.");
     AppDomain domain = AppDomain.CreateDomain("MyDomain", null);            Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
                Console.WriteLine("child domain: " + domain.FriendlyName);
       AppDomain.Unload(domain);
       try
          {
          Console.WriteLine();
          Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
          // The following statement creates an exception because the domain no longer exists.
                Console.WriteLine("child domain: " + domain.FriendlyName);
          }
       catch (AppDomainUnloadedException e)
          {
          Console.WriteLine("The appdomain MyDomain does not exist.");
          }
       }
    }
    我江苏的
      

  3.   

    老兄:我的应用是这样的:gisfrm = new GeoMedia_CL.Frm_MapView(ConnectionString, sysLog);
    我怎么用你的AppDomain domain = AppDomain.CreateDomain("MyDomain", null); ???
    能不能具体结合我的应用?我是成都的,可能帮不了你的工作。
      

  4.   

    晕,你把你的代码放到APPDOMAIN中不就可以了!!