Clone() приватный Метод

private Clone ( ) : Object
Результат Object
Пример #1
0
        public virtual Object Clone()
        {
            CultureInfo ci = (CultureInfo)MemberwiseClone();

            ci._isReadOnly = false;

            //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 (!m_isInherited)
            {
                if (this.dateTimeInfo != null)
                {
                    ci.dateTimeInfo = (DateTimeFormatInfo)this.dateTimeInfo.Clone();
                }
                if (this.numInfo != null)
                {
                    ci.numInfo = (NumberFormatInfo)this.numInfo.Clone();
                }
            }
            else
            {
                ci.DateTimeFormat = (DateTimeFormatInfo)this.DateTimeFormat.Clone();
                ci.NumberFormat   = (NumberFormatInfo)this.NumberFormat.Clone();
            }

            if (_textInfo != null)
            {
                ci._textInfo = (TextInfo)_textInfo.Clone();
            }

            if (_calendar != null)
            {
                ci._calendar = (Calendar)_calendar.Clone();
            }

            return(ci);
        }
Пример #2
0
	public static Calendar ReadOnly (Calendar calendar)
	{
		if (calendar.m_isReadOnly)
			return calendar;
		Calendar c = (Calendar) calendar.Clone ();
		c.m_isReadOnly = true;
		return c;
	}
Пример #3
0
 public static void CloningTest(Calendar calendar, int yearHasLeapMonth, CalendarAlgorithmType algorithmType)
 {
     Calendar cloned = (Calendar) calendar.Clone();
     Assert.Equal(calendar.GetType(), cloned.GetType());
 }