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:
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.
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.
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.
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:
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