diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index 5eddb1cf..7cafb56d 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -335,6 +335,8 @@ namespace CppSharp.Generators.CSharp GenerateClassFields(@class, isInternal: true); + var functions = new HashSet(); + foreach (var ctor in @class.Constructors) { if (ctor.IsCopyConstructor || ctor.IsMoveConstructor) @@ -343,8 +345,7 @@ namespace CppSharp.Generators.CSharp if (ctor.IsPure) continue; - NewLineIfNeeded(); - GenerateInternalFunction(ctor); + functions.Add(ctor); } foreach (var method in @class.Methods) @@ -361,8 +362,13 @@ namespace CppSharp.Generators.CSharp if (method.IsPure) continue; + functions.Add(method); + } + + foreach (var function in functions) + { NewLineIfNeeded(); - GenerateInternalFunction(method); + GenerateInternalFunction(function); } typePrinter.PopContext();