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"; }
/// <include file='doc\CultureInfo.uex' path='docs/doc[@for="CultureInfo.Clone"]/*' /> public virtual Object Clone() { CultureInfo ci = (CultureInfo)MemberwiseClone(); //If this is exactly our type, we can make certain optimizations so that we don't allocate NumberFormatInfo or DTFI unless //they've already been allocated. If this is a derived type, we'll take a more generic codepath. if (ci.GetType() == typeof(CultureInfo)) { if (dateTimeInfo != null) { ci.dateTimeInfo = (DateTimeFormatInfo)dateTimeInfo.Clone(); } if (numInfo != null) { ci.numInfo = (NumberFormatInfo)numInfo.Clone(); } ci.m_isReadOnly = false; } else { ci.m_isReadOnly = false; ci.DateTimeFormat = (DateTimeFormatInfo)this.DateTimeFormat.Clone(); ci.NumberFormat = (NumberFormatInfo)this.NumberFormat.Clone(); } return(ci); }
public static NumberFormatInfo ReadOnly(NumberFormatInfo nfi) { NumberFormatInfo copy = (NumberFormatInfo)nfi.Clone(); copy.isReadOnly = true; return(copy); }
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); }
// 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); } }
// Implementation of the ICloneable interface. public virtual Object Clone() { #if !ECMA_COMPAT CultureInfo culture = (CultureInfo)(MemberwiseClone()); culture.readOnly = false; // clone DateTimeFormat and NumberFormat if available if (dateTimeFormat != null) { culture.dateTimeFormat = (DateTimeFormatInfo)dateTimeFormat.Clone(); } if (numberFormat != null) { culture.numberFormat = (NumberFormatInfo)numberFormat.Clone(); } return(culture); #else return(MemberwiseClone()); #endif }
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 = TextInfo.Invariant; m_name = String.Empty; englishname = nativename = "Invariant Language (Invariant Country)"; iso3lang = "IVL"; iso2lang = "iv"; win3lang = "IVL"; default_calendar_type = 1 << CalendarTypeBits | (int)GregorianCalendarTypes.Localized; }
private void ConstructInvariant() { m_lcid = InvariantCultureId; /* NumberFormatInfo defaults to the invariant data */ m_numInfo = NumberFormatInfo.InvariantInfo; /* DateTimeFormatInfo defaults to the invariant data */ m_dateTimeInfo = DateTimeFormatInfo.InvariantInfo; if (!m_isReadOnly) { m_numInfo = (NumberFormatInfo)m_numInfo.Clone(); m_dateTimeInfo = (DateTimeFormatInfo)m_dateTimeInfo.Clone(); } m_textInfo = new TextInfo(this, InvariantCultureId); m_name = ""; m_displayName = m_englishName = m_nativeName = "Invariant Language (Invariant Country)"; m_iso3lang = "IVL"; m_iso2lang = "iv"; m_icuName = "en_US_POSIX"; m_win3lang = "IVL"; }
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; }
public static NumberFormatInfo ReadOnly (NumberFormatInfo nfi) { NumberFormatInfo copy = (NumberFormatInfo)nfi.Clone(); copy.isReadOnly = true; return copy; }
// 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; } }
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"; }