Beispiel #1
0
 public override int GetHashCode()
 {
     //concat the strings and int ids into one string and get hashcode and xor
     //a multiserializableID with same IDs in different order will return not equal
     return((StringIDs == null ? 0 : StringIDs.Aggregate((i, j) => i + " " + j).GetHashCode()) ^
            (IntIDs == null ? 0 : IntIDs.Select(x => x.ToString()).Aggregate((i, j) => i + " " + j).GetHashCode()));
 }
Beispiel #2
0
 public MultipleSerializableId(IEnumerable <Element> elements)
 {
     foreach (Element element in elements)
     {
         StringIDs.Add(element.UniqueId);
         IDs.Add(element.Id.IntegerValue);
     }
 }
Beispiel #3
0
        public MultipleSerializableId(IEnumerable <Element> elements)
        {
            InitializeDataMembers();

            foreach (Element element in elements)
            {
                StringIDs.Add(element.UniqueId);
                IntIDs.Add(element.Id.IntegerValue);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Ctor used by the serialisation engine
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        public MultipleSerializableId(SerializationInfo info, StreamingContext context)
        {
            int numberOfElements = info.GetInt32("numberOfElements");

            for (int i = 0; i < numberOfElements; i++)
            {
                string stringID = (string)info.GetValue("stringID-" + i, typeof(string));
                int    intID    = (int)info.GetValue("intID-" + i, typeof(int));

                StringIDs.Add(stringID);
                IDs.Add(intID);
            }
        }