Assigning values to List of custom Resources in C#

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By petr0m

I have created a custom resource to save data in c#. Therefore I created a script (FirstResource) that inherits from Resource and attached it to an Resource.tres. I did the same with a second resource. All varialbes in those resources are flagged as [Export].

For the FirstResource I then want to have a List of the second resources:

public class FirstResource: Resource
{
  [Export] public List<SecondResource> = new List<SecondResource>();
}

For the second resource:

public class SecondResource: Resource
{
[Export] public int SomeAttribute;
}

Then for manager script:

public class ResManager : Node
{
    public override void _Ready()
    {
        firstRes= (FirstResource)ResourceLoader.Load("pathToFirstResource.tres");
        secondRes= (SecondResource)ResourceLoader.Load("pathToSecondResource.tres");
    }

    public void SaveResources()
    { 
     FirstResource firstResourceInstance = firstRes;

           for(int i ; i < 30 ; i++)
           {
                SecondResource secondResourceInstance = secondRes;
                secondResourceInstance.SomeAttribute = i;
                firstResourceInstance.Add(secondResourceInstance);
           }
    ResourceSaver.Save(pathToSaveResource,firstResourceInstance);
    }

}

But setting variables of the SecondResource does not work, they just remain their initial value. However the saved resource has the second resource attached multiple times in the list but all have initial values not those I have assigned.

Is there anything specific I have to account for when assigning variables to the custom resources.

What did I miss here? I would really appreaciate some help.