本文整理匯總了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;
}