Alexandre Perez
Alexandre Perez

Reputation: 3495

Get Associated Pattern String from a CurrencyNegativePattern

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.

Upvotes: 0

Views: 105

Answers (1)

dtb
dtb

Reputation: 217351

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];
}

Upvotes: 1

Related Questions