Skip to content

Commit

Permalink
More modern defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwengier committed Jul 26, 2024
1 parent 0e108bf commit 66ea119
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
49 changes: 49 additions & 0 deletions Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
namespace DecompilationDiffer;

public static class Constants
{
public const string InitialCode = """
using System.Collections.Generic;
using System.Linq;

class C
{
private IEnumerable<int> _data = M(new [] {1, 2, 3});

static IEnumerable<int> M(IEnumerable<int> input)
{
return input.Select(x => x);
}
}
""";

public const string Version1Code = """
using System.Collections.Generic;
using System.Linq;

class C
{
private IEnumerable<int> _data = M([1, 2, 3]);

static IEnumerable<int> M(IEnumerable<int> input)
{
return input.Select(x => x);
}
}
""";

public const string Version2Code = """
using System.Collections.Generic;
using System.Linq;

class C
{
private IEnumerable<int> _data = M(1, 2, 3);

static IEnumerable<int> M(params IEnumerable<int> input)
{
return input.Select(x => x);
}
}
""";
}
6 changes: 3 additions & 3 deletions Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
private StandaloneDiffEditor v2Diff = null!;
private bool _autoRefresh = true;
private bool _syncScroll = true;
private string _initialBaseCode = "record R(int X);";
private string _initialVersion1Code = "record R(int X)\n{\n public int X { get; init; }\n}";
private string _initialVersion2Code = "record R(int X)\n{\n public int X { get; set; } = X;\n}";
private string _initialBaseCode = Constants.InitialCode;
private string _initialVersion1Code = Constants.Version1Code;
private string _initialVersion2Code = Constants.Version2Code;

[ParameterAttribute]
public string? fragment { get; set; }
Expand Down

0 comments on commit 66ea119

Please sign in to comment.