コード例 #1
0
        private static ImmutableHashSet <INamedTypeSymbol> GetSpecialAttributes(Compilation compilation)
        {
            var specialAttributes = PooledHashSet <INamedTypeSymbol> .GetInstance();

            var fieldOffsetAttribute = WellKnownTypes.FieldOffsetAttribute(compilation);

            if (fieldOffsetAttribute != null)
            {
                specialAttributes.Add(fieldOffsetAttribute);
            }

            var mefV1Attribute = WellKnownTypes.MEFV1ExportAttribute(compilation);

            if (mefV1Attribute != null)
            {
                specialAttributes.Add(mefV1Attribute);
            }

            var mefV2Attribute = WellKnownTypes.MEFV2ExportAttribute(compilation);

            if (mefV2Attribute != null)
            {
                specialAttributes.Add(mefV2Attribute);
            }

            return(specialAttributes.ToImmutableAndFree());
        }