Create a Func with string input and int value output in CSharp
Description
The following code shows how to create a Func with string input and int value output.
Example
/* w w w. jav a 2 s .c o m*/
using System;
using System.ComponentModel;
class MainClass
{
static void Main()
{
Func<string, int> returnLength = (text => text.Length);
Console.WriteLine(returnLength("Hello"));
}
}
The code above generates the following result.