-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
GetFields in declaration order #19732
Comments
I am pretty sure that TypeLoader uses metadata order for What are the scenarios when you need the right order in Reflection? Or is it just curiosity question? Anyway, if you still think some docs should be enhanced, please post link to the docs and suggest the changes (quote the text before and after). |
Since no one complained on the SO, I also believe it will work. Would be great if we can be 100% sure. Also, can someone confirm 'LayoutKind.Sequential' is required for this to work.
My use case is serialization. I agree, if the use case is not common enough it shouldn't clutter the docs.
https://msdn.microsoft.com/en-us/library/ch9714z3(v=vs.110).aspx The documentation has a paragraph on the order:
We can add a line there:
|
That's correct. For non-sequential, the runtime is free to rearrange fields as it feels fit.
Agree. Let's not clutter the docs then. If the SO topics gets lots of hits, we can reconsider later. |
If you search the internet how to do this, you will find the advice to sort by MetadataToken (e.g.: http://stackoverflow.com/questions/8067493/if-getfields-doesnt-guarantee-order-how-does-layoutkind-sequential-work)
Is this the proper way to do this? If so, perhaps it can be included in the documentation.
Does this need LayoutKind.Sequential to work?
The text was updated successfully, but these errors were encountered: