c# - IComparer for string that checks if x starts with y -


i've got array of strings , need strings, start 'prefix'. wanna use array.binarysearch(). possible? , how should write comparer if so?

no, cannot use binarysearch in case. use enumerable.where instead:

dim query = str in array str.startswith("prefix") 

or (ugly in vb.net) method synatx:

query = array.where(function(str) str.startswith("prefix")) 

edit: whoops, c#

var query = array.where(s => s.startswith("prefix")); 

use toarray if want create new filtered array.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -