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
Post a Comment