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 > Operation mapping for C# (C# code)
  
Operation mapping for C# (C# code)
ACS can generate the following class and struct members from an Operation:
Constructors – apply the «C# Constructor» stereotype to the Operation.
Delegates – apply the «C# Delegate» stereotype to the Operation.
Finalizers – apply the «C# Finalizer» stereotype to the Operation.
Indexers – apply the «C# Indexer» stereotype to the Operation.
Methods – apply the «C# Method» stereotype to the Operation.
Operators – apply the «C# Operator» stereotype to the Operation.
ACS can generate the following interface members from an Operation:
Constructors – apply the «C# Constructor» stereotype to the Operation.
Finalizers – apply the «C# Finalizer» stereotype to the Operation.
Indexers – apply the «C# Indexer» stereotype to the Operation.
Methods – apply the «C# Method» stereotype to the Operation.
If none of the preceding Stereotypes are applied to an Operation, ACS can generate an Operation as follows:
A constructor if the Operation's name matches the name of the owning item.
A finalizer if the Operation's name matches the name of the owning item preceded with a ~.
An operator if the Operation's name is a valid operator.
A method if the Operation's name does not result in it being generated as a constructor, finalizer or operator.
* 
Note that ACS generates a Model or Package scoped Operation only when that Operation is set up as a delegate.
ACS generates the child items, properties and tagged values of an Operation as follows.
Child items:
If the Operation owns Parameters, ACS generates the parameters in the order specified in Modeler. For Parameter mapping information, see Parameter mapping.
Properties:
If the Abstract property is set to True (Abstract check box selected on Property Pages), ACS does not generate the virtual modifier for a method or indexer.
If the Binding property is set to At Runtime, ACS generates a virtual modifier for a method or indexer, unless the Abstract property is set to True or the Binding is At Compile
If the Body property has a value, ACS may generate the value as the body of the associated class, struct or interface member.
Whether ACS generates the Body property is determined by the ACS settings. For more information about maintaining operation bodies through ACS, click here Strategy for maintaining reversible properties
If reverse engineering is enabled in ACS, you can change the body code in the code file and ACS will update the Body property in the model.
If the Data Usage property is set to On Class, ACS generates a static modifier for a method or constructor, unless a delegate is specified through the C# Delegate Type tag definition.
If a Description is specified, ACS generates the text of a Description property on the line before the code generated for the class, struct or interface member. For information about how comments are generated, click here Generating code comments
The Immutable property is ignored.
ACS generates the Name property as the identifier of the class, struct or interface member when appropriate.
* 
Note that ACS may modify the Operation name that is added to the code to make it valid for C#. You can specify the exact Operation name to add to the code through the CODE_GENERATION_NAME property of an Operation. Tell me more...
ACS generates the Return Type property as the type for the class, struct or interface member when appropriate.
The Timing properties (Synchronization and Duration) are ignored.
The Visibilityproperty can be set to Public, Private, Protected or Package:
If the Visibility is set to Public, Protected or Private, ACS generates the Operation with either a public, protected or private modifier if appropriate.
If the Visibility is set to Package, the Operation is treated as an internal.
If the tagged value of the C# Internal tag definition is set to internal or protected internal, the Visibility property is ignored.
Tag Definitions:
For Constructors
If the «C# Constructor» stereotype is applied to the Operation, ACS generates the Operation as a constructor. The Data Usage property of the Operation determines whether ACS generates the constructor as a static constructor or instance constructor.
* 
Note that if an Operation is not Stereotyped and its name is the same as the owning item, ACS generates that Operation as a constructor.
The «C# Constructor» stereotype applies the following Tag Definitions to an Operation:
If a value is set for the tagged value of the C# Attributes tag definition, ACS generates the value as the attributes of the constructor.
For Operations whose Data Usage is On Instance, if a value is set for the tagged value of the C# Constructor Initializer tag definition, ACS generates the value as the initializer of the instance constructor.
If the tagged value of the C# Externtag definition is set to True, ACS generates the constructor with the extern modifier.
For Operations whose Data Usage is On Instance:
If the tagged value of the C# Internal tag definition is set to Internal, ACS generates the constructor with the internal modifier.
If the tagged value of the C# Internal tag definition is set to Protected Internal, ACS generates the constructor with the protected internal modifiers.
For Operations whose Data Usage is On Class, the C# Internal tag definition and the Visibility property are ignored and the constructor is generated as static.
If the tagged value of the C# Unsafetag definition is set to True, ACS generates the constructor with the unsafe modifier.
For Delegates
If the «C# Delegate» stereotype is applied to the Operation, ACS generates the Operation as a delegate. The «C# Delegate» stereotype applies the following Tag Definitions to an Operation:
If the type of the delegate is a generic type, ACS generates the tagged value of the C# Actual Parameters tag definition as the type arguments for that generic type.
If a value is set for the tagged value of the C# Attributes tag definition, ACS generates the value as the attributes of the delegate.
If the tagged value of the C# Internal tag definition is set to Internal, ACS generates the delegate with the internal modifier. If the tagged value of the C# Internal tag definition is set to Protected Internal, ACS generates the delegate with the protected internal modifiers.
If the tagged value of the C# Needs Qualified Type tag definition is set to True, ACS generates the delegate's type using its fully qualified name, rather than its unqualified name.
If the tagged value of the C# New tag definition is set to True, ACS generates the new keyword when appropriate.
If a value is set for the tagged value of the C# Type Parameters tag definition, ACS generates the value as the type parameters within angled brackets after the delegate identifier.
If a value is set for the tagged value of the C# Type Parameters Constraints tag definition, ACS generates the value as the type parameters constraints after the closing parenthesis for the parameters.
If the tagged value of the C# Unsafetag definition is set to True, ACS generates the delegate with the unsafe modifier.
For Finalizers
If the «C# Finalizer» stereotype is applied to the Operation, ACS generates the Operation as a finalizer. ACS generates the finalizer using the name of the scoping item prefixed by ~. The «C# Finalizer» stereotype applies the following Tag Definitions to an Operation:
* 
Note that if an Operation is not Stereotyped and its name is the same as the owning item preceded by a '~', ACS generates that Operation as a finalizer.
If a value is set for the tagged value of the C# Attributes tag definition, ACS generates the value as the attributes of the finalizer.
If the tagged value of the C# Externtag definition is set to True, ACS generates the finalizer with the extern modifier.
If the tagged value of the C# Unsafetag definition is set to True, ACS generates the finalizer with the unsafe modifier.
For Indexers
If the «C# Indexer» stereotype is applied to the Operation, ACS generates the Operation as an indexer.
* 
ACS generates an indexer only after a tagged value is set for either the C# Get Accessor Body or C# Set Accessor Body tag definition.
The «C# Indexer» stereotype applies the following Tag Definitions to an Operation:
If the type of the indexer is a generic type, ACS generates the tagged value of the C# Actual Parameters tag definition as the type arguments for that generic type.
If a value is set for the tagged value of the C# Attributes tag definition, ACS generates the value as the attributes of the indexer.
If the tagged value of the C# Extern tag definition is set to True (and the Operation is not abstract), ACS generates the indexer with the extern modifier.
If a value is set for the tagged value of the C# Get Accessor Attributes tag definition, ACS generates the value as the attributes of the get accessor declaration before the Get statement.
If a value is set for the tagged value of the C# Get Accessor Body tag definition, ACS generates the value as the accessor body of the get accessor declaration.
If reverse engineering is enabled in ACS, you can change the body code of the get accessor in the code file and ACS will update the tagged value of the C# Get Accessor Body tag definition in the model.
If the tagged value of the C# Delegate Type tag definition references an Operation, ACS generates the value as type of the indexer.
If the value of the C# Get Accessor Modifiers tag definition is not set to none, ACS generates the value as the modifiers of the get accessor declaration.
If the tagged value of the C# Internal tag definition is set to Internal, ACS generates the indexer with the internal modifier. If a value of the C# Internal tag definition is set to Protected Internal, ACS generates the indexer with the protected internal modifiers.
If the tagged value of the C# Needs Qualified Type tag definition is set to True, ACS generates the indexer's type using its fully qualified name, rather than its unqualified name.
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# Override tag definition is set to True (and the Operation has At Compile binding and does not have On Class data usage), ACS generates the indexer with the override modifier.
If the tagged value of the C# Sealed tag definition is set to True (and the Operation is override and not abstract) , ACS generates the indexer with the sealed modifier.
If a value is set for the tagged value of the C# Set Accessor Attributes tag definition, ACS generates the value as the attributes of the set accessor declaration before the Set statement.
If a value is set for the tagged value of the C# Set Accessor Body tag definition, ACS generates the value as the accessor body of the set accessor declaration.
If reverse engineering is enabled in ACS, you can change the body code of the set accessor in the code file and ACS will update the tagged value of the C# Set Accessor Body tag definition in the model.
If the value of the C# Set Accessor Modifiers tag definition is not set to none, ACS generates the value as the modifiers of the set accessor declaration.
If the tagged value of the C# Unsafe tag definition is set to True, ACS generates the indexer with the Unsafe modifier.
For Methods
If the «C# Method» stereotype is applied to the Operation, ACS generates the Operation as a method. The «C# Method» stereotype applies the following Tag Definitions to an Operation:
If the type of the method is a generic type, ACS generates the tagged value of the C# Actual Parameters tag definition as the type arguments for that generic type.
If a value is set for the tagged value of the C# Attributes tag definition, ACS generates the value as the attributes of the method.
If the tagged value of the C# Delegate Type tag definition references an Operation, ACS generates the value as type of the methods.
If the tagged value of the C# Extern tag definition is set to True (and the Operation is not Abstract), ACS generates the method with the extern modifier.
If the tagged value of the C# Internal tag definition is set to Internal, ACS generates the method with the internal modifier. If the tagged value of the C# Internal tag definition is set to Protected Internal, ACS generates the method with the protected internal modifiers.
If the tagged value of the C# Needs Qualified Type tag definition is set to True, ACS generates the method's type using its fully qualified name, rather than its unqualified name.
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# Override tag definition is set to True (and the Operation has at Compile binding and does not have On Class data usage), ACS generates the method with the override modifier.
If the tagged value of the C# Sealed tag definition is set to True (and the Operation is override and not abstract) , ACS generates the method with the sealed modifier.
If a value is set for the tagged value of the C# Type Parameters tag definition, ACS generates the value as the type parameters within angled brackets after the method name.
If a value is set for the tagged value of the C# Type Parameters Constraints tag definition, ACS generates the value as the type parameters constraints after the closing parenthesis for the parameters.
If the tagged value of the C# Unsafe tag definition is set to True, ACS generates the method with the Unsafe modifier.
For Operators
If the «C# Operator» stereotype is applied to the Operation, ACS generates the Operation as an operator.
A conversion operator must have one and only one parameter. In addition, it must have a return value or pass a parameter that is typed by the containing class or struct.
* 
Note that if an Operation is not Stereotyped and its name is a valid operator, ACS generates that Operation as an operator.
The «C# Operator» stereotype applies the following Tag Definitions to an Operation:
If the type of the operator is a generic type, ACS generates the tagged value of the C# Actual Parameters tag definition as the type arguments for that generic type.
If a value is set for the tagged value of the C# Attributes tag definition, ACS generates the value as the attributes of the operator.
If the tagged value of the C# Delegate Type tag definition references an Operation, ACS generates the value as type of the operator.
If the tagged value of the C# Extern tag definition is set to True, ACS generates the operator with the extern modifier, and the body property of the Operation is not generated.
If the tagged value of the C# Needs Qualified Type tag definition is set to True, ACS generates the operator's type using its fully qualified name, rather than its unqualified name.
If the tagged value of the C# Operator Conversion tag definition is set to Implicit, ACS generates the method with the implicit modifier. If the tagged value of the C# Operator Conversion tag definition is set to Explicit, ACS generates the method with the explicit modifier.
If the tagged value of the C# Unsafetag definition is set to True, ACS generates the operator with the Unsafe modifier.