Number of digits in each group to the left of the C # custom currency value decimal points

Source: Internet
Author: User

Currencygroupsizes Property

This property gets or sets the number of digits in each group to the left of the decimal points in the currency value.

The syntax format is:

public int[] CurrencyGroupSizes{get;set;}

L Property Value: The number of digits in each group to the left of the decimal points in the currency value. The default value is a one-dimensional array that contains only one element that is set to 3.

The main code is as follows.

private void button1_Click(objectsender,EventArgs e)
{
System.Globalization.NumberFormatInfo CN=new System.Globalization.CultureInfo("en-US",false).NumberFormat;
Int64 myInt=123456789012345;
int[] mySizes1={2,3,1};
int[] mySizes2={2,3,2};
CN.CurrencyGroupSizes=mySizes1;
MessageBox.Show("定义前:"+myInt.ToString("C")+"n"+"定义后:"+myInt.ToString("C",CN),"{2,3,1}格式");
CN.CurrencyGroupSizes=mySizes2;
MessageBox.Show("定义前:"+myInt.ToString("C")+"n"+"定义后:"+myInt.ToString("C",CN),"{2,3,2}格式");
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.