diff --git a/src/Generator/Generators/CSharp/CSharpGenerator.cs b/src/Generator/Generators/CSharp/CSharpGenerator.cs index 9125ccb1..b8635b2f 100644 --- a/src/Generator/Generators/CSharp/CSharpGenerator.cs +++ b/src/Generator/Generators/CSharp/CSharpGenerator.cs @@ -27,7 +27,7 @@ namespace CppSharp.Generators.CSharp public override bool Generate(TranslationUnit unit) { - var template = new CSharpTextTemplate(Driver, unit); + var template = new CSharpTextTemplate(Driver, unit, typePrinter); WriteTemplate(template); return true; diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index 3050881c..c8ced567 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -63,17 +63,18 @@ namespace CppSharp.Generators.CSharp public class CSharpTextTemplate : TextTemplate { - public CSharpTypePrinter TypePrinter { get; set; } + public CSharpTypePrinter TypePrinter { get; private set; } public override string FileExtension { get { return "cs"; } } - public CSharpTextTemplate(Driver driver, TranslationUnit unit) + public CSharpTextTemplate(Driver driver, TranslationUnit unit, + CSharpTypePrinter typePrinter) : base(driver, unit) { - TypePrinter = new CSharpTypePrinter(driver.TypeDatabase, driver.Library); + TypePrinter = typePrinter; } #region Identifiers