public override bool Equals(Object obj) // <-- overrides Object.Equals { /** * You can use the AS operator to perform certain types of conversions * between compatible reference types or nullable types. * * Preferably, use IS for bool expressions: <expr> is <type>. * * IS checks if an object is compatible with a given type, or * (starting with C# 7.0) tests an expression against a pattern. * * Example: * if (obj is Person) { * // Do something if obj is a Person. * } */ var rect = obj as Rectangle; if (rect == null) { return(false); } return(TopLeft.Equals(rect.TopLeft) && // <-- uses Point.Equals and double.Equals Height.Equals(rect.Height) && Width.Equals(rect.Width)); }
public int CompareTo(object obj) { if (obj is Student) { var other_student = (Student)obj; //return StringComparer.OrdinalIgnoreCase.Compare(Name, other_student.Name); if (Height > other_student.Height) { return(+1); } else if (Height.Equals(other_student.Height)) { return(0); } else { return(-1); } } if (obj is null) { throw new ArgumentNullException(nameof(obj), "Попытка сравнения студента с пустотой"); } throw new ArgumentException("Попытка сравнения студента с " + obj.GetType().Name, nameof(obj)); }
/// <summary> /// Create a octree of type T. /// </summary> /// <param name="Voxel1">A voxel of type T.</param> /// <param name="Voxel2">A voxel of type T.</param> /// <param name="MaxNumberOfEmbeddedVoxels">The maximum number of embedded voxels before eight subtrees will be created.</param> public Octree(Voxel <T> Voxel1, Voxel <T> Voxel2, UInt32 MaxNumberOfEmbeddedVoxels = 256) : base(Voxel1, Voxel2) { if (Voxel1.Equals(Voxel2)) { throw new OT_ZeroDimensionException <T>(this, "Width == 0 && Height == 0 && Depth == 0!"); } if (Width.Equals(default(T))) { throw new OT_ZeroDimensionException <T>(this, "Width == 0!"); } if (Height.Equals(default(T))) { throw new OT_ZeroDimensionException <T>(this, "Height == 0!"); } if (Depth.Equals(default(T))) { throw new OT_ZeroDimensionException <T>(this, "Depth == 0!"); } this.MaxNumberOfEmbeddedVoxels = MaxNumberOfEmbeddedVoxels; this.EmbeddedVoxels = new HashedSet <IVoxel <T> >(); }
public Boolean Equals(Size3D size) { return(_hasValue == size._hasValue && Width.Equals(size.Width) && Height.Equals(size.Height) && Depth.Equals(size.Depth)); }
public bool Equals(Client other) { return(base.Equals(other) && ClientId.Equals(other.ClientId) && Height.Equals(other.Height) && Weight.Equals(other.Weight) && MbesAttemptCount.Equals(other.MbesAttemptCount) && MbesAllowAttempt == other.MbesAllowAttempt); }
public bool Equals(SwapchainDescription other) { return(Source.Equals(other.Source) && Width.Equals(other.Width) && Height.Equals(other.Height) && DepthFormat == other.DepthFormat && VSync.Equals(other.VSync) && ColorSrgb.Equals(other.ColorSrgb)); }
/// <summary> /// Begins the initialization of the dialog prior to display for the first time. /// </summary> protected virtual void BeginInit() { if (Height.Equals((Dim)0)) Height = 15; if (Width.Equals((Dim)0)) Width = Dim.Fill(20); foreach (var factory in ButtonFactories.Where(x => (x.Key & Buttons) == x.Key)) factory.Value(this); }
public int CompareTo(object other) { Person otherPerson = other as Person; if (Height.Equals(otherPerson.Height)) { return(Weight.CompareTo(otherPerson.Weight)); } return(Height.CompareTo(otherPerson.Height)); }
public bool allDistanceNotZero() { if (Height.Equals(0) || Width.Equals(0) || Depth.Equals(0)) { return(false); } else { return(true); } }
public bool Equals(Box box) { if (box == null) { return(false); } return(Name.Equals(box.Name) && Length.Equals(box.Length) && Width.Equals(box.Width) && Height.Equals(box.Height)); }
public bool Equals(Container container) { if (container == null) { return(false); } return(Name.Equals(container.Name) && Length.Equals(container.Length) && Width.Equals(container.Width) && Height.Equals(container.Height)); }
/// <summary> /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals(LatLng other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Equals(_datum, other._datum) && Latitude.Equals(other.Latitude) && Longitude.Equals(other.Longitude) && Height.Equals(other.Height)); }
//System.Windows.Forms.UserControl DoubleBuffered; /// <summary> /// This method sets the bounds for the map to appear in /// </summary> /// <param name="p">the xmlreader provided by Form1</param> /// <returns></returns> public RectangleF GetActualBounds(XmlReader p) { float a = Single.MaxValue; float b = Single.MaxValue; float c = Single.MinValue; float d = Single.MinValue; while (p.Read() && !p.Name.Equals("node")) { XmlNodeType t = p.NodeType; //while(!p.Name.Equals("node")) //{ if (p.NodeType.Equals(XmlNodeType.Element) && p.Name.Equals("bounds")) { while (p.MoveToNextAttribute()) { if (p.Name.Equals("minlat")) { c = Convert.ToSingle(p.Value); } if (p.Name.Equals("minlon")) { d = Convert.ToSingle(p.Value); } if (p.Name.Equals("maxlat")) { a = Convert.ToSingle(p.Value); } if (p.Name.Equals("maxlon")) { b = Convert.ToSingle(p.Value); } } //} } } float tempH = a - c; float tempW = b - d; Height.Equals(a); if (tempW > 0 && tempW <= _maximumWidth && tempH > 0 && tempH <= _maximumHeight) { return(_newRect = new RectangleF(d, c, tempW, tempH)); } else { throw new System.IO.IOException("Bounds in the correct range were not provided"); } }
public bool Equals(Patient other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(FirstName == other.FirstName && LastName == other.LastName && Id == other.Id && Gender == other.Gender && Age.Equals(other.Age) && Height.Equals(other.Height) && Weight.Equals(other.Weight) && ExamDate.EqualsUpToMilliseconds(other.ExamDate)); }
/// <summary> /// Create a quadtree of type T. /// </summary> /// <param name="Left">The left-coordinate.</param> /// <param name="Top">The top-coordinate.</param> /// <param name="Right">The right-coordinate.</param> /// <param name="Bottom">The bottom-coordinate.</param> /// <param name="MaxNumberOfEmbeddedPixels">The maximum number of embedded pixels before four subtrees will be created.</param> public Quadtree(T Left, T Top, T Right, T Bottom, UInt32 MaxNumberOfEmbeddedPixels = 256) : base(Left, Top, Right, Bottom) { if (Width.Equals(default(T))) { throw new QT_ZeroDimensionException <T>(this, "Width == 0!"); } if (Height.Equals(default(T))) { throw new QT_ZeroDimensionException <T>(this, "Height == 0!"); } this.MaxNumberOfEmbeddedPixels = MaxNumberOfEmbeddedPixels; this.EmbeddedPixels = new HashedSet <IPixel <T> >(); }
public bool Equals(Scope other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(string.Equals(Name, other.Name, StringComparison.InvariantCultureIgnoreCase) && ZeroDistance.Equals(other.ZeroDistance) && Height.Equals(other.Height) && ElevationClicksPerMOA.Equals(other.ElevationClicksPerMOA) && WindageClicksPerMOA.Equals(other.WindageClicksPerMOA)); }
public bool Equals(TextBufferGeometryParameters other) { if (other == null) { return(false); } else { return(BevelEnabled.Equals(other.BevelEnabled) && BevelSegments.Equals(other.BevelSegments) && BevelSize.Equals(other.BevelSize) && BevelThickness.Equals(other.BevelThickness) && CurveSegments.Equals(other.CurveSegments) && Font.Equals(other.Font) && Height.Equals(other.Height) && Size.Equals(other.Size)); } }
public bool Equals(IRectangle obj) { if (!(obj is Rectangle)) { return(false); } var rect = (Rectangle)obj; bool result = true; result &= _valid.Equals(rect._valid); result &= Left.Equals(rect.Left); result &= Top.Equals(rect.Top); result &= Width.Equals(rect.Width); result &= Height.Equals(rect.Height); return(result); }
private void EnsureValidSize(FrameworkElement adornedElement) { if (adornedElement.Width.Equals(Double.NaN)) { adornedElement.Width = Math.Max(adornedElement.DesiredSize.Width, _minWidth); // + _thickness.Left + _thickness.Right; } if (adornedElement.Height.Equals(Double.NaN)) { adornedElement.Height = Math.Max(adornedElement.DesiredSize.Height, _minHeight); // + _thickness.Top + _thickness.Bottom; } if (Width.Equals(Double.NaN)) { Width = adornedElement.Width; } if (Height.Equals(Double.NaN)) { Height = adornedElement.Height; } }
public override bool Equals(object obj) { if (obj == null) { return(false); } var view = obj as CentricView; if (view == null) { return(false); } return(Width.Equals(view.Width) && Height.Equals(view.Height) && x.Equals(view.x) && y.Equals(view.y) && zoom.Equals(view.zoom)); }
public bool Equals(DummyTestClass other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(string.Equals(FirstName, other.FirstName) && string.Equals(LastName, other.LastName) && Age == other.Age && Height.Equals(other.Height) && Worth.Equals(other.Worth) && Weight == other.Weight && DateOfBirth.TrimMilliseconds().Equals(other.DateOfBirth.TrimMilliseconds()) && Initial == other.Initial && Equals(Parents, other.Parents) && IdNumber.Equals(other.IdNumber)); }
/// <summary> /// Create a quadtree of type T. /// </summary> /// <param name="Pixel1">A pixel of type T.</param> /// <param name="Pixel2">A pixel of type T.</param> /// <param name="MaxNumberOfEmbeddedPixels">The maximum number of embedded pixels before four subtrees will be created.</param> public Quadtree(Pixel <T> Pixel1, Pixel <T> Pixel2, UInt32 MaxNumberOfEmbeddedPixels = 256) : base(Pixel1, Pixel2) { if (Pixel1.Equals(Pixel2)) { throw new QT_ZeroDimensionException <T>(this, "Width == 0 && Height == 0!"); } if (Width.Equals(default(T))) { throw new QT_ZeroDimensionException <T>(this, "Width == 0!"); } if (Height.Equals(default(T))) { throw new QT_ZeroDimensionException <T>(this, "Height == 0!"); } this.MaxNumberOfEmbeddedPixels = MaxNumberOfEmbeddedPixels; this.EmbeddedPixels = new HashedSet <IPixel <T> >(); }
/// <summary> /// Create a octree of type T. /// </summary> /// <param name="Left">The left-coordinate.</param> /// <param name="Top">The top-coordinate.</param> /// <param name="Front">The front-coordinate.</param> /// <param name="Right">The right-coordinate.</param> /// <param name="Bottom">The bottom-coordinate.</param> /// <param name="Behind">The behind-coordinate.</param> /// <param name="MaxNumberOfEmbeddedVoxels">The maximum number of embedded voxels before eight subtrees will be created.</param> public Octree(T Left, T Top, T Front, T Right, T Bottom, T Behind, UInt32 MaxNumberOfEmbeddedVoxels = 256) : base(Left, Top, Front, Right, Bottom, Behind) { if (Width.Equals(default(T))) { throw new OT_ZeroDimensionException <T>(this, "Width == 0!"); } if (Height.Equals(default(T))) { throw new OT_ZeroDimensionException <T>(this, "Height == 0!"); } if (Depth.Equals(default(T))) { throw new OT_ZeroDimensionException <T>(this, "Depth == 0!"); } this.MaxNumberOfEmbeddedVoxels = MaxNumberOfEmbeddedVoxels; this.EmbeddedVoxels = new HashedSet <IVoxel <T> >(); }
/// <summary> /// Сравнение двух экземпляров класса /// </summary> /// <param name="other">Сравниваемый экземпляр <see cref="DbProduct"/></param> public bool Equals(DbProduct other) { if (other != null && Length.Equals(other.Length) && Width.Equals(other.Width) && Height.Equals(other.Height) && Diameter.Equals(other.Diameter) && Position == other.Position && SteelDoc.Equals(other.SteelDoc) && SteelType.Equals(other.SteelType) && ItemTypesEqual(ItemTypes, other.ItemTypes) && Mass.Equals(other.Mass) && CMass.Equals(other.CMass) && WMass.Equals(other.WMass) && SMass.Equals(other.SMass) && XmlDataEqual(Item, other.Item)) { return(true); } return(false); }
/// <summary> /// Сравнение двух экземпляров класса /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals(MpProduct other) { if (Length.Equals(other.Length) && Width.Equals(other.Width) && Height.Equals(other.Height) && Diameter.Equals(other.Diameter) && Position.Equals(other.Position) && SteelDoc.Equals(other.SteelDoc) && SteelType.Equals(other.SteelType) && ItemTypesEqual(ItemTypes, other.ItemTypes) && // ItemTypes.Equals(other.ItemTypes) && Mass.Equals(other.Mass) && CMass.Equals(other.CMass) && WMass.Equals(other.WMass) && SMass.Equals(other.SMass)) { return(true); } return(false); }
public override bool Equals(object obj) { // If parameter is null return false. if (obj == null) { return(false); } // If parameter cannot be cast to Rectangle return false. Rectangle o = obj as Rectangle; if ((System.Object)o == null) { return(false); } // Return true if the fields match: return(Location.Equals(o.Location) && Width.Equals(o.Width) && Height.Equals(o.Height) && StrokeThickness.Equals(o.StrokeThickness) && Fill.Equals(o.Fill)); }
/// <inheritdoc /> public bool Equals([AllowNull] Cells other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Equals(Values, other.Values) || Values != null && other.Values != null && Values.SequenceEqual(other.Values) ) && ( Equals(Format, other.Format) || Format != null && other.Format != null && Format.SequenceEqual(other.Format) ) && ( Prefix == other.Prefix || Prefix != null && Prefix.Equals(other.Prefix) ) && ( Equals(PrefixArray, other.PrefixArray) || PrefixArray != null && other.PrefixArray != null && PrefixArray.SequenceEqual(other.PrefixArray) ) && ( Suffix == other.Suffix || Suffix != null && Suffix.Equals(other.Suffix) ) && ( Equals(SuffixArray, other.SuffixArray) || SuffixArray != null && other.SuffixArray != null && SuffixArray.SequenceEqual(other.SuffixArray) ) && ( Height == other.Height || Height != null && Height.Equals(other.Height) ) && ( Align == other.Align || Align != null && Align.Equals(other.Align) ) && ( Equals(AlignArray, other.AlignArray) || AlignArray != null && other.AlignArray != null && AlignArray.SequenceEqual(other.AlignArray) ) && ( Line == other.Line || Line != null && Line.Equals(other.Line) ) && ( Fill == other.Fill || Fill != null && Fill.Equals(other.Fill) ) && ( Font == other.Font || Font != null && Font.Equals(other.Font) ) && ( ValuesSrc == other.ValuesSrc || ValuesSrc != null && ValuesSrc.Equals(other.ValuesSrc) ) && ( FormatSrc == other.FormatSrc || FormatSrc != null && FormatSrc.Equals(other.FormatSrc) ) && ( PrefixSrc == other.PrefixSrc || PrefixSrc != null && PrefixSrc.Equals(other.PrefixSrc) ) && ( SuffixSrc == other.SuffixSrc || SuffixSrc != null && SuffixSrc.Equals(other.SuffixSrc) ) && ( AlignSrc == other.AlignSrc || AlignSrc != null && AlignSrc.Equals(other.AlignSrc) )); }
/// <summary> /// Indicates whether this instance and a <see cref="Rect"/> object are equal. /// </summary> /// <param name="other">The <see cref="Rect"/> to compare with the current instance.</param> /// <returns> /// true if the object and this instance are of the same type and represent the same value, /// otherwise, false /// </returns> /// <since_tizen> preview </since_tizen> public bool Equals(Rect other) { return(X.Equals(other.X) && Y.Equals(other.Y) && Width.Equals(other.Width) && Height.Equals(other.Height)); }
public bool Equals(VideoFormatInfo other) => PixelFormat == other.PixelFormat && Width.Equals(other.Width) && Height.Equals(other.Height) && TimeBase.Equals(other.TimeBase) && AspectRatio.Equals(other.AspectRatio);
/// <summary> /// Compares element sizes. /// </summary> public override bool Equals(object obj) { var elementSizes = obj as VirtualItem; return((elementSizes != null) && Width.Equals(elementSizes.Width) && Height.Equals(elementSizes.Height) && Offset.Equals(elementSizes.Offset) && Alignment == elementSizes.Alignment); }