Use Anonymous Methods with Find in CSharp

Description

The following code shows how to use Anonymous Methods with Find.

Example


using System;/*from w  ww .  j  a  va 2s . com*/
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

    class Program
    {
        static void Main(string[] args)
        {
     
            List<string> myList1 = new List<string>();
            myList1.Add("A");
            myList1.Add("B");
            myList1.Add("C");
            myList1.Add("D");
            string vanilla1 = myList1.Find(delegate(string icecream)
            {
                return icecream.Equals("B");
            });
            Console.WriteLine(vanilla1);
        }
      
    }

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var