Use Action<(Of <(T>)>) delegate to print the contents of a List<(Of <(T>)>) object. : List « Data Structure « 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 » Data Structure » List 
11.34.21.Use Action<(Of <(T>)>) delegate to print the contents of a List<(Of <(T>)>) object.
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        List<String> names = new List<String>();
        names.Add("A");
        names.Add("B");
        names.Add("C");
        names.Add("D");

        names.ForEach(Print);

        names.ForEach(delegate(String name)
        {
            Console.WriteLine(name);
        });
    }

    private static void Print(string s)
    {
        Console.WriteLine(s);
    }
}
11.34.List
11.34.1.Obtaining a read-only copy of a list
11.34.2.Using the Action delegate
11.34.3.Converting a list from list of string to list of int
11.34.4.Converting a list: user defined converting function
11.34.5.Vector extends List
11.34.6.List Filtering With Linq
11.34.7.List Joining Ordering And Filtering With Linq
11.34.8.List Order With Extension Method
11.34.9.List Query With Delegates
11.34.10.List Query With Delegates Compact
11.34.11.List Query With Lambda Expression
11.34.12.List Sort With Comparer
11.34.13.List Sort With Comparison Delegate
11.34.14.Implement IComparable to use List.Sort
11.34.15.List.ForEach
11.34.16.Compact Code for looping through the List with delegate
11.34.17.List Convert All
11.34.18.Using external method to pass into Find method
11.34.19.List size and capacity
11.34.20.List range operation
11.34.21.Use Action<(Of <(T>)>) delegate to print the contents of a List<(Of <(T>)>) object.
11.34.22.Item property (the indexer in C#) and various other properties and methods of the List<(Of <(T>)>) generic class.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.