public int Add(PlotCollectionSet set, bool bUniqueOnly = false, bool bCopyUserProperties = true) { if (!bUniqueOnly) { if (set.m_rgSet.Count == 0) { return(0); } m_rgSet.AddRange(set.m_rgSet); return(set.m_rgSet[0].Count); } int nCount = (m_rgSet.Count == 0) ? 0 : m_rgSet[0].Count; foreach (PlotCollection plots in set) { if (!m_rgSet.Contains(plots)) { m_rgSet.Add(plots); } } int nNewCount = m_rgSet[0].Count; if (bCopyUserProperties) { List <KeyValuePair <string, string> > rg = set.UserProperties.ToList(); foreach (KeyValuePair <string, string> kv in rg) { if (!UserProperties.ContainsKey(kv.Key)) { UserProperties.Add(kv.Key, kv.Value); } else { UserProperties[kv.Key] = kv.Value; } } } return(nNewCount - nCount); }
protected void OnDeserialized(StreamingContext context) { if ((Vertragsteile == null || Vertragsteile.Count == 0) && (UserProperties != null && UserProperties.ContainsKey("lokationsId"))) { Vertragsteile = new List <Vertragsteil>() { new Vertragsteil() { Vertragsteilbeginn = this.Vertragsbeginn, Vertragsteilende = this.Vertragsende, Lokation = UserProperties["lokationsId"].Value <string>() } }; } }