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

[question] how to specify a custom mapping between constructor parameters and class fields/properties #18

Closed
TMaddox opened this issue Sep 1, 2019 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@TMaddox
Copy link

TMaddox commented Sep 1, 2019

This works:

class Tree
{
        [CborProperty("r")]
        private readonly byte[] _r;

        [CborConstructor]
        public ECSignature(byte[] r)
        {
            _r = Bytes.TrimLeadingZeros(r);
        }
}

While this does not:

class Tree
{
        [CborProperty("NOTr")]
        private readonly byte[] _r;

        [CborConstructor]
        public ECSignature(byte[] r)
        {
            _r = Bytes.TrimLeadingZeros(r);
        }
}

from my testing I got that with CborProperty("name"), the name has to match the name of the variable in the signature of the constructor.

@mcatanzariti mcatanzariti changed the title [bug] with property/field naming [question] how to specify a custom mapping between constructor parameters and class fields/properties Sep 1, 2019
@mcatanzariti mcatanzariti self-assigned this Sep 1, 2019
@mcatanzariti mcatanzariti added the question Further information is requested label Sep 1, 2019
mcatanzariti pushed a commit that referenced this issue Sep 1, 2019
…ctor parameters and class fields/properties #18
@mcatanzariti
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants