From beead40decca12a0fc8606207d0acad2ceaa094f Mon Sep 17 00:00:00 2001 From: triton Date: Wed, 14 Aug 2013 00:17:08 +0100 Subject: [PATCH] Fixed handling of field properties in C# backend. --- .../Generators/CSharp/CSharpTextTemplate.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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();