The title says too much all this. When I am doing some reflection through my classes, will the Member Info Gate CustomAttributes () method preserve the sequence of attributes on a member? The official document says nothing.
If you are wondering why I need it, then here is the full description. It is not long and necessary for the question as it is now explained, but possibly a major problem can come with an alternative solution, in which it does not involve relying on the specialty counting order.
I am trying to create a flexible framework for a (ASP.NET) application which is likely to have a very long lifetime. Of course this will get many forms which will be accessible from the menu. To make life easier for developers, I have created a menu attribute
, which you can apply to the class of the form. In this feature its constructor has an unlimited amount of string parameters that allows the developer to specify exactly where the form in the menu will be located. A common use example would be that of [MenuItem ("Company", "Customer", "Order")]
, which means that the menu should have an item "Company" under which an item "Client "Under which an item will be" order "- which will then open the form. If necessary, there may be many of these characteristics in a single form - then it will be acceptable from many places in the menu.
Obviously the whole menu is computed in my sovereigns by calculating through all the sections and in the runtime in search for this attribute, although for a particular feature I have recently received a request that the menu item is predefined Should be sorted out. In the menu, each other has a related functionality form in the menu. Note that this alphabet is not sorted, but a predefined order that the developer specifies.
This then brings the problem - How do I specify order in these attributes? Since a menu item attribute
describes a whole hierarchy, the order specification should include the order number for the whole (or at least one part) of the ordering. Only one order number is not enough for the lower level of the hierarchy.
I can create another feature - MenuItemOrderHintAttribute
, but this will cause problems with cases when a menu attribute
is therefore the original question.
I can also expand MenuItemAttribute
to take an array of two arrays or pairs, but then this syntax would be very complex. The final idea is that I can make stars a special format, but it will be messy for the IMHO.
OK, I got another idea. Let's order that John Skeet suggested use will allow it to specify the order of the final level of the hierarchy, not higher, not high. But I can modify this feature so that it is applicable not only to classes, but also for the assembly. In this case, the menu item will not have an affiliate form. At the assembly level, these characteristics can be used to specify the order between high levels of the hierarchy.
This is then a control between a centralized and decentralized menu system. Any idea why this would be a bad idea?
I have an extra additional (optional) MenuItem attribute maker, which is "order" or "priority" [MenuItem ([0, "Company", "Customer", "Order")] [MenuItem (1, "Foo", "Bar", "Falcon")]
I'm not saying that it would be great, but it will effectively allow you to specify the order.
Comments
Post a Comment