private void CollectEnum(INamedTypeSymbol type)
        {
            var info = new EnumSerializationInfo
            {
                Name           = type.ToDisplayString(ShortTypeNameFormat).Replace(".", "_"),
                Namespace      = type.ContainingNamespace.IsGlobalNamespace ? null : type.ContainingNamespace.ToDisplayString(),
                FullName       = type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat),
                UnderlyingType = type.EnumUnderlyingType.ToDisplayString(BinaryWriteFormat),
                Attributes     = NeutralAttributeData.FromAttributeDataArray(type.GetAttributes())
            };

            this.collectedEnumInfo.Add(info);
        }
        private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type)
        {
            var isClass = !type.IsValueType;
            var members = new List <MemberSerializationInfo>();
            // Only KeyAttribute members
            var searchFirst  = true;
            var hiddenIntKey = 0;

            foreach (IPropertySymbol item in RoslynExtensions.GetAllMembers(type).OfType <IPropertySymbol>())
            {
                if (item.IsIndexer)
                {
                    continue; // .tt files don't generate good code for this yet: https://github.com/neuecc/MessagePack-CSharp/issues/390
                }

                var member = new MemberSerializationInfo
                {
                    IsReadable    = (item.GetMethod != null) && item.GetMethod.DeclaredAccessibility == Accessibility.Public && !item.IsStatic,
                    IsWritable    = (item.SetMethod != null) && item.SetMethod.DeclaredAccessibility == Accessibility.Public && !item.IsStatic,
                    IsProperty    = true,
                    IsField       = false,
                    Name          = item.Name,
                    Type          = item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat),
                    ShortTypeName = item.Type.ToDisplayString(BinaryWriteFormat),
                    Attributes    = NeutralAttributeData.FromAttributeDataArray(item.Type.GetAttributes())
                };
                if (!member.IsReadable && !member.IsWritable)
                {
                    continue;
                }

                if (searchFirst)
                {
                    searchFirst = false;
                }

                members.Add(member);
                this.CollectCore(item.Type); // recursive collect
            }

            foreach (IFieldSymbol item in RoslynExtensions.GetAllMembers(type).OfType <IFieldSymbol>())
            {
                if (item.IsImplicitlyDeclared)
                {
                    continue;
                }

                var member = new MemberSerializationInfo
                {
                    IsReadable    = item.DeclaredAccessibility == Accessibility.Public && !item.IsStatic,
                    IsWritable    = item.DeclaredAccessibility == Accessibility.Public && !item.IsReadOnly && !item.IsStatic,
                    IsProperty    = true,
                    IsField       = false,
                    Name          = item.Name,
                    Type          = item.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat),
                    ShortTypeName = item.Type.ToDisplayString(BinaryWriteFormat),
                };
                if (!member.IsReadable && !member.IsWritable)
                {
                    continue;
                }

                if (searchFirst)
                {
                    searchFirst = false;
                }

                members.Add(member);
                this.CollectCore(item.Type); // recursive collect
            }

            var info = new ObjectSerializationInfo
            {
                IsClass = isClass,
                ConstructorParameters = null,
                Members    = members.ToArray(),
                Name       = GetMinimallyQualifiedClassName(type),
                FullName   = type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat),
                Namespace  = type.ContainingNamespace.IsGlobalNamespace ? null : type.ContainingNamespace.ToDisplayString(),
                Attributes = NeutralAttributeData.FromAttributeDataArray(type.GetAttributes())
            };

            return(info);
        }