[C#] Fix field name struct name collision (#6744) (#6757)

* Fix C/C++ Create<Type>Direct with sorted vectors

If a struct has a key the vector has to be sorted. To sort the vector
you can't use "const".

* Changes due to code review

* Improve code readability

* Add generate of JSON schema to string to lib

* option indent_step is supported

* Remove unused variables

* Fix break in test

* Fix style to be consistent with rest of the code

* [C#] Fix field name struct name collision (#6744)
This commit is contained in:
tira-misu 2021-07-26 19:02:27 +02:00 committed by GitHub
parent e77926f0ed
commit 3dd02144d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -619,6 +619,7 @@ class CSharpGenerator : public BaseGenerator {
std::string dest_cast = DestinationCast(field.value.type);
std::string src_cast = SourceCast(field.value.type);
std::string field_name_camel = MakeCamel(field.name, true);
if (field_name_camel == struct_def.name) { field_name_camel += "_"; }
std::string method_start =
" public " + type_name_dest + optional + " " + field_name_camel;
std::string obj = "(new " + type_name + "())";