Browse Source

Optimized GetPropertyName for the common case.

pull/621/merge
Joao Matos 10 years ago
parent
commit
3dc915961c
  1. 8
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

8
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -1217,14 +1217,16 @@ namespace CppSharp.Generators.CSharp
private string GetPropertyName(Property prop) private string GetPropertyName(Property prop)
{ {
var isIndexer = prop.Parameters.Count != 0; var isIndexer = prop.Parameters.Count != 0;
if (!isIndexer)
return prop.Name;
var @params = prop.Parameters.Select(param => { var @params = prop.Parameters.Select(param => {
var p = new Parameter(param); var p = new Parameter(param);
if (isIndexer)
p.Usage = ParameterUsage.In; p.Usage = ParameterUsage.In;
return p; return p;
}); });
return !isIndexer ? prop.Name
: string.Format("this[{0}]", FormatMethodParameters(@params)); return string.Format("this[{0}]", FormatMethodParameters(@params));
} }
private void GenerateVariable(Class @class, Type type, Variable variable) private void GenerateVariable(Class @class, Type type, Variable variable)

Loading…
Cancel
Save