|
| 1 | +// |
| 2 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 | +// |
| 4 | +// Microsoft Public License (MS-PL) |
| 5 | +// |
| 6 | +// This license governs use of the accompanying software. If you use the |
| 7 | +// software, you accept this license. If you do not accept the license, do not |
| 8 | +// use the software. |
| 9 | +// |
| 10 | +// 1. Definitions |
| 11 | +// |
| 12 | +// The terms "reproduce," "reproduction," "derivative works," and |
| 13 | +// "distribution" have the same meaning here as under U.S. copyright law. A |
| 14 | +// "contribution" is the original software, or any additions or changes to |
| 15 | +// the software. A "contributor" is any person that distributes its |
| 16 | +// contribution under this license. "Licensed patents" are a contributor's |
| 17 | +// patent claims that read directly on its contribution. |
| 18 | +// |
| 19 | +// 2. Grant of Rights |
| 20 | +// |
| 21 | +// (A) Copyright Grant- Subject to the terms of this license, including the |
| 22 | +// license conditions and limitations in section 3, each contributor |
| 23 | +// grants you a non-exclusive, worldwide, royalty-free copyright license |
| 24 | +// to reproduce its contribution, prepare derivative works of its |
| 25 | +// contribution, and distribute its contribution or any derivative works |
| 26 | +// that you create. |
| 27 | +// |
| 28 | +// (B) Patent Grant- Subject to the terms of this license, including the |
| 29 | +// license conditions and limitations in section 3, each contributor |
| 30 | +// grants you a non-exclusive, worldwide, royalty-free license under its |
| 31 | +// licensed patents to make, have made, use, sell, offer for sale, |
| 32 | +// import, and/or otherwise dispose of its contribution in the software |
| 33 | +// or derivative works of the contribution in the software. |
| 34 | +// |
| 35 | +// 3. Conditions and Limitations |
| 36 | +// |
| 37 | +// (A) No Trademark License- This license does not grant you rights to use |
| 38 | +// any contributors' name, logo, or trademarks. |
| 39 | +// |
| 40 | +// (B) If you bring a patent claim against any contributor over patents that |
| 41 | +// you claim are infringed by the software, your patent license from such |
| 42 | +// contributor to the software ends automatically. |
| 43 | +// |
| 44 | +// (C) If you distribute any portion of the software, you must retain all |
| 45 | +// copyright, patent, trademark, and attribution notices that are present |
| 46 | +// in the software. |
| 47 | +// |
| 48 | +// (D) If you distribute any portion of the software in source code form, you |
| 49 | +// may do so only under this license by including a complete copy of this |
| 50 | +// license with your distribution. If you distribute any portion of the |
| 51 | +// software in compiled or object code form, you may only do so under a |
| 52 | +// license that complies with this license. |
| 53 | +// |
| 54 | +// (E) The software is licensed "as-is." You bear the risk of using it. The |
| 55 | +// contributors give no express warranties, guarantees or conditions. You |
| 56 | +// may have additional consumer rights under your local laws which this |
| 57 | +// license cannot change. To the extent permitted under your local laws, |
| 58 | +// the contributors exclude the implied warranties of merchantability, |
| 59 | +// fitness for a particular purpose and non-infringement. |
| 60 | +// |
| 61 | + |
| 62 | +using System; |
| 63 | + |
| 64 | +namespace Microsoft.ClearScript |
| 65 | +{ |
| 66 | + /// <summary> |
| 67 | + /// Specifies that instances of the target struct are immutable. |
| 68 | + /// </summary> |
| 69 | + /// <remarks> |
| 70 | + /// When this attribute is applied to a struct, ClearScript exposes the same object reference |
| 71 | + /// for all instances of the struct that satisfy equality comparison, giving script code the |
| 72 | + /// ability to use native equality operators to compare the exposed objects. This behavior is |
| 73 | + /// also enabled automatically for all enums, numeric types, <see cref="DateTime"/>, |
| 74 | + /// <see cref="DateTimeOffset"/>, and <see cref="TimeSpan"/>. |
| 75 | + /// </remarks> |
| 76 | + [AttributeUsage(AttributeTargets.Struct)] |
| 77 | + public sealed class ImmutableValueAttribute : Attribute |
| 78 | + { |
| 79 | + // ReSharper disable EmptyConstructor |
| 80 | + |
| 81 | + /// <summary> |
| 82 | + /// Initializes a new <see cref="ImmutableValueAttribute"/> instance. |
| 83 | + /// </summary> |
| 84 | + public ImmutableValueAttribute() |
| 85 | + { |
| 86 | + // the help file builder (SHFB) insists on an empty constructor here |
| 87 | + } |
| 88 | + |
| 89 | + // ReSharper restore EmptyConstructor |
| 90 | + } |
| 91 | +} |
0 commit comments