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 attr to not overwrite Member with default value #268

Merged
merged 6 commits into from
Mar 28, 2024

Conversation

hadashiA
Copy link
Contributor

@hadashiA hadashiA commented Mar 22, 2024

#185

Add [SuppressDefaultInitialization] attribute.

e.g)

[MemoryPackable]
partial class A
{
    public int X;
    public int Y = 12345;

    [SkipOverwriteByDefault]
    public float Z = 678.9f;
}
    NEW:
        value = new FieldDefaultValue()
        {
            @X = __X, 
            @Y = __Y
        };
        if (3 <= count) value.@Z = __Z; // < Added this branch

@hadashiA hadashiA force-pushed the hadashiA/skip-overwrite-by-default branch from 523c08b to 3162562 Compare March 22, 2024 07:39
@hadashiA hadashiA force-pushed the hadashiA/skip-overwrite-by-default branch from f9c29e6 to c40d92a Compare March 22, 2024 09:17
@hadashiA hadashiA force-pushed the hadashiA/skip-overwrite-by-default branch from c40d92a to 438298a Compare March 22, 2024 09:24
@hadashiA hadashiA force-pushed the hadashiA/skip-overwrite-by-default branch 2 times, most recently from 3f0fdc6 to 8910224 Compare March 22, 2024 10:14
@hadashiA hadashiA force-pushed the hadashiA/skip-overwrite-by-default branch from 8910224 to 5cc81fc Compare March 22, 2024 10:15
@hadashiA hadashiA merged commit 4cefdad into main Mar 28, 2024
2 checks passed
@hadashiA hadashiA deleted the hadashiA/skip-overwrite-by-default branch March 28, 2024 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant