本文整理汇总了C#中System.Globalization.DateTimeFormatInfo.MemberwiseClone方法的典型用法代码示例。如果您正苦于以下问题:C# DateTimeFormatInfo.MemberwiseClone方法的具体用法?C# DateTimeFormatInfo.MemberwiseClone怎么用?C# DateTimeFormatInfo.MemberwiseClone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Globalization.DateTimeFormatInfo
的用法示例。
在下文中一共展示了DateTimeFormatInfo.MemberwiseClone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadOnly
/// <include file='doc\DateTimeFormatInfo.uex' path='docs/doc[@for="DateTimeFormatInfo.ReadOnly"]/*' />
public static DateTimeFormatInfo ReadOnly(DateTimeFormatInfo dtfi) {
if (dtfi == null) {
throw new ArgumentNullException("dtfi");
}
if (dtfi.IsReadOnly) {
return (dtfi);
}
DateTimeFormatInfo info = (DateTimeFormatInfo)(dtfi.MemberwiseClone());
info.m_isReadOnly = true;
return (info);
}
示例2: ReadOnly
public static DateTimeFormatInfo ReadOnly(DateTimeFormatInfo dtfi)
{
if (dtfi == null)
throw new ArgumentNullException("dtfi", Environment.GetResourceString("ArgumentNull_Obj"));
if (dtfi.IsReadOnly)
return dtfi;
DateTimeFormatInfo dateTimeFormatInfo = (DateTimeFormatInfo) dtfi.MemberwiseClone();
dateTimeFormatInfo.calendar = Calendar.ReadOnly(dtfi.Calendar);
dateTimeFormatInfo.m_isReadOnly = true;
return dateTimeFormatInfo;
}
示例3: ReadOnly
public static DateTimeFormatInfo ReadOnly(DateTimeFormatInfo dtfi) {
if (dtfi == null) {
throw new ArgumentNullException("dtfi",
Environment.GetResourceString("ArgumentNull_Obj"));
}
Contract.EndContractBlock();
if (dtfi.IsReadOnly) {
return (dtfi);
}
DateTimeFormatInfo newInfo = (DateTimeFormatInfo)(dtfi.MemberwiseClone());
// We can use the data member calendar in the setter, instead of the property Calendar,
// since the cloned copy should have the same state as the original copy.
newInfo.calendar = Calendar.ReadOnly(dtfi.Calendar);
newInfo.m_isReadOnly = true;
return (newInfo);
}
示例4: ReadOnly
public static DateTimeFormatInfo ReadOnly(DateTimeFormatInfo dtfi)
{
if (dtfi == null)
{
throw new ArgumentNullException("dtfi", Environment.GetResourceString("ArgumentNull_Obj"));
}
if (dtfi.IsReadOnly)
{
return dtfi;
}
DateTimeFormatInfo info = (DateTimeFormatInfo) dtfi.MemberwiseClone();
info.Calendar = System.Globalization.Calendar.ReadOnly(info.Calendar);
info.m_isReadOnly = true;
return info;
}