日期:2014-05-18 浏览次数:21138 次
public class CompareOnly : IEqualityComparer<string>
{
public int GetHashCode(string t)
{
return t.GetHashCode();
}
public bool Equals(string x, string y)
{
return x.Trim().ToUpper() == y.Trim().ToUpper();
}
}
class Program
{
static void Main(string[] args)
{
string[] s = new string[] { "abc", "def", "iLoVeU" };
CompareOnly co = new CompareOnly();
bool r = s.Contains("iloveu", co);
Console.WriteLine(r.ToString());
Console.ReadKey();
}
}