FHRL

círculos V0.0.3(get,set)

Mar 7th, 2022 (edited)
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.95 KB | None | 0 0
  1. /*
  2.  * Created by SharpDevelop.
  3.  * User: Usuario
  4.  * Date: 28/02/2022
  5.  * Time: 08:25 p. m.
  6.  * Version: 0.0.3
  7.  * To change this template use Tools | Options | Coding | Edit Standard Headers.
  8.  */
  9. using System;
  10. using System.Drawing;
  11.  
  12. namespace Actividad_1
  13. {
  14.     /// <summary>
  15.     /// Description of circulos.
  16.     /// </summary>
  17.     public struct circulos : IEquatable<circulos>
  18.     {
  19.         //int member;
  20.         string identificador{ get; set; }// { get; set; }
  21.         Point centro{ get; set; }
  22.         int radio{ get; set; } // this is just an example member, replace it with your own struct members!
  23.        
  24.         #region Equals and GetHashCode implementation
  25.         // The code in this region is useful if you want to use this structure in collections.
  26.         // If you don't need it, you can just remove the region and the ": IEquatable<circulos>" declaration.
  27.         public circulos(Point centro,int radio):this(){
  28.             this.centro=new Point(centro.X,centro.Y);
  29.             this.radio=radio;
  30.         }
  31.         public override bool Equals(object obj)
  32.         {
  33.             if (obj is circulos)
  34.                 return Equals((circulos)obj); // use Equals method below
  35.             else
  36.                 return false;
  37.         }
  38.        
  39.         public bool EqualsWithoutIdentificador(circulos other)
  40.         {
  41.             // add comparisions for all members here
  42.            
  43.             return(this.centro.Equals(other.centro))
  44.                 &&(this.radio.Equals(other.radio));
  45.         }
  46.         public bool Equals(circulos other)
  47.         {
  48.             // add comparisions for all members here
  49.            
  50.             return(this.identificador.Equals(other.identificador))
  51.                 &&(this.EqualsWithoutIdentificador(other));
  52.         }
  53.        
  54.         public override int GetHashCode()
  55.         {
  56.             // combine the hash codes of all members here (e.g. with XOR operator ^)
  57.             return identificador.GetHashCode()^centro.GetHashCode()^radio.GetHashCode();
  58.         }
  59.        
  60.         public static bool operator ==(circulos left, circulos right)
  61.         {
  62.             return left.Equals(right);
  63.         }
  64.        
  65.         public static bool operator !=(circulos left, circulos right)
  66.         {
  67.             return !left.Equals(right);
  68.         }
  69.         #endregion
  70.     }
  71. }
Add Comment
Please, Sign In to add comment