Persistent Data c# component

Hi everyone,

it’s been so long since I wrote in C# in the GH component that I forgot how to make Data persistent.
I am creating points in a class and want to move them. I know it is happening, because when I change the slider, the wavesystem class get created again and thus the points. In VS I would create a private class instance outside the solve instance. How in the GH-C# Component?
Why am I so forgetful and stupid?

 {
    var ws = new Wavesystem();

    for (int i = 0; i < loops; i++)
    {
      ws.Move();
    }

    var pts = new List<Point3d>();

    for (int i = 0; i < 10; i++)
    {
      pts.Add(ws.drops[i]);
    }
    A = pts;
  }

  // <Custom additional code> 

  public class Wavesystem
  {
    public Random random = new Random();
    public List<Point3d> drops = new List<Point3d>();

    public Wavesystem()
    {
      for (int i = 0; i < 10; i++)
      {
        drops.Add(GetRandomPointXYZ());
      }
    }


    public void Move()
    {
      for (int i = 0; i < 10; i++)
      {
        drops[i] += new Vector3d(0, 0, -0.01);
      }
    }

    public  Point3d GetRandomPointXYZ()
    {
      return(new Point3d(random.NextDouble(), random.NextDouble(), random.NextDouble()));
    }
  }


Thanks everybody for helping …

230812_Debug.gh (3.9 KB)

It’s a Sign (from OuterSpace): means forget all that and do some proper thing (wave windsurfing, riding some Ducati etc etc).

Other than that I have dozens of “related” C#''s but I’m far and away from base (return time: uknown). In the mean time get proper gear and start walking the walk.

You can store any private or public property like a List<Point3d> in your case in the Custom additional code section of the component.
Then at the beginning of RunScript, check if this list has any values. If true, proceed to your code, in not, call a new WaveLength ?

That is already happening. Since I changed the office I am barely touching GH and in the sparetime I was fishing, hehe. Maybe better starting a gangster rap career. For the name, I already have an idea: Lil` Moron.

thanks @magicteddy !
I ended up putting a wavesystem in the additional code and it works.

Tip: forget the rap part, marry a rich girl, get a proper Rybovich (*) and avoid killing members of the eco system for fun.

(*) kinda a Mercedes S Class: the best or nothing.

Actually I go fishing to eat the fish. Big fish eats smaller fish.