| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. See License.txt in the project root for license information. |
| | 3 | |
|
| | 4 | | namespace Microsoft.Azure.Batch |
| | 5 | | { |
| | 6 | | internal interface IReadOnly |
| | 7 | | { |
| | 8 | | bool IsReadOnly { get; set; } |
| | 9 | | } |
| | 10 | |
|
| | 11 | | internal static class ReadOnlyExtensions |
| | 12 | | { |
| | 13 | | //TODO: It would be nice if semantically this didn't modify the initial object. Sadly I am |
| | 14 | | //TODO: not sure how we can easily accomplish that right now. |
| | 15 | | internal static T Freeze<T>(this T o) where T : IReadOnly |
| | 16 | | { |
| 97528 | 17 | | o.IsReadOnly = true; |
| 97528 | 18 | | return o; |
| | 19 | | } |
| | 20 | | } |
| | 21 | | } |