No, it is impossible to write a program in C # without using unmanaged resources. This is inevitable, C # runs on an operating system that is 100% unmanageable. If you use a file, you are using an operating system resource. Network connection. Subject. Console. Etcetera, all very unmanaged resources.
, , .NET. framework - . FileStream, Socket, Thread, Console .. , .
. -. , , . , - , , , .
, . .
, . , . , , . , .
, . . , , . , , , , , . , , FileShare.None, . : Close(), , . , , Close() finally, , - . , .
, . , , , 100 . , , . . , , . , , , .
.NET IDisposable. Dispose() , , , , . , using , , IDisposable.Dispose() .
Dispose() , IDisposable, , , .NET-. , , . , Dispose() , MemoryStream. , IDisposable, , Thread. Dispose, Close ( ). , Java , IDisposable.