Example #1
0
 /// <summary>
 /// Invoke Callback and set Value to Temp.
 /// </summary>
 public void SubmitTemp(VisualObject node, int player = -1)
 {
     if (!Temp.Equals(Value))
     {
         Callback?.Invoke(node, Temp, player);
         // Changing Value after callback so that now callback can access old Value
         Value = Temp;
     }
 }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Доска
            int a = 1;
            int b = a++;
            int c = ++a;
            int d = b++;

            this.listBox1.Items.Add($"Values: a={a}, b={b}, c={c}, d={d}");
            this.listBox1.Items.Add(string.Empty);

            //Телеграм
            Temp temp = new Temp("1", 0, "Один");

            temp.Count += 10;
            //
            Temp temp1 = new Temp("2", 0, "Два");
            //
            Temp2 tempV = temp;

            //
            //this.textBox1.Text = Temp.SetStatVar();
            //this.textBox1.Text = tempV.Method2();
            //this.textBox1.Text = tempV.Method1().ToString();
            //this.textBox1.Text = temp.Method1().ToString();
            //this.textBox1.Text = temp1.GetDate();
            //
            this.listBox1.Items.Add($"Object Equals = {temp.Equals(temp1)}");
            this.listBox1.Items.Add(string.Empty);
            //
            ((ITemp)temp).GetValues();
            this.listBox1.Items.Add($"1 Interface Method Result= {temp.Count}");
            this.listBox1.Items.Add(string.Empty);
            //
            ((ITemp2)temp).GetValues();
            this.listBox1.Items.Add($"2 Interface Method Result = {temp.Count}");
            this.listBox1.Items.Add(string.Empty);
            //
            try
            {
                MyException ex = new MyException("My exception!!!");
                throw ex;
            }
            catch (MyException ex)
            {
                this.listBox1.Items.Add($"Exception: {ex.Message}");
                this.listBox1.Items.Add(string.Empty);
            }
            this.listBox1.Items.Add($"Day (Number) = {(int)DayOfWeek.Friday}");
            this.listBox1.Items.Add(string.Empty);
            //
            this.listBox1.Items.Add($"Day (Name) = {DayOfWeek.Friday}");
            //this.textBox1.Text = DayOfWeek.Friday.ToString();
            this.listBox1.Items.Add(string.Empty);
        }
        public static void NewMethod2()
        {
            Temp templ = Temp.Value1;
            Temp temp2 = Temp.Value2;

            Console.WriteLine(templ == temp2);
            Console.WriteLine(templ.Equals(temp2));
            Console.WriteLine(templ.CompareTo(temp2));
            Console.WriteLine(templ == Temp.Value1);
            Console.WriteLine(templ == Temp.Value2);
        }
Example #4
0
        private static void NewMethod2()
        {
            Temp temp1 = Temp.Value1;
            Temp temp2 = Temp.Value2;

            Console.WriteLine(temp1 == temp2);
            Console.WriteLine(temp1.Equals(temp2));
            Console.WriteLine(temp1.CompareTo(temp2));
            Console.WriteLine(temp1 == Temp.Value1);
            Console.WriteLine(temp1 == Temp.Value2);
        }
Example #5
0
 public bool Equals(WeatherReading other)
 {
     return(ReadingTime.Equals(other.ReadingTime) && Temp.Equals(other.Temp));
 }
Example #6
0
 public bool Equals(Params other)
 {
     return(Region.Equals(other.Region) && Temp.Equals(other.Temp) && Pressure.Equals(other.Pressure) && CurrTime.Equals(other.CurrTime));
 }
Example #7
0
        /// <summary>
        /// Returns true if StreamSet instances are equal
        /// </summary>
        /// <param name="other">Instance of StreamSet to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(StreamSet other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Time == other.Time ||
                     Time != null &&
                     Time.Equals(other.Time)
                     ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     Latlng == other.Latlng ||
                     Latlng != null &&
                     Latlng.Equals(other.Latlng)
                 ) &&
                 (
                     Altitude == other.Altitude ||
                     Altitude != null &&
                     Altitude.Equals(other.Altitude)
                 ) &&
                 (
                     VelocitySmooth == other.VelocitySmooth ||
                     VelocitySmooth != null &&
                     VelocitySmooth.Equals(other.VelocitySmooth)
                 ) &&
                 (
                     Heartrate == other.Heartrate ||
                     Heartrate != null &&
                     Heartrate.Equals(other.Heartrate)
                 ) &&
                 (
                     Cadence == other.Cadence ||
                     Cadence != null &&
                     Cadence.Equals(other.Cadence)
                 ) &&
                 (
                     Watts == other.Watts ||
                     Watts != null &&
                     Watts.Equals(other.Watts)
                 ) &&
                 (
                     Temp == other.Temp ||
                     Temp != null &&
                     Temp.Equals(other.Temp)
                 ) &&
                 (
                     Moving == other.Moving ||
                     Moving != null &&
                     Moving.Equals(other.Moving)
                 ) &&
                 (
                     GradeSmooth == other.GradeSmooth ||
                     GradeSmooth != null &&
                     GradeSmooth.Equals(other.GradeSmooth)
                 ));
        }