protected override IEnumerable <PropertyInfo> FilterProperties(Type typeToWrap, ImmutableArray <PropertyInfo> allProperties) { var properties = allProperties .Where(x => x.GetCustomAttribute <MsgPackMapElementAttribute>() != null) .GroupBy(x => x.GetMapElementName()) .ToDictionary(x => x.Key, x => x.ToArray()); foreach (var pair in properties) { if (pair.Value.Length > 1) { throw ExceptionUtils.DuplicateMapElement(typeToWrap, pair); } yield return(pair.Value[0]); } }