| | | 1 | | //======================================================================= |
| | | 2 | | // MemoryPackOrderAttribute.cs |
| | | 3 | | //======================================================================= |
| | | 4 | | // MIT License, Copyright (c) 2024-present David Oravsky (mrdav30) |
| | | 5 | | // See LICENSE file in the project root for full license information. |
| | | 6 | | //======================================================================= |
| | | 7 | | |
| | | 8 | | using System; |
| | | 9 | | |
| | | 10 | | namespace MemoryPack; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Declares a member's MemoryPack-compatible order when the MemoryPack package is disabled. |
| | | 14 | | /// </summary> |
| | | 15 | | [AttributeUsage( |
| | | 16 | | AttributeTargets.Field | AttributeTargets.Property, |
| | | 17 | | AllowMultiple = false, |
| | | 18 | | Inherited = false)] |
| | | 19 | | public sealed class MemoryPackOrderAttribute : Attribute |
| | | 20 | | { |
| | | 21 | | /// <summary>Records the member's declared position.</summary> |
| | | 22 | | /// <param name="order">The order metadata to store as supplied.</param> |
| | 4 | 23 | | public MemoryPackOrderAttribute(int order) |
| | | 24 | | { |
| | 4 | 25 | | Order = order; |
| | 4 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary>Gets the member order metadata.</summary> |
| | | 29 | | /// <value>The integer passed to the attribute constructor.</value> |
| | | 30 | | public int Order { get; } |
| | | 31 | | } |