本文整理汇总了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);
}
示例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;
}
示例3: ReadOnly
public static NumberFormatInfo ReadOnly (NumberFormatInfo nfi)
{
NumberFormatInfo copy = (NumberFormatInfo)nfi.Clone();
copy.isReadOnly = true;
return copy;
}
示例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;
}
}
示例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";
}