protected BaseImmutablePerson(BaseImmutablePerson other) { var homeAddressCol = new List<ImmutableAddress>(); foreach (ImmutableAddress otherItem in other.HomeAddressCol) homeAddressCol.Add(otherItem == null ? null : new ImmutableAddress(otherItem)); HomeAddressCol = new ReadOnlyCollection<ImmutableAddress>(homeAddressCol); var workAddressCol = new List<ImmutableAddress>(); workAddressCol.AddRange(other.WorkAddressCol); WorkAddressCol = new ReadOnlyCollection<ImmutableAddress>(workAddressCol); var stringCol = new List<string>(); foreach (string otherItem in other.StringCol) stringCol.Add(otherItem == null ? null : string.Copy(otherItem)); StringCol = new ReadOnlyCollection<string>(stringCol); var stringCol2 = new List<string>(); stringCol2.AddRange(other.StringCol2); StringCol2 = new ReadOnlyCollection<string>(stringCol2); var doubleCol = new List<double>(); doubleCol.AddRange(other.DoubleCol); DoubleCol = new ReadOnlyCollection<double>(doubleCol); var doubleCol2 = new List<double>(); doubleCol2.AddRange(other.DoubleCol2); DoubleCol2 = new ReadOnlyCollection<double>(doubleCol2); if (other.HomeAddressProp == null) this.HomeAddressProp = null; else this.HomeAddressProp = new Address(other.HomeAddressProp); this.WorkAddressProp = other.WorkAddressProp; }
protected BaseImmutablePerson(BaseImmutablePerson other) { var homeAddressCol = new List <ImmutableAddress>(); foreach (ImmutableAddress otherItem in other.HomeAddressCol) { homeAddressCol.Add(otherItem == null ? null : new ImmutableAddress(otherItem)); } HomeAddressCol = new ReadOnlyCollection <ImmutableAddress>(homeAddressCol); var workAddressCol = new List <ImmutableAddress>(); workAddressCol.AddRange(other.WorkAddressCol); WorkAddressCol = new ReadOnlyCollection <ImmutableAddress>(workAddressCol); var stringCol = new List <string>(); foreach (string otherItem in other.StringCol) { stringCol.Add(otherItem == null ? null : string.Copy(otherItem)); } StringCol = new ReadOnlyCollection <string>(stringCol); var stringCol2 = new List <string>(); stringCol2.AddRange(other.StringCol2); StringCol2 = new ReadOnlyCollection <string>(stringCol2); var doubleCol = new List <double>(); doubleCol.AddRange(other.DoubleCol); DoubleCol = new ReadOnlyCollection <double>(doubleCol); var doubleCol2 = new List <double>(); doubleCol2.AddRange(other.DoubleCol2); DoubleCol2 = new ReadOnlyCollection <double>(doubleCol2); if (other.HomeAddressProp == null) { this.HomeAddressProp = null; } else { this.HomeAddressProp = new Address(other.HomeAddressProp); } this.WorkAddressProp = other.WorkAddressProp; }