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 > Modeling C# code in Modeler > Modeling C# type arguments for a generic type in a model (C# code)
  
Modeling C# type arguments for a generic type in a model (C# code)
You can specify type arguments for the following C# code elements:
A class, data type or interface that is derived from a generic type through a Generalization.
A class or struct that implements a generic interface through an Interface Realization Dependency.
A constant, field or property that uses a generic type as its type.
An operation return type that uses a generic type as its type.
A parameter that uses a generic type as its type.
To specify type arguments for a class, data type or interface that is derived from a generic type:
1. Model the derived class, data type or interface in the model. For more information, see the following topics:
Modeling a C# class in a model (C# code)
Modeling a C# generic type in a model (C# code)
Modeling a C# interface in a model (C# code)
Modeling a C# struct in a model (C# code)
2. Apply the «C# Specialization» stereotype to the Generalization that models the derivation.
3. On the Generalization's Property Pages, click the C# Specialization tab.
For information about applying Stereotypes to an item, click here Applying a stereotype to a model item
4. Set the tagged value of the C# Actual Parameters to the type arguments you want to use for the derived class, struct or interface.
For information about setting the tagged value of a Tag Definition, click here Setting a tagged value for an applied tag definition
To specify type arguments for a class or struct that implements a generic interface:
1. Model the class or struct to implement the interface in the model.
Modeling a C# class in a model (C# code)
Modeling a C# generic type in a model (C# code)
Modeling a C# interface in a model (C# code)
Modeling a C# struct in a model (C# code)
Modeling a C# interface in a model (C# code)
Modeling inheritance for a class, struct or interface in a model (C# code)
2. Apply the «C# Dependency» stereotype to the Dependency that implements the interface.
For information about applying Stereotypes to an item, click here Applying a stereotype to a model item
3. On the Dependency's Property Pages, click the C# Dependency tab.
4. Set the tagged value of the C# Actual Parameters to the type arguments you want to use for the class, struct or interface.
For information about setting the tagged value of a Tag Definition, click here Setting a tagged value for an applied tag definition
To specify type arguments for a constant, field or property that uses a generic type as its type:
1. Model the constant, field or property to use a generic type as its type in the model.
Modeling a C# constant in a model (C# code)
Modeling a C# field in a model (C# code)
Modeling a C# generic type in a model (C# code)
Modeling a C# property in a model (C# code)
2. Apply the «C# Constant», «C# Field» or «C# Property» stereotype to the Attribute or Role, as appropriate.
For information about applying Stereotypes to an item, see Applying a stereotype to a model item
3. On the Attribute's or Role's Property Pages, click the C# Constant, C# Field or C# Property tab, as appropriate.
4. Set the tagged value of the C# Actual Parameters to the type arguments you want to use for the constant, field, or property.
For information about setting the tagged value of a Tag Definition, see Setting a tagged value for an applied tag definition
To specify type arguments for a method, indexer or operator that uses a generic type as its return type:
1. Model the method, indexer or operator to use a generic type as its return type in the model.
Modeling a C# generic type in a model
Modeling a C# indexer in a model
Modeling a C# method in a model
Modeling a C# operator in a model
2. Apply the «C# Method», «C# Indexer» or «C# Operator» stereotype to the Operation, as appropriate.
3. On the Operation's Property Pages, click the C# Method, C# Indexer or C# Operator tab, as appropriate.
4. Set the tagged value of the C# Actual Parameters to the type arguments you want to use for the method, indexer or operator.
For information about setting the tagged value of a Tag Definition, see Setting a tagged value for an applied tag definition
To specify type arguments for a parameter that uses a generic type as its type:
1. Set up the parameter to use a generic type as its type in the model. See the following topics for more information:
Modeling a C# generic type in a model (C# code)
Modeling a C# parameter in a model (C# code)
2. Apply the «C# Parameter» stereotype to the Parameter.
For information about applying Stereotypes to an item, see Applying a stereotype to a model item
3. On the Parameter's Property Pages, click the C# Parameter tab.
4. Set the tagged value of the C# Actual Parameters to the type arguments you want to use for the parameter.
For information about setting the tagged value of a Tag Definition, see Setting a tagged value for an applied tag definition