FHRL

círculos V0.0.2(funciones)

Mar 2nd, 2022 (edited)
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.91 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.2
  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; }
  21.         Point centro;
  22.         int radio; // 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))&&(this.radio.Equals(other.radio));
  44.         }
  45.         public bool Equals(circulos other)
  46.         {
  47.             // add comparisions for all members here
  48.            
  49.             return(this.identificador.Equals(other.identificador))
  50.                 &&(this.EqualsWithoutIdentificador(other));
  51.         }
  52.        
  53.         public override int GetHashCode()
  54.         {
  55.             // combine the hash codes of all members here (e.g. with XOR operator ^)
  56.             return identificador.GetHashCode()^centro.GetHashCode()^radio.GetHashCode();
  57.         }
  58.        
  59.         public static bool operator ==(circulos left, circulos right)
  60.         {
  61.             return left.Equals(right);
  62.         }
  63.        
  64.         public static bool operator !=(circulos left, circulos right)
  65.         {
  66.             return !left.Equals(right);
  67.         }
  68.         #endregion
  69.     }
  70. }
  71.  
Add Comment
Please, Sign In to add comment