Created
July 18, 2019 14:59
-
-
Save mrtank/f7d1236c20e36f5f9cf429f48b54fbeb to your computer and use it in GitHub Desktop.
This file contains 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
internal class User: IUser | |
{ | |
async Task<TLoginUserResponse> IUser.LoginUser<TLoginUserDTO, TLoginUserResponse>(TLoginUserDTO loginUserDTO) | |
{ | |
... | |
var loginUserDTODerived = (LoginUserDTO) (ILoginUserDTO) loginUserDTO; | |
var dummy = loginUserDTODerived.NewProp; | |
... | |
return (TLoginUserResponse) (ILoginUserResponse) new LoginUserResponse | |
{NewProp = someValue, NewProp2 = someValue2}; | |
} | |
} | |
public interface IUser | |
{ | |
Task<TLoginUserResponse> LoginUser<TLoginUserDTO, TLoginUserResponse>(TLoginUserDTO loginUserDTO) | |
where TLoginUserDTO : ILoginUserDTO | |
where TLoginUserResponse : ILoginUserResponse; | |
} | |
usage: | |
var getUserResponse = await user.LoginUser<LoginUserDTO /* having some NewProp */, LoginUserResponse /* having some NewProp */>(new LoginUserDTO | |
{ | |
DefaultProp1 = someValue, DefaultProp2 = someValue2, NewProp = someValue3 | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment