當前位置: 首頁>>代碼示例>>C#>>正文


C# NumberFormatInfo.Clone方法代碼示例

本文整理匯總了C#中System.Globalization.NumberFormatInfo.Clone方法的典型用法代碼示例。如果您正苦於以下問題:C# NumberFormatInfo.Clone方法的具體用法?C# NumberFormatInfo.Clone怎麽用?C# NumberFormatInfo.Clone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Globalization.NumberFormatInfo的用法示例。


在下文中一共展示了NumberFormatInfo.Clone方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TestClone

 public void TestClone()
 {
     NumberFormatInfo nfi1 = new NumberFormatInfo();
     nfi1.CurrencyDecimalSeparator = "testStr";
     NumberFormatInfo nfi2 = (NumberFormatInfo)nfi1.Clone();
     Assert.NotEqual(nfi1.GetHashCode(), nfi2.GetHashCode());
     Assert.NotEqual(nfi1, nfi2);
     Assert.Equal(nfi1.CurrencyDecimalDigits, nfi2.CurrencyDecimalDigits);
     Assert.Equal(nfi1.CurrencyDecimalSeparator, nfi2.CurrencyDecimalSeparator);
     Assert.Equal(nfi1.CurrencyGroupSizes, nfi2.CurrencyGroupSizes);
     Assert.Equal(nfi1.CurrencyGroupSeparator, nfi2.CurrencyGroupSeparator);
     Assert.Equal(nfi1.CurrencyNegativePattern, nfi2.CurrencyNegativePattern);
     Assert.Equal(nfi1.CurrencyPositivePattern, nfi2.CurrencyPositivePattern);
     Assert.Equal(nfi1.IsReadOnly, nfi2.IsReadOnly);
 }
開發者ID:er0dr1guez,項目名稱:corefx,代碼行數:15,代碼來源:NumberFormatInfoClone.cs

示例2: ConstructInvariant

		private void ConstructInvariant (bool read_only)
		{
			cultureID = InvariantCultureId;

			/* NumberFormatInfo defaults to the invariant data */
			numInfo=NumberFormatInfo.InvariantInfo;

			if (!read_only) {
				numInfo = (NumberFormatInfo) numInfo.Clone ();
			}

			textInfo = CreateTextInfo (read_only);

			m_name=String.Empty;
			englishname=
			nativename="Invariant Language (Invariant Country)";
			iso3lang="IVL";
			iso2lang="iv";
			win3lang="IVL";
			default_calendar_type = 1 << CalendarTypeBits | (int) GregorianCalendarTypes.Localized;
		}
開發者ID:shana,項目名稱:mono,代碼行數:21,代碼來源:CultureInfo.cs

示例3: ReadOnly

		public static NumberFormatInfo ReadOnly (NumberFormatInfo nfi)
		{
			NumberFormatInfo copy = (NumberFormatInfo)nfi.Clone();
			copy.isReadOnly = true;
			return copy;
		}			
開發者ID:shana,項目名稱:mono,代碼行數:6,代碼來源:NumberFormatInfo.cs

示例4: ReadOnly

	// Convert a number format info object into a read-only version.
	public static NumberFormatInfo ReadOnly(NumberFormatInfo nfi)
			{
				if(nfi == null)
				{
					throw new ArgumentNullException("nfi");
				}
				else if(nfi.IsReadOnly)
				{
					return nfi;
				}
				else
				{
					NumberFormatInfo newNfi = (NumberFormatInfo)(nfi.Clone());
					newNfi.readOnly = true;
					return newNfi;
				}
			}
開發者ID:jjenki11,項目名稱:blaze-chem-rendering,代碼行數:18,代碼來源:NumberFormatInfo.cs

示例5: ConstructInvariant

		private void ConstructInvariant (bool read_only)
		{
			cultureID = InvariantCultureId;

			/* NumberFormatInfo defaults to the invariant data */
			numInfo=NumberFormatInfo.InvariantInfo;
			/* DateTimeFormatInfo defaults to the invariant data */
			dateTimeInfo=DateTimeFormatInfo.InvariantInfo;

			if (!read_only) {
				numInfo = (NumberFormatInfo) numInfo.Clone ();
				dateTimeInfo = (DateTimeFormatInfo) dateTimeInfo.Clone ();
			}

			textInfo = CreateTextInfo (read_only);

			m_name=String.Empty;
			displayname=
			englishname=
			nativename="Invariant Language (Invariant Country)";
			iso3lang="IVL";
			iso2lang="iv";
			icu_name="en_US_POSIX";
			win3lang="IVL";
		}
開發者ID:nestalk,項目名稱:mono,代碼行數:25,代碼來源:CultureInfo.cs


注:本文中的System.Globalization.NumberFormatInfo.Clone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。