/// <include file='doc\CultureInfo.uex' path='docs/doc[@for="CultureInfo.Clone"]/*' />
public virtual Object Clone()
{
CultureInfo ci = (CultureInfo)MemberwiseClone();
//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 (ci.GetType() == typeof(CultureInfo))
{
if (dateTimeInfo != null)
{
ci.dateTimeInfo = (DateTimeFormatInfo)dateTimeInfo.Clone();
}
if (numInfo != null)
{
ci.numInfo = (NumberFormatInfo)numInfo.Clone();
}
ci.m_isReadOnly = false;
}
else
{
ci.m_isReadOnly = false;
ci.DateTimeFormat = (DateTimeFormatInfo)this.DateTimeFormat.Clone();
ci.NumberFormat = (NumberFormatInfo)this.NumberFormat.Clone();
}
return(ci);
}