Check whether list of generics contains a type, that implements interface
Hello, I need to perform sophisticated generic type constraint.
I have following class to store multiple generics in my class, they are added to class after each method call:
And after calling few methods I get following type:
I have a function that accepts
Builder<IConst<TLeft, TRight>>
and I need generic constraint that will accept only those Builder
's, which have both IWithFoo
and IWithBar
somewhere inside their IConst<TLeft, TRight>
.
Something like this:
I tried another approach where I specified that Build<T>
accepts T where T : IWithBar, IWithFoo
, but that would require ICons<TLeft, TRight>
to implement TLeft
and TRight
, which I was answered is not possible (here: https://discord.com/channels/143867839282020352/1241306845940027472)Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
0 Replies