'Declaration Public Sub Dispose()
'Usage Dim instance As SmartCache instance.Dispose()
public void Dispose()
public: void Dispose();
public: void Dispose();
'Declaration Public Sub Dispose()
'Usage Dim instance As SmartCache instance.Dispose()
public void Dispose()
public: void Dispose();
public: void Dispose();
//Create a Primary Memory Cache with a backing File Cache string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "KellermanSoftware", "NetCachingLibrary", "Tests"); SmartConfig config = new SmartConfig(new MemoryCacheProvider(), new FileCacheProvider(directory)); //Specify UserName and LicenseKey for Licensed Mode //config.UserName = "my user name"; //config.LicenseKey = "my license key"; //Instantiate the cache SmartCache cache = new SmartCache(config); //Dispose it cache.Dispose(); //This will throw an ObjectDisposedException try { cache.GetPrimaryCount(); } catch (ObjectDisposedException ex) { Console.WriteLine(ex.ToString()); }
'Create a Primary Memory Cache with a backing File Cache Dim directory As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "KellermanSoftware", "NetCachingLibrary", "Tests") Dim config As New SmartConfig(New MemoryCacheProvider(), New FileCacheProvider(directory)) 'Specify UserName and LicenseKey for Licensed Mode 'config.UserName = "my user name"; 'config.LicenseKey = "my license key"; 'Instantiate the cache Dim cache As New SmartCache(config) 'Dispose it cache.Dispose() 'This will throw an ObjectDisposedException Try cache.GetPrimaryCount() Catch ex As ObjectDisposedException Console.WriteLine(ex.ToString()) End Try
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2