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

Incorrect field order when sending to the client #29

Closed
DmitryHudrich opened this issue May 10, 2024 · 1 comment
Closed

Incorrect field order when sending to the client #29

DmitryHudrich opened this issue May 10, 2024 · 1 comment

Comments

@DmitryHudrich
Copy link

image
image

image
image

When using anonymous types as dto, the order of their fields is sorted alphabetically for some reason. But this does not happen when using existing types. Is this how it should be?

@lucasteles
Copy link
Owner

lucasteles commented Jun 5, 2024

@DmitryHudrich

Is this how it should be?

I have to say yes, mostly because this library doesn't have anything with this behavior.

This happens because of how the F# compiler emits the anonymous type objects. It creates the class properties in alphabetic order unlike C#.

You can see the F# reversed to C# code here and compare in how the thing happens on C# here

You can easily see this in the type signature also
image

See fsharp/fslang-suggestions#1369

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

2 participants