Search code examples
.netsystem.reflection

System.Reflection.PropertyInfo Array


After Getting a System.Reflection.PropertInfo array for a class- Does anyone know how or if this array is sorted or do I have to Array.Sort(MySortMethods/Params)?


Solution

  • 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.