I am trying to create a disposable ADOX Catalog instance by implementing IDisposable interface but I am getting a Error which is: ADOX.Catalog' does not contain a definition for 'Dispose' and no extension method 'Dispose' accepting a first argument of type 'ADOX.Catalog' could be found (are you missing a using directive or an assembly reference?)
and this my code
namespace Disposable
{
class DBGen : IDisposable
{
Catalog cat;
public DBGen()
{
cat = new Catalog();
cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=D:\\AccessDB\\NewMDB.mdb;" +"Jet OLEDB:Engine Type=5");
Console.WriteLine("Database Created Successfully");
cat = null;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool b)
{
if (b)
{
cat.Dispose();
}
}
}
}
I am getting the error at
cat.Dispose();
can you please let me know why this is happening? Thansk