LANGUAGE
Generic method type inference
Infers generic method type arguments from call arguments when possible, not solely from the return target.
Formal Syntax & Structure
csharp syntaxcsharp
Echo(3) // T inferred as intWorking Example
Example Snippetcsharp
System.Console.WriteLine(Echo(3));static T Echo<T>(T value) => value;