You can declare such Func inside a class or function which is already generic. `public class MyClass{ Func, T> myFunc = (inputList) => inputList.First(); }`
– ChetanJan 23 '23 at 17:56
Thanks Chetan, good idea, ive updated the question slightly to try to make it clearer that isnt what im after in this case.
– AndrewJan 23 '23 at 18:02
If you know the element type of the list, you can specify it directly: `Func, string> myFunc = (inputList) => inputList.First();`
– Olivier Jacot-DescombesJan 23 '23 at 18:14
No idea what you want to achieve... Can you please [edit] post to clarify? Also what is exact errors you are facing? Normally it is not a problem to define generic types, presumably you are doing it inside a generic method/class already... You may also want to clarify bigger goal.
– Alexei LevenkovJan 23 '23 at 18:23
I've been unable to solve, but in my case a local method works just as well
```T genericLocalMethod(List paramList)
{
return paramList.First();
}```
– AndrewJan 23 '23 at 18:25
, T> myFunc = (inputList) => inputList.First(); }`
, string> myFunc = (inputList) => inputList.First();`
– Olivier Jacot-Descombes Jan 23 '23 at 18:14