How to use multiple Generic constraints for List and dictionary for a type?

103 Views Asked by At

I want to create a generic method with two generic type parameters that parameters must be a List of objects or dictionaries but the C Sharp compiler won't allow that How can I achieve that scenario?

 public class GenericTest
    {
        public void GenericMethod<TSucess, TFailed>(TSucess success, TFailed failure) 
            where TSucess : List<BatchResponseProperties>, Dictionary<string, string>, new()
            where TFailed : List<BatchInput>, Dictionary<string, string>, new()
        {
            //Do something
        }
    }
0

There are 0 best solutions below