Hi,
I am generating .NET code from modeller.
The generic type of RelativeLocation VariableType below should be compatible with its super type that is not generic.
Therefore T should get a constraint of being a vector or a subtype of vector (see in red).
The red part of code is not generated automatically and causes compilation problems and inconsistency.
/// <summary>
/// A typed object which represents a RelativeLocation.
/// </summary>
public partial class RelativeLocation<T> : RelativeLocation where T : Vector
{
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>
/// The value.
/// </value>
[UaInstanceDeclaration(IsValue = true, NamespaceUri = IRIS.DDHub.Namespaces.DDHub)]
public new T Value
{
get { return (T)((base.Value)??default(T)); }
set { base.Value = value; }
}
}
Problem with generics in auto-generated code (.NET)
Moderator: uamodeler
-
- Jr. Member
- Posts: 4
- Joined: 08 Jun 2017, 14:36
- Support Team
- Hero Member
- Posts: 3072
- Joined: 18 Mar 2011, 15:09
Re: Problem with generics in auto-generated code (.NET)
Hello,
How does your model look like? Especially we need to know the DataType of RelativePath and the DataType of the supertype of RelativePath. Please tell us in more detail what are you expecting to be generated.
There are some generated code files that should not be edited. The file defing the model classes si one of them. Please see the file header of each file.
How does your model look like? Especially we need to know the DataType of RelativePath and the DataType of the supertype of RelativePath. Please tell us in more detail what are you expecting to be generated.
There are some generated code files that should not be edited. The file defing the model classes si one of them. Please see the file header of each file.
Best regards
Unified Automation Support Team
Unified Automation Support Team