You can use reflection to get all the fields of a static class and then filter only the ones that are constants and have the type short. Here's some sample code:
main.cs715 chars28 linesIn this example code, MyStaticClass has two constant short variables FirstNumber and SecondNumber, and one readonly int variable. The Main method uses reflection to find the constant shorts and prints their values to the console.
The output of running this code would be:
main.cs4 chars3 lines
gistlibby LogSnag