Articy Forum


https://www.articy.com:443/forum/

Detecting inheritance for custom properties

https://www.articy.com:443/forum/viewtopic.php?f=47&t=18182

Page 1 of 1

Detecting inheritance for custom properties

Posted: Mon 1. May 2017, 21:06
by tcarter
I've defined some custom text properties, and would like to iterate through the properties of an ObjectProxy and execute some code if they inherit from one of these custom properties. I'm trying something like...

Code: Select all
List<string> MyCustomPropertyNames = new List<string> {"foo","bar"};

foreach (var property in obj.GetAvailableProperties())
{
   var info = obj.GetPropertyInfo(property);
   if (MyCustomPropertyNames.Contains(info.DataType.ToString()))
   {
      ...
   }
}


... but info.DataType is always giving me Text. Is there a way to check for what the name of the inherited custom property is?

Re: Detecting inheritance for custom properties

Posted: Tue 2. May 2017, 21:06
by [Articy] Peter Sabath
The GetAvailableProperties() method already return the names you are looking for.

If the name contains a dot '.' the property comes from a feature and has the form
Code: Select all
<feature-technical name>.<property-technical name>

if you need to check for a specific template you can use the
Code: Select all
obj["TemplateName"] as String

to check for a specific template technical name

All times are UTC
Page 1 of 1