在排序的dotnet反思的请求 [英] Ordering of reflection requests in dotnet

查看:124
本文介绍了在排序的dotnet反思的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我打电话的GetProperties,()的一个类型,属性是有序的,因为它们都写在源$ C ​​$ C。这是非常方便的,但我的问题是,如果这是一个保证的行为,也可能这种变化取决于运行时版本和环境。有谁知道一些事?

When I call GetProperties() on a type, the properties are ordered as they are written in the source code. This is very handy but my question is, if this is a guaranteed behavior or may this change depending on the runtime version and the environment. Does anyone know something about that?

推荐答案

没有,你不能假设的顺序将保持不变。

No, you can't assume the order will stay the same.

DOC 报价:

的getProperties方法不返回一个特定的顺序性,如按字母顺序或声明顺序。您的code一定不能依赖于它的属性返回的顺序,因为该顺序有所不同。

这篇关于在排序的dotnet反思的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆