# Mappings Grammar

### Mappings Grammar

Mapping is a crucial concept for our migrators. It means that from a set of values as input, a function is applied to each value, and generates a set with new values.

It's a powerful tool that allows design mappings by using a syntax quite similar to C#, which is used to transform VB6 code to its equivalent in .NET (C# or VB).

This applies to the following statements:

* Types
* Members (Methods, properties, subroutines, events, among others)

Also, this tool offers the possibility to generate code for statements that are not supported in .NET (for more information, see [Upgrade Stubs](/vbuc/generated-code.md#upgrade-stubs)), reducing the time to carry out the compilation of a migrated project.

In the code below they are some types like `enumAlign` and `ctTips (ctTips1)`, including some members like `Active`, `Tag`, `ToolTipText` and `Alignment`.

**Original VB6 Code source**

```php
Dim enumVal As enumAlign
...
Private Sub setCtTips()
    ctTips1.Active = True
    ctTips1.Tag = "Display component"
    ctTips1.ToolTipText = "CtTips1"
    ctTips1.Alignment = enumVal
End Sub
```

By using Mappings Grammar it is possible to migrate classes and their members to their .NET equivalent.

**Mappings design using Mappings Grammar**

```fsharp
type TipsLib.ctTips => System.Windows.Forms.ToolTip;
type TipsLib.enumAlign => nomap;

member TipsLib.ctTips.Active => Active as boolean;
member TipsLib.ctTips.Container => Container;
member TipsLib.ctTips.Tag => Tag as string;
member TipsLib.ctTips.ToolTipText => ToolTipTitle as string;
member TipsLib.ctTips.Alignment => nomap;
```

**C# Code Generated by VBUC**

```csharp
//UPGRADE_ISSUE: (2068) TipsLib.enumAlign object was not upgraded.
UpgradeStubs.TipsLib_enumAlignEnum enumVal = (UpgradeStubs.TipsLib_enumAlignEnum) 0;
...
private void setCtTips()
{
    ctTips1.Active = true;
    ctTips1.Tag = "Display component";
    ctTips1.ToolTipTitle = "CtTips1";
    //UPGRADE_ISSUE: (2064) TipsLib.ctTips property ctTips1.Alignment was not upgraded.
    ctTips1.setAlignment(enumVal);
}
```

> * *Notes:*
>   * *As shown in the example above, `ctTips` will be upgraded into `System.Windows.Forms.ToolTip`.*
>   * *Some members of `ctTips` class like `Active`, `Container`, `Tag` and `ToolTipText` will be upgrade to its .NET equivalent.*
>   * *There are some classes and members that are not supported in .NET, so it generates stubs; like the class `enumAlign` and the member `Alignment`.*

{% file src="/files/4zeu8h3mhSOpOnuoWPeQ" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gapvelocity.ai/vbuc/mappings-grammar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
