Delegate TesterFunc<TResult, TSuccess>
- Namespace
- Cuemon
- Assembly
- Cuemon.Kernel.dll
Encapsulates a method and returns a value that indicates success of the type specified by the TSuccess parameter and returns a out result value of the type specified by the TResult parameter.
public delegate TSuccess TesterFunc<TResult, out TSuccess>(out TResult result)
Parameters
resultTResultThe result of the method that this function delegate encapsulates.
Returns
- TSuccess
The return value that indicates success of the method that this function delegate encapsulates.
Type Parameters
TResultThe type of the out result value of the method that this function delegate encapsulates.
TSuccessThe type of the return value that indicates success of the method that this function delegate encapsulates.
Examples
The following example demonstrates the shared workflow for the
using System;
using Cuemon;
namespace MyApp.Examples;
public static class TesterFuncExample
{
public static void Demonstrate()
{
TesterFunc<int, bool> tryReadPort = (out int port) =>
{
var configuredPort = "8080";
return int.TryParse(configuredPort, out port);
};
var success = tryReadPort(out var port);
Console.WriteLine(success);
Console.WriteLine(port);
}
}