Skip to content

Instantly share code, notes, and snippets.

@chris-kobrzak
Created April 30, 2021 14:31
Show Gist options
  • Save chris-kobrzak/d1c25c194db0c0767a3e09f0aca96ec4 to your computer and use it in GitHub Desktop.
Save chris-kobrzak/d1c25c194db0c0767a3e09f0aca96ec4 to your computer and use it in GitHub Desktop.
c# interface with generics
using MyService.Core.Models;
namespace MyService.Providers.Mappers
{
public interface IMyMapper<in T> where T : ISomething
{
MappedSomething MapToSomething(T somethingGeneric);
}
public class MyConcreteMapper : IMyMapper<SomethingA>
{
public async MappedSomething MapToSomething(SomethingA somethingSpecific)
{
}
}
public class SomethingA : ISomething
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment