一、问题
如题,我在使用GetProperties 去反射其属性名,并写入到本地时,发现经常会顺序莫名其妙的改变
经过查找发现是它的返回值并不能保证顺序
二、说明
根据以下MSDN上的说明:
The GetProperties method does not return properties in a particular
order, such as alphabetical or declaration order.
GetProperties()这个函数返回的顺序并不能保证是一致的
所以如果对其属性的顺序有要求的情况下需要特别注意
三、 解决
可以参考以下文章使其具有顺序
参考链接