基本上你可以不用管,GC会帮你处理但如果某些场合需要释放的话,你可以这样:DataTable table;
//...
table.Dispose();

解决方案 »

  1.   

    table.Dispose();,.net其实有自动释放的
      

  2.   

    To:楼上的兄弟们
    Dispose()他会做那些事情呢?
    比如我这样做过:
    DataTable myTable;
    DataGrid1.DataSouce=myTalbe;//我要释放myTalbe可以这样吗?他对以后的一些操作有关系吗?
    myTable.Dispose();这样可以吗?
    谢谢大家!
      

  3.   

    The garbage collector gets rid of managed resources. Calling Dispose gets
    rid of un-managed resources. You should bear in mind which Task Manager
    column you're looking at - VM Size column or Mem Usage. How to reduce the working set of your .NET process
    http://discuss.develop.com/archives/wa.exe?A2=ind0209C&L=DOTNET-CLR&D=0&I=-3
    &P=1450Does this trick affect performance?
    http://discuss.develop.com/archives/wa.exe?A2=ind0209C&L=DOTNET-CLR&D=0&I=-3
    &P=8720