private void PrintTypeStats(TypeSizeMode mode, string filename)
        {
            using (var f = new StreamWriter(outputDir + filename))
            {
                var typeStats = TypeStats.Data.Values
                                .OrderByDescending(ts => mode.GetSize(ts))
                                .ToList();

                f.Write("Size".PadLeft(12));
                f.Write("    ");
                f.Write("Count".PadLeft(9));
                f.Write("    ");
                f.Write("Type");
                f.WriteLine();

                foreach (var ts in typeStats)
                {
                    if (ts.SelfSize < minTypeSize)
                    {
                        continue;
                    }

                    long size = mode.GetSize(ts);
                    f.Write(sizeFormat.Format(size).PadLeft(12));
                    f.Write("    ");
                    f.Write(ts.Count.ToString().PadLeft(9));
                    f.Write("    ");
                    f.Write(ts.Type.GetDisplayName());
                    f.WriteLine();
                }
            }
        }
        public static long GetSize(this TypeSizeMode mode, TypeStats typeStats)
        {
            switch (mode)
            {
            case TypeSizeMode.Self:
                return(typeStats.SelfSize);

            case TypeSizeMode.Total:
                return(typeStats.TotalSize);

            case TypeSizeMode.Native:
                return(typeStats.NativeSize);

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
        }