Mono Class Library: System Namespace

System.Action<T> Delegate

A delegate to a method that returns no values, and takes one parameter.
public delegate void Action<T> (T obj)

Type Parameters

T
The type.

Parameters

obj
The object on which to perform an action.

Remarks

Since the compiler can infer the types, you do not need to provide the type, this is typically used with the System.Array.Foreach method or the List's ForEach method.

C# Example

//
// Simple "echo" implementation
//
using System;

class X {

	static void Main (string [] args)
	{
		Array.ForEach (args, print);
		Console.WriteLine ();
	}

	static void print (string a)
	{
		Console.Write (a);
		Console.Write (" ");
	}
}
  

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0