C#: Set static and instance constructor defaults correctly (CS0120)

This commit is contained in:
Katy Coe
2020-02-24 12:24:04 +01:00
parent 6046f2493d
commit 168c955558

View File

@@ -503,7 +503,7 @@ namespace Il2CppInspector.Outputs
if (fields.Any()) {
var paramNames = method.DeclaredParameters.Select(p => p.Name);
sb.Append(" {\n" + string.Join("\n", fields
.Where(f => !f.IsStatic && !f.IsLiteral)
.Where(f => !f.IsLiteral && f.IsStatic == method.IsStatic)
.Select(f => $"{prefix}\t\t{(paramNames.Contains(f.Name) ? "this." : "")}{f.Name} = default;"))
+ $"\n{prefix}\t}}");
} else