Created
April 30, 2021 14:31
-
-
Save chris-kobrzak/d1c25c194db0c0767a3e09f0aca96ec4 to your computer and use it in GitHub Desktop.
c# interface with generics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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