if statement - Is there a shortened method to loop through conditions in IF in VB.NET -


so making program needs check if file of video / audio format. have code (song system.io.fileinfo):

if song.extension.toupper = ".mp4" or song.extension = ".avi" or song.extension = ".mp3" or song.extension = ".aa" or song.extension = ".m4a" or song.extension = ".aiff" or song.extension = ".wav" or song.extension = ".m4v" or song.extension = ".aac" or song.extension = ".vob" 

the problem checks first 2 conditions. need split separate ifs or there way test conditions in 1 line?

you can make set extensions in it:

dim extensions new hashset(of string) {     ".mp4", ".avi", ".mp3", ".aa", ".m4a", ".aiff", ".wav",     ".m4v", ".aac", ".vob" } 

and check if value in contains:

if extensions.contains(song.extension.tolower())     ⋮ end if 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -