Anti-constraint on C# generics
问题 Inspired by Phil Haack's attempt on null or empty coalescing, I'm trying to write a couple of extension methods for the string object, as well as on the IEnumerable<T> interface, to simplify null or emtpy ckecking. However, I'm running into problems: when I'm attempting to call the string version of AsNullIsEmpty , the compiler treats my string as an IEnumerable<char> , and of course gives the wrong return type. Is there any way to put an "anti-constraint" on the definition of the IEnumerable