Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
The short answer is that it can't be done. C# doesn't support type functions. https://github.com/dotnet/csharplang/issues/339 is probably the issue to follow if you want to track their progress. W...
Answer
#1: Initial revision
The short answer is that it can't be done. C# doesn't support type functions. https://github.com/dotnet/csharplang/issues/339 is probably the issue to follow if you want to track their progress. Workarounds are going to require another type parameter and probably a factory method: e.g. public TEntityEntry_TEntity Add<TEntity, TEntityEntry_TEntity>( [NotNull] TEntity entity, [NotNull] Func<TEntity, TEntityEntry_TEntity> wrap) where TEntity : class where TEntityEntry_TEntity : TEntityEntry;