How do I know if a class in C# is unmanaged, so that if I use it in a self defined class I know whether I have to implement the IDisposable interface?
If I get this article on the MSDN network right, I always have to implement the IDisposible interface when I use an unmanaged resource.
So I've created a little example that you can find below:
class TestClass
{
private StreamReader reader;
public UsingTestClass()
{
reader = File.OpenText("C:\\temp\\test.txt");
string s;
while (!string.IsNullOrEmpty(s = reader.ReadLine()))
{
Console.WriteLine(s);
}
}
}
The following MSDN article says for example that File is an unamanged ressource, which is also used in my test class. So how can I see, that this class is unamanged? The compiler and ReSharper didn't complain anything.
Thanks in advance.