Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deep copy method generation #37

Open
SoftStoneDevelop opened this issue Aug 29, 2022 · 0 comments
Open

Add deep copy method generation #37

SoftStoneDevelop opened this issue Aug 29, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@SoftStoneDevelop
Copy link
Owner

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);
@SoftStoneDevelop SoftStoneDevelop added the enhancement New feature or request label Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant