From 9a167d8f38f1aca46cea2187d47620338502ea37 Mon Sep 17 00:00:00 2001 From: hrrrrustic Date: Mon, 12 Apr 2021 12:49:33 +0300 Subject: [PATCH] readonly annotation --- .../ref/System.Reflection.Metadata.cs | 38 +++++++++--------- .../Metadata/BlobBuilder.Enumerators.cs | 16 ++++---- .../Metadata/Ecma335/MetadataAggregator.cs | 4 +- .../Reflection/Metadata/Internal/BlobHeap.cs | 6 +-- .../Metadata/Internal/StringHeap.cs | 24 +++++------ .../Reflection/Metadata/Internal/Tables.cs | 40 +++++++++---------- .../Metadata/Internal/VirtualHeap.cs | 2 +- .../Metadata/Signatures/SignatureHeader.cs | 20 +++++----- .../TypeSystem/NamespaceDefinition.cs | 10 ++--- 9 files changed, 80 insertions(+), 80 deletions(-) diff --git a/src/libraries/System.Reflection.Metadata/ref/System.Reflection.Metadata.cs b/src/libraries/System.Reflection.Metadata/ref/System.Reflection.Metadata.cs index 40647b105f968..aa713287d60a9 100644 --- a/src/libraries/System.Reflection.Metadata/ref/System.Reflection.Metadata.cs +++ b/src/libraries/System.Reflection.Metadata/ref/System.Reflection.Metadata.cs @@ -272,13 +272,13 @@ public partial struct Blobs : System.Collections.Generic.IEnumerable System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + readonly System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + readonly System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } void System.IDisposable.Dispose() { } } } @@ -1996,11 +1996,11 @@ public partial struct NamespaceDefinition { private object _dummy; private int _dummyPrimitive; - public System.Collections.Immutable.ImmutableArray ExportedTypes { get { throw null; } } - public System.Reflection.Metadata.StringHandle Name { get { throw null; } } - public System.Collections.Immutable.ImmutableArray NamespaceDefinitions { get { throw null; } } - public System.Reflection.Metadata.NamespaceDefinitionHandle Parent { get { throw null; } } - public System.Collections.Immutable.ImmutableArray TypeDefinitions { get { throw null; } } + public readonly System.Collections.Immutable.ImmutableArray ExportedTypes { get { throw null; } } + public readonly System.Reflection.Metadata.StringHandle Name { get { throw null; } } + public readonly System.Collections.Immutable.ImmutableArray NamespaceDefinitions { get { throw null; } } + public readonly System.Reflection.Metadata.NamespaceDefinitionHandle Parent { get { throw null; } } + public readonly System.Collections.Immutable.ImmutableArray TypeDefinitions { get { throw null; } } } public readonly partial struct NamespaceDefinitionHandle : System.IEquatable { @@ -2241,16 +2241,16 @@ public partial struct SignatureHeader : System.IEquatable Current; - public BlobBuilder Current => _currentOpt!; + public readonly BlobBuilder Current => _currentOpt!; public bool MoveNext() { @@ -56,9 +56,9 @@ public void Reset() void IDisposable.Dispose() { } // IEnumerable: - public Chunks GetEnumerator() => this; - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + public readonly Chunks GetEnumerator() => this; + readonly IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + readonly IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } public struct Blobs : IEnumerable, IEnumerator, IEnumerator @@ -72,7 +72,7 @@ internal Blobs(BlobBuilder builder) object IEnumerator.Current => Current; - public Blob Current + public readonly Blob Current { get { @@ -94,9 +94,9 @@ public Blob Current void IDisposable.Dispose() { } // IEnumerable: - public Blobs GetEnumerator() => this; - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + public readonly Blobs GetEnumerator() => this; + readonly IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + readonly IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } } } diff --git a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataAggregator.cs b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataAggregator.cs index 23cc2ac2358c0..d62d2218045db 100644 --- a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataAggregator.cs +++ b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Ecma335/MetadataAggregator.cs @@ -21,12 +21,12 @@ internal struct RowCounts : IComparable public int AggregateInserts; public int Updates; - public int CompareTo(RowCounts other) + public readonly int CompareTo(RowCounts other) { return AggregateInserts - other.AggregateInserts; } - public override string ToString() + public override readonly string ToString() { return $"+0x{AggregateInserts:x} ~0x{Updates:x}"; } diff --git a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/BlobHeap.cs b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/BlobHeap.cs index 302a6167c5563..c4c920ed24005 100644 --- a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/BlobHeap.cs +++ b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/BlobHeap.cs @@ -85,7 +85,7 @@ internal BlobHeap(MemoryBlock block, MetadataKind metadataKind) } } - internal byte[] GetBytes(BlobHandle handle) + internal readonly byte[] GetBytes(BlobHandle handle) { if (handle.IsVirtual) { @@ -136,7 +136,7 @@ internal BlobReader GetBlobReader(BlobHandle handle) return new BlobReader(GetMemoryBlock(handle)); } - internal BlobHandle GetNextHandle(BlobHandle handle) + internal readonly BlobHandle GetNextHandle(BlobHandle handle) { if (handle.IsVirtual) { @@ -158,7 +158,7 @@ internal BlobHandle GetNextHandle(BlobHandle handle) return BlobHandle.FromOffset(nextIndex); } - internal byte[] GetVirtualBlobBytes(BlobHandle handle, bool unique) + internal readonly byte[] GetVirtualBlobBytes(BlobHandle handle, bool unique) { BlobHandle.VirtualIndex index = handle.GetVirtualIndex(); byte[] result = s_virtualValues![(int)index]; diff --git a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/StringHeap.cs b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/StringHeap.cs index ea0e38e3cde1f..7690921d82b7f 100644 --- a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/StringHeap.cs +++ b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/StringHeap.cs @@ -144,7 +144,7 @@ private static MemoryBlock TrimEnd(MemoryBlock block) return block.GetMemoryBlockAt(0, i + 2); } - internal string GetString(StringHandle handle, MetadataStringDecoder utf8Decoder) + internal readonly string GetString(StringHandle handle, MetadataStringDecoder utf8Decoder) { return handle.IsVirtual ? GetVirtualHandleString(handle, utf8Decoder) : GetNonVirtualString(handle, utf8Decoder, prefixOpt: null); } @@ -159,7 +159,7 @@ internal static string GetVirtualString(StringHandle.VirtualIndex index) return s_virtualValues![(int)index]; } - private string GetNonVirtualString(StringHandle handle, MetadataStringDecoder utf8Decoder, byte[]? prefixOpt) + private readonly string GetNonVirtualString(StringHandle handle, MetadataStringDecoder utf8Decoder, byte[]? prefixOpt) { Debug.Assert(handle.StringKind != StringKind.Virtual); @@ -168,7 +168,7 @@ private string GetNonVirtualString(StringHandle handle, MetadataStringDecoder ut return Block.PeekUtf8NullTerminated(handle.GetHeapOffset(), prefixOpt, utf8Decoder, out bytesRead, otherTerminator); } - private unsafe MemoryBlock GetNonVirtualStringMemoryBlock(StringHandle handle) + private unsafe readonly MemoryBlock GetNonVirtualStringMemoryBlock(StringHandle handle) { Debug.Assert(handle.StringKind != StringKind.Virtual); @@ -180,7 +180,7 @@ private unsafe MemoryBlock GetNonVirtualStringMemoryBlock(StringHandle handle) return new MemoryBlock(Block.Pointer + offset, length); } - private unsafe byte[] GetNonVirtualStringBytes(StringHandle handle, byte[] prefix) + private unsafe readonly byte[] GetNonVirtualStringBytes(StringHandle handle, byte[] prefix) { Debug.Assert(handle.StringKind != StringKind.Virtual); @@ -191,7 +191,7 @@ private unsafe byte[] GetNonVirtualStringBytes(StringHandle handle, byte[] prefi return bytes; } - private string GetVirtualHandleString(StringHandle handle, MetadataStringDecoder utf8Decoder) + private readonly string GetVirtualHandleString(StringHandle handle, MetadataStringDecoder utf8Decoder) { Debug.Assert(handle.IsVirtual); @@ -230,7 +230,7 @@ internal BlobReader GetBlobReader(StringHandle handle) return new BlobReader(GetMemoryBlock(handle)); } - internal StringHandle GetNextHandle(StringHandle handle) + internal readonly StringHandle GetNextHandle(StringHandle handle) { if (handle.IsVirtual) { @@ -246,7 +246,7 @@ internal StringHandle GetNextHandle(StringHandle handle) return StringHandle.FromOffset(terminator + 1); } - internal bool Equals(StringHandle handle, string value, MetadataStringDecoder utf8Decoder, bool ignoreCase) + internal readonly bool Equals(StringHandle handle, string value, MetadataStringDecoder utf8Decoder, bool ignoreCase) { Debug.Assert(value != null); @@ -265,7 +265,7 @@ internal bool Equals(StringHandle handle, string value, MetadataStringDecoder ut return this.Block.Utf8NullTerminatedEquals(handle.GetHeapOffset(), value, utf8Decoder, otherTerminator, ignoreCase); } - internal bool StartsWith(StringHandle handle, string value, MetadataStringDecoder utf8Decoder, bool ignoreCase) + internal readonly bool StartsWith(StringHandle handle, string value, MetadataStringDecoder utf8Decoder, bool ignoreCase) { Debug.Assert(value != null); @@ -287,7 +287,7 @@ internal bool StartsWith(StringHandle handle, string value, MetadataStringDecode /// /// Returns true if the given raw (non-virtual) handle represents the same string as given ASCII string. /// - internal bool EqualsRaw(StringHandle rawHandle, string asciiString) + internal readonly bool EqualsRaw(StringHandle rawHandle, string asciiString) { Debug.Assert(!rawHandle.IsVirtual); Debug.Assert(rawHandle.StringKind != StringKind.DotTerminated, "Not supported"); @@ -297,7 +297,7 @@ internal bool EqualsRaw(StringHandle rawHandle, string asciiString) /// /// Returns the heap index of the given ASCII character or -1 if not found prior null terminator or end of heap. /// - internal int IndexOfRaw(int startIndex, char asciiChar) + internal readonly int IndexOfRaw(int startIndex, char asciiChar) { Debug.Assert(asciiChar != 0 && asciiChar <= 0x7f); return this.Block.Utf8NullTerminatedOffsetOfAsciiChar(startIndex, asciiChar); @@ -306,7 +306,7 @@ internal int IndexOfRaw(int startIndex, char asciiChar) /// /// Returns true if the given raw (non-virtual) handle represents a string that starts with given ASCII prefix. /// - internal bool StartsWithRaw(StringHandle rawHandle, string asciiPrefix) + internal readonly bool StartsWithRaw(StringHandle rawHandle, string asciiPrefix) { Debug.Assert(!rawHandle.IsVirtual); Debug.Assert(rawHandle.StringKind != StringKind.DotTerminated, "Not supported"); @@ -316,7 +316,7 @@ internal bool StartsWithRaw(StringHandle rawHandle, string asciiPrefix) /// /// Equivalent to Array.BinarySearch, searches for given raw (non-virtual) handle in given array of ASCII strings. /// - internal int BinarySearchRaw(string[] asciiKeys, StringHandle rawHandle) + internal readonly int BinarySearchRaw(string[] asciiKeys, StringHandle rawHandle) { Debug.Assert(!rawHandle.IsVirtual); Debug.Assert(rawHandle.StringKind != StringKind.DotTerminated, "Not supported"); diff --git a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/Tables.cs b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/Tables.cs index 9cef4ec444960..2631a5c0e19ee 100644 --- a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/Tables.cs +++ b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/Tables.cs @@ -158,49 +158,49 @@ internal TypeDefTableReader( this.Block = containingBlock.GetMemoryBlockAt(containingBlockOffset, this.RowSize * numberOfRows); } - internal TypeAttributes GetFlags(TypeDefinitionHandle handle) + internal readonly TypeAttributes GetFlags(TypeDefinitionHandle handle) { int rowOffset = (handle.RowId - 1) * this.RowSize; return (TypeAttributes)this.Block.PeekUInt32(rowOffset + _FlagsOffset); } - internal NamespaceDefinitionHandle GetNamespaceDefinition(TypeDefinitionHandle handle) + internal readonly NamespaceDefinitionHandle GetNamespaceDefinition(TypeDefinitionHandle handle) { int rowOffset = (handle.RowId - 1) * this.RowSize; return NamespaceDefinitionHandle.FromFullNameOffset(this.Block.PeekHeapReference(rowOffset + _NamespaceOffset, _IsStringHeapRefSizeSmall)); } - internal StringHandle GetNamespace(TypeDefinitionHandle handle) + internal readonly StringHandle GetNamespace(TypeDefinitionHandle handle) { int rowOffset = (handle.RowId - 1) * this.RowSize; return StringHandle.FromOffset(this.Block.PeekHeapReference(rowOffset + _NamespaceOffset, _IsStringHeapRefSizeSmall)); } - internal StringHandle GetName(TypeDefinitionHandle handle) + internal readonly StringHandle GetName(TypeDefinitionHandle handle) { int rowOffset = (handle.RowId - 1) * this.RowSize; return StringHandle.FromOffset(this.Block.PeekHeapReference(rowOffset + _NameOffset, _IsStringHeapRefSizeSmall)); } - internal EntityHandle GetExtends(TypeDefinitionHandle handle) + internal readonly EntityHandle GetExtends(TypeDefinitionHandle handle) { int rowOffset = (handle.RowId - 1) * this.RowSize; return TypeDefOrRefTag.ConvertToHandle(this.Block.PeekTaggedReference(rowOffset + _ExtendsOffset, _IsTypeDefOrRefRefSizeSmall)); } - internal int GetFieldStart(int rowId) + internal readonly int GetFieldStart(int rowId) { int rowOffset = (rowId - 1) * this.RowSize; return this.Block.PeekReference(rowOffset + _FieldListOffset, _IsFieldRefSizeSmall); } - internal int GetMethodStart(int rowId) + internal readonly int GetMethodStart(int rowId) { int rowOffset = (rowId - 1) * this.RowSize; return this.Block.PeekReference(rowOffset + _MethodListOffset, _IsMethodRefSizeSmall); } - internal TypeDefinitionHandle FindTypeContainingMethod(int methodDefOrPtrRowId, int numberOfMethods) + internal readonly TypeDefinitionHandle FindTypeContainingMethod(int methodDefOrPtrRowId, int numberOfMethods) { int numOfRows = this.NumberOfRows; int slot = this.Block.BinarySearchForSlot(numOfRows, this.RowSize, _MethodListOffset, (uint)methodDefOrPtrRowId, _IsMethodRefSizeSmall); @@ -241,7 +241,7 @@ internal TypeDefinitionHandle FindTypeContainingMethod(int methodDefOrPtrRowId, return TypeDefinitionHandle.FromRowId(row); } - internal TypeDefinitionHandle FindTypeContainingField(int fieldDefOrPtrRowId, int numberOfFields) + internal readonly TypeDefinitionHandle FindTypeContainingField(int fieldDefOrPtrRowId, int numberOfFields) { int numOfRows = this.NumberOfRows; int slot = this.Block.BinarySearchForSlot(numOfRows, this.RowSize, _FieldListOffset, (uint)fieldDefOrPtrRowId, _IsFieldRefSizeSmall); @@ -655,19 +655,19 @@ int containingBlockOffset this.Block = containingBlock.GetMemoryBlockAt(containingBlockOffset, this.RowSize * numberOfRows); } - internal BlobHandle GetSignature(MemberReferenceHandle handle) + internal readonly BlobHandle GetSignature(MemberReferenceHandle handle) { int rowOffset = (handle.RowId - 1) * this.RowSize; return BlobHandle.FromOffset(this.Block.PeekHeapReference(rowOffset + _SignatureOffset, _IsBlobHeapRefSizeSmall)); } - internal StringHandle GetName(MemberReferenceHandle handle) + internal readonly StringHandle GetName(MemberReferenceHandle handle) { int rowOffset = (handle.RowId - 1) * this.RowSize; return StringHandle.FromOffset(this.Block.PeekHeapReference(rowOffset + _NameOffset, _IsStringHeapRefSizeSmall)); } - internal EntityHandle GetClass(MemberReferenceHandle handle) + internal readonly EntityHandle GetClass(MemberReferenceHandle handle) { int rowOffset = (handle.RowId - 1) * this.RowSize; return MemberRefParentTag.ConvertToHandle(this.Block.PeekTaggedReference(rowOffset + _ClassOffset, _IsMemberRefParentRefSizeSmall)); @@ -1036,26 +1036,26 @@ internal ClassLayoutTableReader( } } - internal TypeDefinitionHandle GetParent(int rowId) + internal readonly TypeDefinitionHandle GetParent(int rowId) { int rowOffset = (rowId - 1) * this.RowSize; return TypeDefinitionHandle.FromRowId(this.Block.PeekReference(rowOffset + _ParentOffset, _IsTypeDefTableRowRefSizeSmall)); } - internal ushort GetPackingSize(int rowId) + internal readonly ushort GetPackingSize(int rowId) { int rowOffset = (rowId - 1) * this.RowSize; return this.Block.PeekUInt16(rowOffset + _PackagingSizeOffset); } - internal uint GetClassSize(int rowId) + internal readonly uint GetClassSize(int rowId) { int rowOffset = (rowId - 1) * this.RowSize; return this.Block.PeekUInt32(rowOffset + _ClassSizeOffset); } // Returns RowId (0 means we there is no record in this table corresponding to the specified type). - internal int FindRow(TypeDefinitionHandle typeDef) + internal readonly int FindRow(TypeDefinitionHandle typeDef) { return 1 + this.Block.BinarySearchReference( this.NumberOfRows, @@ -1065,7 +1065,7 @@ internal int FindRow(TypeDefinitionHandle typeDef) _IsTypeDefTableRowRefSizeSmall); } - private bool CheckSorted() + private readonly bool CheckSorted() { return this.Block.IsOrderedByReferenceAscending(this.RowSize, _ParentOffset, _IsTypeDefTableRowRefSizeSmall); } @@ -1271,19 +1271,19 @@ internal EventTableReader( this.Block = containingBlock.GetMemoryBlockAt(containingBlockOffset, this.RowSize * numberOfRows); } - internal EventAttributes GetFlags(EventDefinitionHandle handle) + internal readonly EventAttributes GetFlags(EventDefinitionHandle handle) { int rowOffset = (handle.RowId - 1) * this.RowSize; return (EventAttributes)this.Block.PeekUInt16(rowOffset + _FlagsOffset); } - internal StringHandle GetName(EventDefinitionHandle handle) + internal readonly StringHandle GetName(EventDefinitionHandle handle) { int rowOffset = (handle.RowId - 1) * this.RowSize; return StringHandle.FromOffset(this.Block.PeekHeapReference(rowOffset + _NameOffset, _IsStringHeapRefSizeSmall)); } - internal EntityHandle GetEventType(EventDefinitionHandle handle) + internal readonly EntityHandle GetEventType(EventDefinitionHandle handle) { int rowOffset = (handle.RowId - 1) * this.RowSize; return TypeDefOrRefTag.ConvertToHandle(this.Block.PeekTaggedReference(rowOffset + _EventTypeOffset, _IsTypeDefOrRefRefSizeSmall)); diff --git a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/VirtualHeap.cs b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/VirtualHeap.cs index 551ee9112c964..a6907cfad4394 100644 --- a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/VirtualHeap.cs +++ b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Internal/VirtualHeap.cs @@ -31,7 +31,7 @@ public PinnedBlob(GCHandle handle, int length) Length = length; } - public unsafe MemoryBlock GetMemoryBlock() => + public unsafe readonly MemoryBlock GetMemoryBlock() => new MemoryBlock((byte*)Handle.AddrOfPinnedObject(), Length); } diff --git a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Signatures/SignatureHeader.cs b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Signatures/SignatureHeader.cs index 0bc5b04252e2a..5fae2763261ed 100644 --- a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Signatures/SignatureHeader.cs +++ b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/Signatures/SignatureHeader.cs @@ -28,12 +28,12 @@ public SignatureHeader(SignatureKind kind, SignatureCallingConvention convention { } - public byte RawValue + public readonly byte RawValue { get { return _rawValue; } } - public SignatureCallingConvention CallingConvention + public readonly SignatureCallingConvention CallingConvention { get { @@ -49,7 +49,7 @@ public SignatureCallingConvention CallingConvention } } - public SignatureKind Kind + public readonly SignatureKind Kind { get { @@ -65,37 +65,37 @@ public SignatureKind Kind } } - public SignatureAttributes Attributes + public readonly SignatureAttributes Attributes { get { return (SignatureAttributes)(_rawValue & ~CallingConventionOrKindMask); } } - public bool HasExplicitThis + public readonly bool HasExplicitThis { get { return (_rawValue & (byte)SignatureAttributes.ExplicitThis) != 0; } } - public bool IsInstance + public readonly bool IsInstance { get { return (_rawValue & (byte)SignatureAttributes.Instance) != 0; } } - public bool IsGeneric + public readonly bool IsGeneric { get { return (_rawValue & (byte)SignatureAttributes.Generic) != 0; } } - public override bool Equals(object? obj) + public override readonly bool Equals(object? obj) { return obj is SignatureHeader && Equals((SignatureHeader)obj); } - public bool Equals(SignatureHeader other) + public readonly bool Equals(SignatureHeader other) { return _rawValue == other._rawValue; } - public override int GetHashCode() + public override readonly int GetHashCode() { return _rawValue; } diff --git a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/NamespaceDefinition.cs b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/NamespaceDefinition.cs index 34f7b98983e79..9e9ac0d2c2214 100644 --- a/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/NamespaceDefinition.cs +++ b/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/NamespaceDefinition.cs @@ -20,7 +20,7 @@ internal NamespaceDefinition(NamespaceData data) /// /// Gets the unqualified name of the NamespaceDefinition. /// - public StringHandle Name + public readonly StringHandle Name { get { return _data.Name; } } @@ -28,7 +28,7 @@ public StringHandle Name /// /// Gets the parent namespace. /// - public NamespaceDefinitionHandle Parent + public readonly NamespaceDefinitionHandle Parent { get { return _data.Parent; } } @@ -41,7 +41,7 @@ public NamespaceDefinitionHandle Parent /// System.Collections.Generic is a direct child of System.Collections. /// System.Collections.Generic is *not* a direct child of System. /// - public ImmutableArray NamespaceDefinitions + public readonly ImmutableArray NamespaceDefinitions { get { return _data.NamespaceDefinitions; } } @@ -49,7 +49,7 @@ public ImmutableArray NamespaceDefinitions /// /// Gets all type definitions that reside directly in a namespace. /// - public ImmutableArray TypeDefinitions + public readonly ImmutableArray TypeDefinitions { get { return _data.TypeDefinitions; } } @@ -57,7 +57,7 @@ public ImmutableArray TypeDefinitions /// /// Gets all exported types that reside directly in a namespace. /// - public ImmutableArray ExportedTypes + public readonly ImmutableArray ExportedTypes { get { return _data.ExportedTypes; } }