vb.net - For each using linq how to use else -
i have code checking specific files , if condition fulfilled going in stats.matching.... using each linq:
each file string in file1 in stats.foundfiles let ftpfile = utils.tolowerwithoutspaces(file1) ftpfile.contains(currentreportname) select file1 stats.matchingfiles.add(file) next the question how implement else here.
so want fill collection files don't contain word.
dim matching = file1 in stats.foundfiles let ftpfile = utils.tolowerwithoutspaces(file1) ftpfile.contains(currentreportname) dim mismatching = file1 in stats.foundfiles let ftpfile = utils.tolowerwithoutspaces(file1) not ftpfile.contains(currentreportname) each file string in matching stats.matchingfiles.add(file) next each file string in mismatching stats.mismatchingfiles.add(file) next that simple solution, use except more efficient:
dim mismatching = stats.foundfiles.except(matching)
Comments
Post a Comment