예제 #1
0
        protected override IEnumerable <PropertyInfo> FilterProperties(Type typeToWrap, ImmutableArray <PropertyInfo> allProperties)
        {
            var properties = allProperties
                             .Where(x => x.GetCustomAttribute <MsgPackArrayElementAttribute>() != null)
                             .GroupBy(x => x.GetArrayElementOrder())
                             .OrderBy(x => x.Key)
                             .ToDictionary(x => x.Key, x => x.ToArray());

            foreach (var pair in properties)
            {
                if (pair.Value.Length > 1)
                {
                    throw ExceptionUtils.DuplicateArrayElement(typeToWrap, pair);
                }

                yield return(pair.Value[0]);
            }
        }