本文整理汇总了C#中DateTimeFormatInfo.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# DateTimeFormatInfo.Clone方法的具体用法?C# DateTimeFormatInfo.Clone怎么用?C# DateTimeFormatInfo.Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeFormatInfo
的用法示例。
在下文中一共展示了DateTimeFormatInfo.Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Clone
public void Clone(DateTimeFormatInfo format)
{
DateTimeFormatInfo clone = (DateTimeFormatInfo)format.Clone();
Assert.NotSame(format, clone);
Assert.False(clone.IsReadOnly);
Assert.Equal(format.AbbreviatedDayNames, clone.AbbreviatedDayNames);
Assert.Equal(format.AbbreviatedMonthGenitiveNames, clone.AbbreviatedMonthGenitiveNames);
Assert.Equal(format.AbbreviatedMonthNames, clone.AbbreviatedMonthNames);
Assert.Equal(format.DayNames, clone.DayNames);
Assert.Equal(format.MonthGenitiveNames, clone.MonthGenitiveNames);
Assert.Equal(format.MonthNames, clone.MonthNames);
Assert.Equal(format.ShortestDayNames, clone.ShortestDayNames);
Assert.Equal(format.AMDesignator, clone.AMDesignator);
Assert.Equal(format.FullDateTimePattern, clone.FullDateTimePattern);
Assert.Equal(format.LongDatePattern, clone.LongDatePattern);
Assert.Equal(format.LongTimePattern, clone.LongTimePattern);
Assert.Equal(format.MonthDayPattern, clone.MonthDayPattern);
Assert.Equal(format.PMDesignator, clone.PMDesignator);
Assert.Equal(format.RFC1123Pattern, clone.RFC1123Pattern);
Assert.Equal(format.ShortDatePattern, clone.ShortDatePattern);
Assert.Equal(format.ShortTimePattern, clone.ShortTimePattern);
Assert.Equal(format.SortableDateTimePattern, clone.SortableDateTimePattern);
Assert.Equal(format.UniversalSortableDateTimePattern, clone.UniversalSortableDateTimePattern);
Assert.Equal(format.YearMonthPattern, clone.YearMonthPattern);
Assert.Equal(format.CalendarWeekRule, clone.CalendarWeekRule);
Assert.Equal(format.FirstDayOfWeek, clone.FirstDayOfWeek);
}
示例2: PosTest1
public bool PosTest1()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest1: Call Clone method on a instance created from Ctor");
try
{
DateTimeFormatInfo expected = new DateTimeFormatInfo();
retVal = VerificationHelper(expected, expected.Clone(), "001.1") && retVal;
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("001.0", "Unexpected exception: " + e);
TestLibrary.TestFramework.LogInformation(e.StackTrace);
retVal = false;
}
return retVal;
}