Component ID conflict when passing custom class

Hello,

I am getting an ID conflict error with some custom GH components. The ineresting thing is that the “Loaded Component” is not a component at all, but a custom class. I believe the problem is caused because I create an instance of that custom class in one component and then pass that instance to the “Conflicting Component” which then further modifies the instance. I can imagine this might cause problems because the downstream component is modifying its input. Is there a way to achieve this, or is it inherently a bad practice because of the(typically) one-way nature of GH data flow?

Thanks!

Let’s say that you define a Class and populate a List in one C#. Then in some other C# you need to read that List (a very common situation - rather the norm). If so … (a) define exactly the same Class in the other C# , (b) input the List as List of Type object and (c) use a Method like this to get the Properties:

Notify if you need an indicative example on that matter.

Hi Peter,
Thanks for the response. I should have maybe been more specific that I am developing components in VS and therefore have a Namespace for all the components, so redefining the class in each component isn’t necessary. In your example you copy the properties into NEW instances of the same type, but for my application it would be more ideal to be able to work on the same instance, so that the upstream component could react to changes made downstream. Any suggestions?

Well … I’m in the opposite side of the fence: I never use VS (brakes my nerves) and the R/GH usage in the practice (AEC BIM things and the likes) is very limited (the fact the the GH C# build in editor is 100% crap adds to the pleasure). Plus I never use compiled stuff within GH (solely C# is used in any def, that is). But anyway I’ll try to think a bit more on that issue of yours.

I figured out what the problem was. The “loaded class”, which was not a component itself, but was inheriting from the “conflicting class” because I wanted easy access to certain properties. I removed the inheritance and the error disappeared.