I am using a FileInfo class to get the length of the file as follows:
FileInfo infoFile = new FileInfo(configFile);
long configFileLength = infoFile.Length;
here configFile is the path of the file.
I want to dispose the object infoFile.
How can i do this?
VulpesPosted Oct 13, 2014, 5:55 AM
It just takes a snap-shot of a file's properties and doesn't retain a handle on the underlying unmanaged resource.
However, you might be able to accelerate the time when it's garbage collected by setting the object reference to null when it's no longer needed:
infoFile = null;