コード例 #1
0
        private static ImmutableHashSet <INamedTypeSymbol> GetWellKnownCollectionTypes(Compilation compilation)
        {
            var builder     = ImmutableHashSet.CreateBuilder <INamedTypeSymbol>();
            var iCollection = WellKnownTypes.ICollection(compilation);

            if (iCollection != null)
            {
                builder.Add(iCollection);
            }

            var genericICollection = WellKnownTypes.GenericICollection(compilation);

            if (genericICollection != null)
            {
                builder.Add(genericICollection);
            }

            var genericIReadOnlyCollection = WellKnownTypes.GenericIReadOnlyCollection(compilation);

            if (genericIReadOnlyCollection != null)
            {
                builder.Add(genericIReadOnlyCollection);
            }

            return(builder.ToImmutable());
        }