这种using的用法,是什么意思?谢谢!using(BFHandlePhone  bfIndict = new BFHandlePhone())

解决方案 »

  1.   

    using(BFHandlePhone  bfIndict = new BFHandlePhone())
    {
       indictProduct = bfIndict.GetIndictProduct(cond);
       fromby = bfIndict.GetFromBy(intHandleID);
    }
      

  2.   

    http://www.cnblogs.com/windsails/archive/2004/09/12/42444.html
      

  3.   

    这种用法的意思是,在紧随其后的代码块运行完后,马上清除using语句中生命的变量。
      

  4.   

    用完以后释放掉,不等GC.COLLECT才这样写
      

  5.   

    using(BFHandlePhone  bfIndict = new BFHandlePhone()){
    .......
    ......
    }
    在using括号中的代码执行完,用完bfindict后,就将其释放。防止程序忘记。呵~
      

  6.   

    这个 using 相当于BFHandlePhone  bfIndict = null;try
    {
     bfIndict = new BFHandlePhone())
    }
    finally
    {
     bfIndict.Dispose();
    }前提是 BFHandlePhone  类必须实现了 IDisposable 接口MSDN 中有注释.