Een C# functioneel programma in Linqpad, de functie greeting.Dump geeft als standaard uitvoer "Hello Gijs".
void Main()
{
Func<Person, Greeting> greet = person => CreateGreet(person);
var person = new Person();
var greeting = greet(person);
greeting.Dump();
Greeting CreateGreet(Person person){
var greeting = new Greeting();
greeting.Greet = $"{greeting.Greet} {person.Name}";
return greeting;
}
}
// You can define other methods, fields, classes and namespaces here
public class Person
{
public string Name { get; set;} = "Gijs";
}
public class Greeting
{
public string Greet {get; set;} = "Hello";
}