Skip to content

Add deep copy method generation #37

Open

Description

@SoftStoneDevelop

Now you can create a copy like this:

var tempWrap = new Benchmark.Struct.JobStructWrapper();
tempWrap.Fill(in item);
var copyItem = tempWrap.GetValue();

But this way is slow.

You need to generate something like the following:

public static JobStruct DeepCopy(in JobStruct item)
{
    var result = new JobStruct();
    result.Int32 = item.Int32;
    result.Int64 = item.Int64;
    result.JobStruct2.Int32 = item.Int32;
    result.JobStruct2.Int64 = item.Int64;

    return result;
}

Usage:

var copyItem  = JobStructHelper.DeepCopy(in item);

Activity

  1. added
    enhancement
    on Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions