Example #1
0
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>A new object that is a copy of this instance.</returns>
        public virtual object Clone()
        {
            BaseCalendar clone = (BaseCalendar)MemberwiseClone();

            if (GetBaseCalendar() != null)
            {
                clone.baseCalendar = (ICalendar)GetBaseCalendar().Clone();
            }
            return(clone);
        }
Example #2
0
        public void TestClone() {
            BaseCalendar baseCalendar = new BaseCalendar();
            baseCalendar.Description = "My description";
            baseCalendar.TimeZone = TimeZoneInfo.GetSystemTimeZones()[3];
            BaseCalendar clone = (BaseCalendar) baseCalendar.Clone();

            Assert.AreEqual(baseCalendar.Description, clone.Description);
            Assert.AreEqual(baseCalendar.GetBaseCalendar(), clone.GetBaseCalendar());
            Assert.AreEqual(baseCalendar.TimeZone, clone.TimeZone);
        }
 public UserDefinedCalendar()
 {
     Description = "User Defined Calendar";
     CalendarBase = new BaseCalendar();
 }