- Overview
- How to create a procedure in C# code?
- Important notes
- How to call C# classes?
- Using existing .NET assemblies
- Adding specific C# classes
You have the ability to type C# code in the WINDEV applications (Windows applications and components, .NET assemblies). This allows you to create global procedures in C# code. How to create a procedure in C# code? To type the code of a global procedure in C# code: - Create a new global procedure (via "New global procedure" in the context menu of sets of procedures in the "Project explorer" pane). Specify the name of this procedure.
Caution: the procedure name must contain no accented characters. - In the code editor, click the "WL" letters displayed in front of the caption of global procedure. The bar becomes light blue and the "C#" characters appear in front of the procedure name. The existing code is changed into comments.
Remarks: - To go back to WLanguage code, all you have to do is click "C#" in the procedure bar.
- The name of C# procedure must contain no accented character. Otherwise, the accented characters will be deleted when switching to C# code.
Important notes - Passing parameters to a C# procedure is automatically done by value.
- The parameters of procedures written in C# code must necessarily be typed with a primitive type (integer, real, string, etc.). The following types are supported:
- char
- wchar_t
- float
- double
- int
- long
- short
- void
- bool
- BOOL
- Avoid the comments such as "/*". The WLanguage comments ("//") are supported.
Using existing .NET assemblies If your procedure in C# code uses C# classes, include the necessary assemblies in the project. Remark: The "using" declarations found before the prototypes of procedures in C# are taken into account for the entire collection. Adding specific C# classes You have the ability to include C# classes by adding ".cs" source files into the list of project elements: - via the list of elements,
- by selecting "Other" in the right button of project explorer.
|
|
|
|