I'm writing a simple app to scan MP3 files, thousands of them. I've located an opensource class called Mp3Class which makes extracting the elements from an MP3 file easy, but I don't have much experience with objects. The following snippit works correctly on my small sample of files, but I'm concerned that calling New 30,000 times will not be memory efficient. Would it add value to put "currentMp3 = Nothing" after my logDetail line? I just don't know how to rewrite this so that I can re-use a single Mp3Class object in the loop (by taking the New out of the loop). Suggestions welcome.
Code:
For Each file In directory.GetFiles("*.MP3")
currentMp3 = New Mp3Class(file.FullName)
logDetail(file.FullName, currentMp3.GetDuration)
Next