Created
February 12, 2020 16:33
-
-
Save ABaker86/808924205c59d3b42db6766f2a8b5140 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
//using the following interfaces | |
public interface IUseInterface<T> where T : IAmAnInterface { T ViewModel { get; set; } } | |
private Type GetGenericType<TInterface>(TInterface someObjectInterface) where TInterface : IAmAnInterface => | |
typeof(IUseInterface<>).MakeGenericType(someObjectInterface.GetType().GetInterfaces() | |
.Where(x => x.Name.Contains("Template")).ToArray()); | |
//returns Type IUseInterface<T> where T : IAmAnInterface |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment