So I am trying to create a non static class, that based on array of objects will return clean table of them. So I am thinking how to get automatically name of the fields, not value of the fields and so I dive into Reflections. So now I think I know enough to finally write a code, when I found a problem. If my class has 7 fields: a, b, c, d, e, f, g. But from what I researched the GetFields() method doesn't return them in any particular order, from top to bottom or alphabetically, which would be useless for me. So I am asking if anybody knows anything about it.
Book book = new Book();
book.name = "Alchemist";
book.Author = "Coelho";
book.NumberOfPages = 210;
FieldInfo[] fields = typeof(Book).GetFields();
for (int i = 0; i < fields.Length; i++)
I am counting that the top field wold be the in field[0], 2nd from the top would be field[1],... and so on. Any nuggets of wisdom from the Kings is appreciated by this humble peasant.