[C#] Using 'global::' as qualifying_start_ within BaseGenerator (#6767)

* Update idl_gen_csharp.cpp

Change csharp generator to use "global::" for it's qualifying_start_ to disambiguate namespaces

* regenerate testing files

regenerate testing files

* Missed TableInC.cs

updated with global prefix

* Remove "global::" from qualifying_start_ for csharp generator

* C# global alias

* Tests and docs for --cs-global-alias

Add tests for --cs-global-alias to demonstrate use case for why it's needed.

Add documentation to Compiler.md

* Add also to help text

Add also to help text
This commit is contained in:
Todd Hansen
2021-09-15 16:57:29 -05:00
committed by GitHub
parent 90baa1444b
commit 6f7a57eaa0
14 changed files with 153 additions and 3 deletions

View File

@@ -179,6 +179,7 @@ std::string FlatCompiler::GetUsageString(const char *program_name) const {
" --flexbuffers Used with \"binary\" and \"json\" options, it generates\n"
" data using schema-less FlexBuffers.\n"
" --no-warnings Inhibit all warning messages.\n"
" --cs-global-alias Prepend \"global::\" to all user generated csharp classes and structs.\n"
"FILEs may be schemas (must end in .fbs), binary schemas (must end in .bfbs),\n"
"or JSON files (conforming to preceding schema). FILEs after the -- must be\n"
"binary flatbuffer format files.\n"
@@ -391,6 +392,8 @@ int FlatCompiler::Compile(int argc, const char **argv) {
opts.cpp_std = arg.substr(std::string("--cpp-std=").size());
} else if (arg == "--cpp-static-reflection") {
opts.cpp_static_reflection = true;
} else if (arg == "--cs-global-alias") {
opts.cs_global_alias = true;
} else {
for (size_t i = 0; i < params_.num_generators; ++i) {
if (arg == params_.generators[i].generator_opt_long ||