public static IEnumerable <IPropertySymbol> GetFieldsThaCanBeSetPublicly(ITypeSymbol type, IAssemblySymbol contextAssembly) { var canSetInternalFields = contextAssembly.IsSameAssemblyOrHasFriendAccessTo(type.ContainingAssembly); return(GetPublicPropertySymbols(type).Where(property => property.SetMethod != null && property.CanBeSetPublicly(canSetInternalFields))); }