Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Understanding the New operator

Status
Not open for further replies.

g33man

Programmer
Dec 22, 2006
50
CA
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top