0

On the msdn documentation of (CurrencyNegativePattern) I notice that each number represents a associated pattern string.

There's any way to get this associated pattern string passing the corresponding number?

e.g:

<someClass>.GetNegativeAssociatedPattern( 9 ) // returns "-$ n"
<someClass>.GetNegativeAssociatedPattern( 3 ) // returns "$n-"

Thanks.

Alexandre Perez
  • 3,355
  • 3
  • 21
  • 21

1 Answers1

1

Since the table seems to be fixed, you can simply define an array with the patterns in your code:

string[] patternStrings = { "($n)", "-$n", "$-n", "$n-", "(n$)", 
                            "-n$", "n-$", "n$-", "-n $", "-$ n",
                            "n $-", "$ n-", "$ -n", "n- $", "($ n)",
                            "(n $)" };    

int GetNegativeAssociatedPattern(int index)
{
    return patternStrings[index];
}
dtb
  • 213,145
  • 36
  • 401
  • 431