mercredi 6 mars 2019

Loop through public constants in a static class [duplicate]

This question already has an answer here:

This SO post talks about properties however I am trying to get at the constants in the following static class:

public static class SpYtMessageConstants
{
    public const int MSG_NOOP = 1;
    public const int MSG_PING = 2;
}

I want to loop through all the constants and get each value values. This is for a unit test to make sure nobody has added the same value twice.





Aucun commentaire:

Enregistrer un commentaire