Delegate targets : select « LINQ « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » LINQ » select 
22.63.19.Delegate targets
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

    class MainClass
    {
        public static void Main()
        {
            string[] currentVideoGames = {"Shooting""D","Half Life""F.E.A.R.","Game""System"};
            Func<string, bool> searchFilter = new Func<string, bool>(Filter);
            Func<string, string> itemToProcess = new Func<string,string>(ProcessItem);

            var subset = currentVideoGames.Where(searchFilter).OrderBy(itemToProcess).Select(itemToProcess);
            foreach (var game in subset)
                Console.WriteLine("Item: {0}", game);
        }
        public static bool Filter(string s) {return s.Length > 6;}
        public static string ProcessItem(string s) { return s; }
    }
22.63.select
22.63.1.Query Reuse
22.63.2.Select array item by type
22.63.3.Use LINQ with Dictionary
22.63.4.Use LINQ to query characters in a string
22.63.5.Transformation: link two array.
22.63.6.Select with Anonymous Types: prints uppercase and lowercase versions of each string in an input array
22.63.7.Select with Anonymous Types: iterates over each element to print the element's name
22.63.8.Select with Anonymous Types: prints the name of every product in the product list along with the category of the product and its unit price
22.63.9.Using select to create a sequence of each product name.
22.63.10.Converting an Array of Strings to Integers
22.63.11.Converting an Array of Strings to Integers and Sorting It
22.63.12.Query with Intentional Exception Deferred Until Enumeration
22.63.13.Demonstrating the Query Results Changing Between Enumerations
22.63.14.Returning a List
22.63.15.Select Distinct
22.63.16.Select all from a List
22.63.17.Select only pet name
22.63.18.Select sum value
22.63.19.Delegate targets
22.63.20.Adding new line character to selected value
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.