static bool IsAwaitableType(TypeSig type) { if (type == null) { return(false); } var td = type.Resolve(); if (td == null) { return(false); } return(IsAwaitableType(td)); }
/// <summary> /// Gets whether the type supports collection initializers. /// </summary> static bool IsCollectionType(TypeSig tr) { if (tr == null) { return(false); } TypeDef td = tr.Resolve(); while (td != null) { if (td.Interfaces.Any(intf => intf.Interface != null && intf.Interface.Name == "IEnumerable" && intf.Interface.Namespace == "System.Collections")) { return(true); } td = td.BaseType != null?td.BaseType.ResolveTypeDef() : null; } return(false); }