From 66ef0080bd1c01fba3bc07d8b8eadee2de242d3a Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 17 Aug 2024 00:20:53 +1000 Subject: [PATCH] * Marks members of Attachment as read-only * Implements IEquatable on Attachment --- LibreMetaverse/Avatar.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/LibreMetaverse/Avatar.cs b/LibreMetaverse/Avatar.cs index 9e821d0d..a7baf2a5 100644 --- a/LibreMetaverse/Avatar.cs +++ b/LibreMetaverse/Avatar.cs @@ -294,16 +294,26 @@ namespace OpenMetaverse /// /// See also: Primitive.ChildCount /// - public struct Attachment + public struct Attachment : IEquatable { /// /// The attachment point (see avatar_lad.xml for a list) /// - public byte AttachmentPoint; + public readonly byte AttachmentPoint; /// /// The UUID (global) of the attachment on this point. /// - public UUID AttachmentID; + public readonly UUID AttachmentID; + + /// + /// Determine if this is the same as another attachment object. + /// + /// Target for comparison + /// Are these attachments the same object? + public bool Equals(Attachment other) + { + return other.AttachmentPoint == AttachmentPoint && other.AttachmentID == AttachmentID; + } } #endregion Subclasses