How to cache a DataSet and NOT receive the CA2000 warning

191 views Asked by At

I have a DataSet that I would like to cache in the ASP.NET's web cache. The content does not change very often and a cache of a few hours should work.

My problem is that when I create the DataSet, I get a CA2000 warning about dispose needing to be called. However, some articles say that I can cache the DataSet. I don't believe the DataSet directly implements Dispose; however, it is derived from a class that does.

What is the best way to cache a DataSet so I do not receive the CA2000 warning?

1

There are 1 answers

0
Icarus On

I do not get the same warning you are getting; but indeed, you don't need to dispose a DataSet in the general case as it doesn't contain any unmanaged resources.

See this other answer.