public static MultiValuedProperty <T> operator +(MultiValuedProperty <T> oldCollection, object newValue)
        {
            if (oldCollection.IsChangesOnlyCopy)
            {
                throw new InvalidOperationException(DataStrings.ErrorNotSupportedForChangesOnlyCopy);
            }
            object[] args = new object[]
            {
                oldCollection.IsReadOnly,
                oldCollection.PropertyDefinition,
                oldCollection
            };
            MultiValuedProperty <T> multiValuedProperty = (MultiValuedProperty <T>)Activator.CreateInstance(oldCollection.GetType(), BindingFlags.Instance | BindingFlags.NonPublic, null, args, null);

            multiValuedProperty.Add(newValue);
            return(multiValuedProperty);
        }
        internal static MbxPropertyDefinition ProxyAddressFromStringPropertyDefinition(string name, MbxPropertyDefinition rawPropertyDefinition, bool multivalued = false)
        {
            GetterDelegate getterDelegate = delegate(IPropertyBag propertyBag)
            {
                if (propertyBag[rawPropertyDefinition] != null)
                {
                    return(ProxyAddress.Parse((string)propertyBag[rawPropertyDefinition]));
                }
                return(null);
            };
            SetterDelegate setterDelegate = delegate(object value, IPropertyBag propertyBag)
            {
                propertyBag[rawPropertyDefinition] = ((ProxyAddress)value).ToString();
            };
            GetterDelegate getterDelegate2 = delegate(IPropertyBag propertyBag)
            {
                MultiValuedProperty <string>       multiValuedProperty  = (MultiValuedProperty <string>)propertyBag[rawPropertyDefinition];
                MultiValuedProperty <ProxyAddress> multiValuedProperty2 = new MultiValuedProperty <ProxyAddress>();
                foreach (string proxyAddressString in multiValuedProperty)
                {
                    multiValuedProperty2.Add(ProxyAddress.Parse(proxyAddressString));
                }
                return(multiValuedProperty2);
            };
            SetterDelegate setterDelegate2 = delegate(object value, IPropertyBag propertyBag)
            {
                MultiValuedProperty <ProxyAddress> multiValuedProperty  = (MultiValuedProperty <ProxyAddress>)value;
                MultiValuedProperty <string>       multiValuedProperty2 = (MultiValuedProperty <string>)propertyBag[rawPropertyDefinition];
                for (int i = multiValuedProperty2.Count - 1; i >= 0; i--)
                {
                    if (!string.IsNullOrEmpty(multiValuedProperty2[i]))
                    {
                        multiValuedProperty2.RemoveAt(i);
                    }
                }
                foreach (ProxyAddress proxyAddress in multiValuedProperty)
                {
                    multiValuedProperty2.Add(proxyAddress.ToString());
                }
            };

            return(new MbxPropertyDefinition(name, PropTag.Null, ExchangeObjectVersion.Exchange2003, typeof(ProxyAddress), (multivalued ? PropertyDefinitionFlags.MultiValued : PropertyDefinitionFlags.None) | PropertyDefinitionFlags.Calculated, multivalued ? null : null, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None, new MbxPropertyDefinition[]
            {
                rawPropertyDefinition
            }, multivalued ? getterDelegate2 : getterDelegate, multivalued ? setterDelegate2 : setterDelegate));
        }
        internal static MbxPropertyDefinition Int32FromNullableInt32PropertyDefinition(string name, MbxPropertyDefinition rawPropertyDefinition, bool multivalued = false)
        {
            GetterDelegate getterDelegate = (IPropertyBag propertyBag) => (propertyBag[rawPropertyDefinition] == null) ? 0 : ((int)propertyBag[rawPropertyDefinition]);
            SetterDelegate setterDelegate = delegate(object value, IPropertyBag propertyBag)
            {
                propertyBag[rawPropertyDefinition] = (((int?)value) ?? 0);
            };
            GetterDelegate getterDelegate2 = delegate(IPropertyBag propertyBag)
            {
                MultiValuedProperty <int> multiValuedProperty  = (MultiValuedProperty <int>)propertyBag[rawPropertyDefinition];
                MultiValuedProperty <int> multiValuedProperty2 = new MultiValuedProperty <int>();
                foreach (int value in multiValuedProperty)
                {
                    int?num = new int?(value);
                    if (num != null)
                    {
                        multiValuedProperty2.Add(num.Value);
                    }
                }
                return(multiValuedProperty2);
            };
            SetterDelegate setterDelegate2 = delegate(object value, IPropertyBag propertyBag)
            {
                MultiValuedProperty <int> multiValuedProperty  = (MultiValuedProperty <int>)value;
                MultiValuedProperty <int> multiValuedProperty2 = (MultiValuedProperty <int>)propertyBag[rawPropertyDefinition];
                for (int i = multiValuedProperty2.Count - 1; i >= 0; i--)
                {
                    multiValuedProperty2.RemoveAt(i);
                }
                foreach (int item in multiValuedProperty)
                {
                    multiValuedProperty2.Add(item);
                }
            };

            return(new MbxPropertyDefinition(name, PropTag.Null, ExchangeObjectVersion.Exchange2003, typeof(int), (multivalued ? PropertyDefinitionFlags.MultiValued : PropertyDefinitionFlags.None) | PropertyDefinitionFlags.Calculated, multivalued ? null : 0, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None, new MbxPropertyDefinition[]
            {
                rawPropertyDefinition
            }, multivalued ? getterDelegate2 : getterDelegate, multivalued ? setterDelegate2 : setterDelegate));
        }
        public static MultiValuedProperty <TransportQueueLog> Parse(string stringXml)
        {
            MultiValuedProperty <TransportQueueLog> queueLogs = new MultiValuedProperty <TransportQueueLog>();

            if (!string.IsNullOrWhiteSpace(stringXml))
            {
                using (XmlReader xmlReader = XmlReader.Create(new StringReader(stringXml), new XmlReaderSettings
                {
                    ConformanceLevel = ConformanceLevel.Fragment
                }))
                {
                    TransportQueueLogs transportQueueLogs = (TransportQueueLogs)TransportQueueLogs.Serializer.Deserialize(xmlReader);
                    if (transportQueueLogs != null && transportQueueLogs.Count > 0)
                    {
                        transportQueueLogs.ForEach(delegate(TransportQueueLog i)
                        {
                            queueLogs.Add(i);
                        });
                    }
                }
            }
            return(queueLogs);
        }