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

[Feature Request] Support alternate property names from Attributes #81

Open
gilmae opened this issue Feb 8, 2020 · 0 comments
Open

Comments

@gilmae
Copy link

gilmae commented Feb 8, 2020

Super contrived example:

public class Foo {
   
   [JsonProperty("bar-baz")]
   [DataMember(Name="bar_baz")]
   [XmlAttribute(AttributeName="barBaz")]
   public string BarBaz {get; set;}
}

var f = new Foo();
var a = TypeAccessor.Create(typeof(Foo));

a[f, "bar-baz"]
a[f, "barBaz"]
a[f, "bar_baz"]

Scenarios in which the property is requested using one of the serialised names will fail with an exception. (The mooted IsDefined(name) method would help here

It would be desirable if the accessor supports the serialised versions of property names.

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

No branches or pull requests

1 participant