using System;
using System.Collections.Generic;
using System.Text;
namespace MyDelegate
{
class Program
{
static void Main(string[] args)
{
List<string> m_liName=new List<string>();
m_liName.Add("sadi");
m_liName.Add("pothik");
m_liName.Add("shiman");
m_liName.Add("shuvro");
m_liName.Add("arif");
//**************Find a single data
string sName = m_liName.Find(delegate(string s) { return s.Equals("sadi"); });
//**************Find multiple data
List<string> liName1 = m_liName.FindAll(delegate(string s) { return s.Equals("sh"); });
//*************If contains the data**********
bool bIsSuccess = m_liName.Contains("sadi"); // output: true
}
}
}
June 23, 2008
Find data from a data structure(List, Dictionary) using delegate in c# .Net
2 Comments »
RSS feed for comments on this post. TrackBack URI

how you do this by searching using a textbox or dropdown list presing a button
then display in a Gridview asp.net
Comment by Daysy — August 9, 2008 @ 8:00 pm
thanks man for your help its work perfect
Comment by theKnaya — January 14, 2009 @ 5:30 pm