Add Objects to a Subgraph

I have anther issue:

I need to create a subgraph and I need to be able to add GoObjects ( ColoredNode or anotherSubGraph) to it on the fly.
I checked your SubGraph application but in there you only add collections of objects so I tried using the GoSubgraph.Add method to add my objects but it is not quite working.

Please can you give me a ny advice.
Here is my code:
ColoredNode x1 = new ColoredNode();
foreach (Block childblock in block.Blocks)
How can I make this simple line work.

GoObjects (including GoNodes) cannot be shared by different GoGroups (including GoSubGraphs).

foreach (Block childblock in block.Blocks) {
ColoredNode x1 = new ColoredNode();
... initialize x1 appropriately according to childblock ...

Thanks Walter. THat helped.

I am able to add it now. I keep forgetting that in C# everything is a reference.

Well, that’s not quite true, since any type that inherits from System.ValueType is by definition a value, not a reference type.

And that is the case for all .NET languages, not just C#.