Using the C# to DBL Code Converter
The C# to DBL Code Converter was deprecated with SDI version 2022.03.1110, but it may still work for C# code that has no C# language features newer than version 6. |
The C# to DBL Code Converter converts C# code snippets into Synergy .NET code. It is included with SDI (see SDI features). If you have a C# solution that you want converted to Synergy .NET, see Using the C# to DBL Solution Converter.
We recommend using C# code snippets that can be compiled. This is not always a requirement, but the further a code snippet is from being compilable, the more modification the converted code will need to work correctly.
Note the following:
- Code generated by this utility is meant as a guide and may need modification to compile and work correctly.
- Be sure to add references to all assemblies used in your project.
- To be converted, all C# code (except precompiler directives) must be in a namespace and class.
- LINQ expressions are not converted into usable code.
- If the code converter cannot resolve a type, it treats it as an object by prefixing an “at” sign (@)—for example, @my_type. If you have a multi-file C# project, use the solution converter (see Using the C# to DBL Solution Converter) or paste all the .cs files into one conversion so that the code converter has more complete type information.
- Duplicate “using” statements are not supported.
- An array initializer that is used in line with a constructor call will not be converted. In this case, you must manually call “Add” for collections and lists that would be initialized when constructed.
- If a precompiler directive prevents a section of code from being compiled, that code will remain as C# code in the output, but it will be commented out.
See the Synergex YouTube video Using the C# to DBL Code and Solution Converters in Visual Studio. |
To use the C# to DBL Code Converter,
1. | Open a Synergy/DE project and select Tools > C# to DBL Code Converter from the Visual Studio menu. |
2. | Enter or paste C# code in the C# Code pane of the code converter. |
3. | If you want code generated for a previous version of the Synergy Runtime, set the Language Version field to that version. |
4. | On the C# to DBL Code Converter menu bar, select File > Convert C# to DBL. |
The translated code is displayed in the DBL Code pane and copied to the Windows Clipboard. You can copy code in this pane, and you can edit and copy code in the C# Code pane.
To clear a code pane, right click in the pane and select Clear from the context menu.
To clear both code panes, select Edit > Clear Windows.
To save code in the DBL Code pane to a file, select File > Save As.