본문 바로가기
Application/C#.net

List<> 의 Exists 사용법

by 현이빈이 2010. 9. 24.
반응형

LIst<> 객체의 Find, FindAll, Exists 메소드가 있다.

List 객체내의 데이타를 찾는 부분이다.

그중 Exists 사용법이다.
나머지들도 이와 비슷하니 다른것들은 직접 구현해 보길 권장한다.


bool compareResult = stringList.Exists(
  delegate(string data)
  {
    if (data == compareString)
      return true;
    else
      return false;
    }
  );
if (compareResult) 
  Console.WriteLine("같은 데이타 있다");
else
  Console.WriteLine("없다");
반응형