Question: I want to copy members of one struct (GR) to another larger struct (FR)

```
    public struct gr
    {
        public double O,C,L;
        public bool isLastFRH, isLastFRL;
    }
    public gr GR;

    // Here I assign values to GR and then I want to copy all these values to FR

    public struct fr
    {
        public double O,C,L;
        public bool isLastFRH, isLastFRL;
        // it has more variables.
    }
    public fr FR;

```

Is it possible to be done without going one by one:

```
    FR.O = GR.O; // and so on...

```

Thank you

Answer: 
You cannot subclass a struct in C#, so your best option is to create a new struct that uses the struct you want to copy. The `GR` property is a struct so it will be a copy of whatever you set it with.

In your `fr` class add the `gr` member:

```
public struct fr
{
   public gr GR;
   //add your unique props..
}

```

Now you can create `fr` and just set the `GR` property, it will copy.

```
var gr1 = new gr() {  //set all your properties.. };
var fr1 = new fr() { GR = gr1, ... //set all your fr specific props here };

```
Try using automapper, it allows you to create mappings easily. [see details](https://docs.automapper.org/en/stable/Getting-started.html)

```
var config = new MapperConfiguration(cfg => cfg.CreateMap<gr, fr>());

var mapper = new Mapper(config);
Fr model = mapper.Map<Fr>(gr);

```