diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index 5416be7f..f8c0178f 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -858,11 +858,18 @@ namespace CppSharp.Generators.CSharp WriteLine("public {0} {1}", prop.Type, prop.Name); WriteStartBraceIndent(); - GeneratePropertyGetter(prop.GetMethod, @class); - - if (prop.SetMethod != null) + if (prop.Field != null) + { + GeneratePropertyGetter(prop.Field, @class); + GeneratePropertySetter(prop.Field, @class); + } + else { - GeneratePropertySetter(prop.SetMethod, @class); + if (prop.GetMethod != null) + GeneratePropertyGetter(prop.GetMethod, @class); + + if (prop.SetMethod != null) + GeneratePropertySetter(prop.SetMethod, @class); } WriteCloseBraceIndent();