Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Created by SharpDevelop.
- * User: Usuario
- * Date: 28/02/2022
- * Time: 08:25 p. m.
- * Version: 0.0.4
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
- using System;
- using System.Drawing;
- namespace Actividad_1
- {
- /// <summary>
- /// Description of circulos.
- /// </summary>
- public struct circulos : IEquatable<circulos>
- {
- //int member;
- string identificador{ get; set; }// { get; set; }
- Point centro{ get; set; }
- int radio{ get; set; } // this is just an example member, replace it with your own struct members!
- #region Equals and GetHashCode implementation
- // The code in this region is useful if you want to use this structure in collections.
- // If you don't need it, you can just remove the region and the ": IEquatable<circulos>" declaration.
- public circulos(Point centro,int radio):this(){
- this.centro=new Point(centro.X,centro.Y);
- this.radio=radio;
- }
- public override bool Equals(object obj)
- {
- if (obj is circulos)
- return Equals((circulos)obj); // use Equals method below
- else
- return false;
- }
- public bool EqualsWithoutIdentificadorWithMargin(circulos other,int margen)
- {
- // add comparisions for all members here
- return(this.centro.X <= other.centro.X+margen)&&(this.centro.X+margen <= other.centro.X)
- &&(this.centro.Y <= other.centro.Y+margen)&&(this.centro.Y+margen <= other.centro.Y)//.Equals(other.centro))
- &&(this.radio <= other.radio+margen)&&(this.radio+margen <= other.radio);
- }
- public bool EqualsWithoutIdentificador(circulos other)
- {
- // add comparisions for all members here
- return(this.centro.Equals(other.centro))
- &&(this.radio.Equals(other.radio));
- }
- public bool Equals(circulos other)
- {
- // add comparisions for all members here
- return(this.identificador.Equals(other.identificador))
- &&(this.EqualsWithoutIdentificador(other));
- }
- public override int GetHashCode()
- {
- // combine the hash codes of all members here (e.g. with XOR operator ^)
- return identificador.GetHashCode()^centro.GetHashCode()^radio.GetHashCode();
- }
- public static bool operator ==(circulos left, circulos right)
- {
- return left.Equals(right);
- }
- public static bool operator !=(circulos left, circulos right)
- {
- return !left.Equals(right);
- }
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement