Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > C# code > C# code > Reverse engineering legacy C# code > Mapping information > Data type mapping for C# (C# code)
  
Data type mapping for C# (C# code)
For each Data Type that is not nested, ACS generates a code file (.cs) unless the tagged value of the C# Parent File Scoped tag definition is set to True. Within the code file, ACS generates the Data Type as a struct.
The struct declaration and body is derived from the items it owns, properties of the Data Type, and the tagged values set for Tag Definitions applied by the «C# Classifier» stereotype.
ACS generates the child items, properties and tagged values of a Data Type as follows.
Child items:
If the Data Type owns any Attributes, ACS generates each Attribute as a constant, event, field or property. For more information about Attribute mapping, click here Attribute mapping.
If the Data Type owns any Operations, ACS generates each Operation as a constructor, delegate, finalizer, indexer, method or operator. For more information about Operation mapping, click here Operation mapping
If the Data Type owns any Roles, ACS generates the each Role as a constant, field or property. For more information about Role mapping, click here Association mapping
Other child items are ignored.
Properties:
If a Description is specified, ACS generates the text of a Data Type's Description property on the line before the code generated for the struct. For information about how comments are generated, click here Generating code comments
ACS generates the Name property as the identifier of the struct.
* 
ACS may modify the struct identifier that is added to the code to make it valid for C#. You can specify the exact identifier to use through the CODE_GENERATION_NAME property of a Data Type. Tell me more...
If the Template property is set to True (Template check box selected on Property Pages), ACS generates the Data Type as a generic struct. ACS generates the Formal Template Parameters as the type parameters between angle brackets after the struct identifier.
If the Visibility property is set to public, private or protected: ACS generates the struct with a public, private or protected modifier accordingly – ACS generates private and protected modifiers only for nested Data Type.
If the Visibility property is set to public or package: ACS generates the struct with a public or internal modifier accordingly – ACS generates private and protected modifiers only for nested structs.
Other properties are ignored.
Tag Definitions:
The «C# Classifier» stereotype applies the following Tag Definitions to a Data Type:
If a value is set for the tagged value of the C# Attributes tag definition, ACS generates the value as the set of attributes for the struct.
If a value is set for the tagged value of the C# Extern Alias Directives tag definition and the Data Type is generated as a compilation unit, ACS generates the value as the external alias directives. Use this tag definition when defining directives for a Data Type that cannot be modeled within the model.
The tagged value of the read-only C# File tag definition is used for opening generated code files from Modeler. This value is set by ACS.
* 
The tagged value of the derived C# File tag definition is stored in your computer's registry (not the model) – the path and file name you see does not apply to other users of the model.
If the tagged value of the C# Internal tag definition is set to Internal, ACS generates the struct with the internal modifier.
If the Data Type is a child of a Class and the C# Internal tag definition is set to Protected Internal, ACS generates the struct with the protected internal modifiers.
If the tagged value of the C# New tag definition is set to True, ACS generates the new keyword when appropriate.
If the tagged value of the C# Parent File Scoped tag definition is set to True, ACS does not generate a code file for the Data Type and the struct is defined in the code file that is generated for the owning Model, Package or Class.
If the tagged value of the C# Partial tag definition is set to True - ACS generates the struct with the Partial modifier.
The C# Sealed tag definition is not used when applied to a Data Type.
The C# Static tag definition is not used when applied to a Data Type.
If the Data Type is a template class (generates a generic type - see Template property) and a value is set for the tagged value of the C# Type Parameters Constraints tag definition, ACS generates the value as the constraints that apply to the type parameters of a generic type. ACS generates the value after the struct declaration and before the body code.
If the tagged value of the C# Unsafe tag definition is set to True, ACS generates the struct with the Unsafe modifier.
If a value is set for the tagged value of the C# Using Directives tag definition, ACS generates the value as the using directives of the struct.
ACS generates the using directives that are required for the code it generates; however, should you require additional using directives that cannot be derived from the model, use the C# Using Directives to specify them.