We are using a custom API in our project which provide an attribute for class fields/members which lets the interface to present a popup of some range values like "On/OFF" and pass the corresponding values of the choice to our code. The attribute requires a string array to know that values.
We have many enumerations defined for these ranges,We are thinking to use Enum.GetValues() kind method to get a string array for this method.
However, As we know the field declaration do not allow dynamic values in the declaration? so is there any other of doing same thing in efficient way. To clerify the problem i will write the examples below;
Current Working
<RangeLookUp("On:1","Off:2")> Public ASimpleRangeVariable As Integer
While I wanted to do like this or kind of
<RangeLookUp(SomeMethod())> Public ASimpleRangeVariable As Integer
Public Shared Function SomeMethod() as String()
'use Enum to get all the items as string values forexample Enum.GetValues & enu,.GetValues
'Return array of string
End Function
Where SomeMethod suppose to return string array to be passed in the RangeLookup constructor.Which means if we change enumeration then we don't have to update the declaration
This question may be odd and i know there are better ways to do it but due to some custom API, the ground is limited.