XeroAPI.Net
XeroAPI.Net copied to clipboard
Adding example of string constants to pass parameters with ease
Mentioned on issue #35
Hi Ahmed,
I'm interested in this kind of patch, but I'm wondering why you chose string constants instead of creating this as an Enum?
Regards, Matthew
Honestly, I don't know :smiley:
I can refactor it, and add all the cases where this happens that I can think of. Just wanted to check with you guys if it's a good idea before actually coding it!
I should probably make it clear that I don't work for Xero or represent them in any way, we're just a heavy user of the API. I'm reasonably confident that the API can be modified to use Enums for these fields instead of strings and it still work with serializing for over-the-web communication. I think it would make use of the library easier.
Cool.
I remember now why I went with the strings. Depending on your serializer provider and settings you're using it will either serialize as a string or as an int. So I thought using the strings was a sure way to never get any errors