最快的方法以将字符串与字符串在C#2.0中的数组比较 [英] Fastest way to compare a string with an array of strings in C#2.0
本文介绍了最快的方法以将字符串与字符串在C#2.0中的数组比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是一个字符串,在字符串数组比较的最快方法C#2.0
What is the fastest way to compare a string with an array of strings in C#2.0
推荐答案
您的意思是,看看该字符串数组中?我不记得,如果阵列支持。载()方法,因此,如果没有,创建一个列表<字符串>,通过您的AddRange阵列添加到列表中(),然后调用list.Contains({字符串比较})。会返回一个布尔值,表示字符串是否到数组中。
You mean to see if the string is in the array? I can't remember if arrays support the .Contains() method, so if not, create a List< string >, add your array to the list via AddRange(), then call list.Contains({string to compare}). Will return a boolean value indicating whether or not the string is in the array.
这篇关于最快的方法以将字符串与字符串在C#2.0中的数组比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文