Create a property whose type is component

I wanna to create a property whose type is component , and something was found in help file as figure below. I tried such a statement:

comp.createProperty (Ref<Component>,‘Component’)

and yes,failed. What’s the problem?

 

If you want to create a property with a type like “Ref<xy>” you have to pass the type as a string like this:

comp.createProperty('Ref<Component>', 'Component')

 

1 Like

It works in python, and now I want to create a ‘List<Ref< Component>>’ in .NET, how it code?

This should work
comp.CreateProperty(typeof(List<ISimComponent>), PropertyConstraintType.NotSpecified, "myprop");

Thanks, it works! I have tried

        statement.CreateProperty(typeof(List<ISimComponent>), PropertyConstraintType.AllValuesAllowed, "list");

It turns out to be the case that should define PropertyConstraintType.