# Persistent to Volatile and back

**URL:** <https://discourse.mcneel.com/t/persistent-to-volatile-and-back/56335>\
**Category:** Grasshopper Developer\
**Created:** [February 28, 2018, 5:16pm UTC](https://discourse.mcneel.com/t/persistent-to-volatile-and-back/56335 "2018-02-28T17:16:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PhilipAtBranch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/philipatbranch/32/115630_2.png) [@PhilipAtBranch](https://discourse.mcneel.com/u/PhilipAtBranch)\
**Post date:** [February 28, 2018, 5:16pm UTC](https://discourse.mcneel.com/t/persistent-to-volatile-and-back/56335/1 "2018-02-28T17:16:57Z")

</div>

(Writing components in C#)  
I want to move/copy an OUTPUT param’s VolatileData to its PersistentData regardless of the structure. I also want to do the reverse in a different context. I thought this would be simple, but I can’t figure it out. I’ve read that the first is what “Internalize Data” does, but why is it so difficult to do manually in code? And why is there no API call to do it? At this point, I’m assuming it’s intentionally forbidden (PersistentData is readonly), but I just wanted to check.

---

<div class="post-metadata">

**Author:** ![DavidRutten](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/davidrutten/32/755688_2.png) [@DavidRutten](https://discourse.mcneel.com/u/DavidRutten)\
**Post date:** [February 28, 2018, 8:20pm UTC](https://discourse.mcneel.com/t/persistent-to-volatile-and-back/56335/2 "2018-02-28T20:20:39Z")

</div>

Outputs will not support persistent data, you may be able to assign it, but the volatile data of output parameters is always populated by the component. You should however be able to copy the volatiledata of an output to the persistent data of an input or floating parameter. Do note that you need to perform this copy _after_ the solution completes. The three most common ways in which this happens are:

1. In response to a UI event (button press, mouse click, keydown)
2. By scheduling a new solution on the `GH_Document` and registering a callback delegate that copies the data.
3. By handling the `GH_Document.SolutionEnd` or `GH_Document.SolutionStart` event.

You can assign persistent data using the `GH_PersistentParam<T>.SetPersistentData(GH_Structure<T> data)` method. The datatree will be copied superficially only.

---

<div class="post-metadata">

**Author:** ![PhilipAtBranch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/philipatbranch/32/115630_2.png) [@PhilipAtBranch](https://discourse.mcneel.com/u/PhilipAtBranch)\
**Post date:** [March 2, 2018, 4:11pm UTC](https://discourse.mcneel.com/t/persistent-to-volatile-and-back/56335/3 "2018-03-02T16:11:26Z")

</div>

Thanks for the reply. I figured out what I needed, and the key to my misunderstanding was the fact that you can’t set the PersistentData during the solution.
