dotnet/roslyn

Decompilation should put new lines between blocks

开放

#25,303 创建于 2018年3月7日

 (16 条评论) (0 个反应) (0 位负责人)C# (4,257 个派生)batch import
Area-IDEIDE-Formatterhelp wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

We should layout methods a little better by introducing new lines to make a little more readable (Reflector did this well)

  1. Create Console App (.NET Framework)
  2. In the following, CTRL+Click int
    class Program
    {
        static void Main(string[] args)
        {
            int foo;
        }
    }
  1. When prompted say Yes to decompile
  2. Scroll down to CompareTo:

Expected:

		public int CompareTo(object value)
		{
			if (value == null)
			{
				return 1;
			}

			if (value is int)
			{
				int num = (int)value;
				if (this < num)
				{
					return -1;
				}

				if (this > num)
				{
					return 1;
				}

				return 0;
			}

			throw new ArgumentException(Environment.GetResourceString("Arg_MustBeInt32"));
		}

Actual:

		public int CompareTo(object value)
		{
			if (value == null)
			{
				return 1;
			}
			if (value is int)
			{
				int num = (int)value;
				if (this < num)
				{
					return -1;
				}
				if (this > num)
				{
					return 1;
				}
				return 0;
			}
			throw new ArgumentException(Environment.GetResourceString("Arg_MustBeInt32"));
		}

贡献者指南