public struct LocalTLS : IDisposable
{
public byte[] bArr;
public string str;
public LocalTLS(int k)
{
str = "Labamba";
bArr = new byte[20000];
}
public void Dispose()
{
MessageBox.Show("In Dispose");
//Thread.FreeNamedDataSlot("jaja");
int k = 90;
k += 90;
}
}
private void buttonTLS_retreive_Click(object sender, EventArgs e)
{
LocalTLS lts = new LocalTLS(1);
}
After the click event returns I expect the Dispose call but THAT NEVER HAPPENS, Can Some one explain. I do not want to do any manual steps like calling Dispose or do using. I want that to happen automatically.
Well thanks for all your answers, I wanted to implement a a class for LocalDataStoreSlot, that will automatically free the Slot and it goes out of scope, as shown in the commented code. This will free the developer from remembering to call dispose, wherein the actual FreeNamedDataSlot(...) happens. Seems like that is not possible