开发者

System.Reflection.PropertyInfo Array

开发者 https://www.devze.com 2023-01-14 12:25 出处:网络
After Getting a System.Reflection.PropertInfo array for a class- Does anyone know how or if thi开发者_运维百科s array is sorted or do I have to Array.Sort(MySortMethods/Params)?Presumably you\'re geti

After Getting a System.Reflection.PropertInfo array for a class- Does anyone know how or if thi开发者_运维百科s array is sorted or do I have to Array.Sort(MySortMethods/Params)?


Presumably you're getiing the PropertyInfo array by calling GetProperties, in which case the ordering of the array isn't guaranteed.

From the MSDN documentation:

The GetProperties method does not return properties in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which properties are returned, because that order varies.


I would check the documentation for the method you're using to get the PropertyInfos. If it doesn't state anything about the ordering of results I would assume they are not ordered and order them myself as you suggest.

0

精彩评论

暂无评论...
验证码 换一张
取 消