Пример #1
0
 // ReSharper disable UnusedMember.Local
 private void AfterDeserilization()
 // ReSharper restore UnusedMember.Local
 {
     if (WeatherReading == null)
     {
         WeatherReading = new WeatherReading[0];
     }
 }
Пример #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (WeatherReading != null ? WeatherReading.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ RunTime.GetHashCode();
         hashCode = (hashCode * 397) ^ LastUpdated.GetHashCode();
         hashCode = (hashCode * 397) ^ (ETag != null ? ETag.GetHashCode() : 0);
         return(hashCode);
     }
 }
Пример #3
0
        /// <summary>
        /// Very fast way to sort a nearly sorted collection
        /// </summary>
        public static void EnusureSorted(this WeatherReading[] collection)
        {
            int n = collection.Length;

            for (int outer = 1; outer < n; outer++)
            {
                WeatherReading temp         = collection[outer];
                int            inner        = outer;
                bool           didSomeThing = false;
                while (inner > 0 && temp.CompareTo(collection[inner - 1]) < 0)
                {
                    didSomeThing      = true;
                    collection[inner] = collection[inner - 1];
                    inner            -= 1;
                }
                if (didSomeThing)
                {
                    collection[inner] = temp;
                }
            }
        }