<Compile Include="$(BclSourcesRoot)\System\Collections\Generic\Comparer.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Collections\Generic\ComparerHelpers.cs" />
<Compile Include="$(BclSourcesRoot)\System\Collections\Generic\EqualityComparer.CoreCLR.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Collections\ObjectModel\ReadOnlyDictionary.cs" />
<Compile Include="$(BclSourcesRoot)\System\Currency.cs" />
<Compile Include="$(BclSourcesRoot)\System\Delegate.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debugger.cs" />
namespace GenUnicodeProp
{
- internal class TableLevels
+ internal sealed class TableLevels
{
public readonly int Level1Bits;
public readonly int Level2Bits;
}
[ComVisible(true)]
- private class BasicClassFactory : IClassFactory
+ private sealed class BasicClassFactory : IClassFactory
{
#if FEATURE_COMINTEROP_UNMANAGED_ACTIVATION
private readonly Guid _classId;
}
[ComVisible(true)]
- private class LicenseClassFactory : IClassFactory2
+ private sealed class LicenseClassFactory : IClassFactory2
{
#if FEATURE_COMINTEROP_UNMANAGED_ACTIVATION
private readonly LicenseInteropProxy _licenseProxy = new LicenseInteropProxy();
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*============================================================
-**
-**
-**
-**
-** Purpose: Read-only wrapper for another generic dictionary.
-**
-===========================================================*/
-
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-using System.Threading;
-
-namespace System.Collections.ObjectModel
-{
- [DebuggerTypeProxy(typeof(IDictionaryDebugView<,>))]
- [DebuggerDisplay("Count = {Count}")]
- internal class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary, IReadOnlyDictionary<TKey, TValue> where TKey : notnull
- {
- private readonly IDictionary<TKey, TValue> m_dictionary;
- private object? m_syncRoot;
- private KeyCollection? m_keys;
- private ValueCollection? m_values;
-
- public ReadOnlyDictionary(IDictionary<TKey, TValue> dictionary)
- {
- if (dictionary == null)
- {
- throw new ArgumentNullException(nameof(dictionary));
- }
- m_dictionary = dictionary;
- }
-
- protected IDictionary<TKey, TValue> Dictionary => m_dictionary;
-
- public KeyCollection Keys => m_keys ??= new KeyCollection(m_dictionary.Keys);
-
- public ValueCollection Values => m_values ??= new ValueCollection(m_dictionary.Values);
-
- #region IDictionary<TKey, TValue> Members
-
- public bool ContainsKey(TKey key) => m_dictionary.ContainsKey(key);
-
- ICollection<TKey> IDictionary<TKey, TValue>.Keys => Keys;
-
- public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) =>
- m_dictionary.TryGetValue(key, out value);
-
- ICollection<TValue> IDictionary<TKey, TValue>.Values => Values;
-
- public TValue this[TKey key] => m_dictionary[key];
-
- void IDictionary<TKey, TValue>.Add(TKey key, TValue value) =>
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
-
- bool IDictionary<TKey, TValue>.Remove(TKey key)
- {
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
- return false;
- }
-
- TValue IDictionary<TKey, TValue>.this[TKey key]
- {
- get => m_dictionary[key];
- set => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
- }
-
- #endregion
-
- #region ICollection<KeyValuePair<TKey, TValue>> Members
-
- public int Count => m_dictionary.Count;
-
- bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> item) =>
- m_dictionary.Contains(item);
-
- void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex) =>
- m_dictionary.CopyTo(array, arrayIndex);
-
- bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly => true;
-
- void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item) =>
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
-
- void ICollection<KeyValuePair<TKey, TValue>>.Clear() =>
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
-
- bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
- {
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
- return false;
- }
-
- #endregion
-
- #region IEnumerable<KeyValuePair<TKey, TValue>> Members
-
- public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator() =>
- m_dictionary.GetEnumerator();
-
- #endregion
-
- #region IEnumerable Members
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() =>
- ((IEnumerable)m_dictionary).GetEnumerator();
-
- #endregion
-
- #region IDictionary Members
-
- private static bool IsCompatibleKey(object key)
- {
- if (key == null)
- {
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
- }
- return key is TKey;
- }
-
- void IDictionary.Add(object key, object? value) =>
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
-
- void IDictionary.Clear() =>
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
-
- bool IDictionary.Contains(object key) => IsCompatibleKey(key) && ContainsKey((TKey)key);
-
- IDictionaryEnumerator IDictionary.GetEnumerator()
- {
- if (m_dictionary is IDictionary d)
- {
- return d.GetEnumerator();
- }
- return new DictionaryEnumerator(m_dictionary);
- }
-
- bool IDictionary.IsFixedSize => true;
-
- bool IDictionary.IsReadOnly => true;
-
- ICollection IDictionary.Keys => Keys;
-
- void IDictionary.Remove(object key) =>
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
-
- ICollection IDictionary.Values => Values;
-
- object? IDictionary.this[object key]
- {
- get
- {
- if (IsCompatibleKey(key))
- {
- return this[(TKey)key];
- }
- return null;
- }
- set => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
- }
-
- void ICollection.CopyTo(Array array, int index)
- {
- if (array == null)
- {
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
- }
-
- if (array.Rank != 1)
- {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
- }
-
- if (array.GetLowerBound(0) != 0)
- {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
- }
-
- if (index < 0 || index > array.Length)
- {
- ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
- }
-
- if (array.Length - index < Count)
- {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
- }
-
- if (array is KeyValuePair<TKey, TValue>[] pairs)
- {
- m_dictionary.CopyTo(pairs, index);
- }
- else
- {
- if (array is DictionaryEntry[] dictEntryArray)
- {
- foreach (KeyValuePair<TKey, TValue> item in m_dictionary)
- {
- dictEntryArray[index++] = new DictionaryEntry(item.Key, item.Value);
- }
- }
- else
- {
- object[]? objects = array as object[];
- if (objects == null)
- {
- ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
- }
-
- try
- {
- foreach (KeyValuePair<TKey, TValue> item in m_dictionary)
- {
- objects[index++] = new KeyValuePair<TKey, TValue>(item.Key, item.Value);
- }
- }
- catch (ArrayTypeMismatchException)
- {
- ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
- }
- }
- }
- }
-
- bool ICollection.IsSynchronized => false;
-
- object ICollection.SyncRoot
- {
- get
- {
- if (m_syncRoot == null)
- {
- if (m_dictionary is ICollection c)
- {
- m_syncRoot = c.SyncRoot;
- }
- else
- {
- Interlocked.CompareExchange<object?>(ref m_syncRoot, new object(), null);
- }
- }
- return m_syncRoot;
- }
- }
-
- private struct DictionaryEnumerator : IDictionaryEnumerator
- {
- private readonly IDictionary<TKey, TValue> m_dictionary;
- private readonly IEnumerator<KeyValuePair<TKey, TValue>> m_enumerator;
-
- public DictionaryEnumerator(IDictionary<TKey, TValue> dictionary)
- {
- m_dictionary = dictionary;
- m_enumerator = m_dictionary.GetEnumerator();
- }
-
- public DictionaryEntry Entry => new DictionaryEntry(m_enumerator.Current.Key, m_enumerator.Current.Value);
-
- public object Key => m_enumerator.Current.Key!;
-
- public object? Value => m_enumerator.Current.Value;
-
- public object? Current => Entry;
-
- public bool MoveNext() => m_enumerator.MoveNext();
-
- public void Reset() => m_enumerator.Reset();
- }
-
- #endregion
-
- #region IReadOnlyDictionary members
-
- IEnumerable<TKey> IReadOnlyDictionary<TKey, TValue>.Keys => Keys;
-
- IEnumerable<TValue> IReadOnlyDictionary<TKey, TValue>.Values => Values;
-
- #endregion IReadOnlyDictionary members
-
- [DebuggerTypeProxy(typeof(ICollectionDebugView<>))]
- [DebuggerDisplay("Count = {Count}")]
- public sealed class KeyCollection : ICollection<TKey>, ICollection, IReadOnlyCollection<TKey>
- {
- private readonly ICollection<TKey> m_collection;
- private object? m_syncRoot;
-
- internal KeyCollection(ICollection<TKey> collection)
- {
- if (collection == null)
- {
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection);
- }
- m_collection = collection;
- }
-
- #region ICollection<T> Members
-
- void ICollection<TKey>.Add(TKey item) => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
-
- void ICollection<TKey>.Clear() => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
-
- bool ICollection<TKey>.Contains(TKey item) => m_collection.Contains(item);
-
- public void CopyTo(TKey[] array, int arrayIndex) => m_collection.CopyTo(array, arrayIndex);
-
- public int Count => m_collection.Count;
-
- bool ICollection<TKey>.IsReadOnly => true;
-
- bool ICollection<TKey>.Remove(TKey item)
- {
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
- return false;
- }
-
- #endregion
-
- #region IEnumerable<T> Members
-
- public IEnumerator<TKey> GetEnumerator() => m_collection.GetEnumerator();
-
- #endregion
-
- #region IEnumerable Members
-
- IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)m_collection).GetEnumerator();
-
- #endregion
-
- #region ICollection Members
-
- void ICollection.CopyTo(Array array, int index) => ReadOnlyDictionaryHelpers.CopyToNonGenericICollectionHelper<TKey>(m_collection, array, index);
-
- bool ICollection.IsSynchronized => false;
-
- object ICollection.SyncRoot
- {
- get
- {
- if (m_syncRoot == null)
- {
- if (m_collection is ICollection c)
- {
- m_syncRoot = c.SyncRoot;
- }
- else
- {
- Interlocked.CompareExchange<object?>(ref m_syncRoot, new object(), null);
- }
- }
- return m_syncRoot;
- }
- }
-
- #endregion
- }
-
- [DebuggerTypeProxy(typeof(ICollectionDebugView<>))]
- [DebuggerDisplay("Count = {Count}")]
- public sealed class ValueCollection : ICollection<TValue>, ICollection, IReadOnlyCollection<TValue>
- {
- private readonly ICollection<TValue> m_collection;
- private object? m_syncRoot;
-
- internal ValueCollection(ICollection<TValue> collection)
- {
- if (collection == null)
- {
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection);
- }
- m_collection = collection;
- }
-
- #region ICollection<T> Members
-
- void ICollection<TValue>.Add(TValue item) => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
-
- void ICollection<TValue>.Clear() => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
-
- bool ICollection<TValue>.Contains(TValue item) => m_collection.Contains(item);
-
- public void CopyTo(TValue[] array, int arrayIndex) => m_collection.CopyTo(array, arrayIndex);
-
- public int Count => m_collection.Count;
-
- bool ICollection<TValue>.IsReadOnly => true;
-
- bool ICollection<TValue>.Remove(TValue item)
- {
- ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
- return false;
- }
-
- #endregion
-
- #region IEnumerable<T> Members
-
- public IEnumerator<TValue> GetEnumerator() => m_collection.GetEnumerator();
-
- #endregion
-
- #region IEnumerable Members
-
- IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)m_collection).GetEnumerator();
-
- #endregion
-
- #region ICollection Members
-
- void ICollection.CopyTo(Array array, int index) => ReadOnlyDictionaryHelpers.CopyToNonGenericICollectionHelper<TValue>(m_collection, array, index);
-
- bool ICollection.IsSynchronized => false;
-
- object ICollection.SyncRoot
- {
- get
- {
- if (m_syncRoot == null)
- {
- if (m_collection is ICollection c)
- {
- m_syncRoot = c.SyncRoot;
- }
- else
- {
- Interlocked.CompareExchange<object?>(ref m_syncRoot, new object(), null);
- }
- }
- return m_syncRoot;
- }
- }
-
- #endregion ICollection Members
- }
- }
-
- // To share code when possible, use a non-generic class to get rid of irrelevant type parameters.
- internal static class ReadOnlyDictionaryHelpers
- {
- #region Helper method for our KeyCollection and ValueCollection
-
- // Abstracted away to avoid redundant implementations.
- internal static void CopyToNonGenericICollectionHelper<T>(ICollection<T> collection, Array array, int index)
- {
- if (array == null)
- {
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
- }
-
- if (array.Rank != 1)
- {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
- }
-
- if (array.GetLowerBound(0) != 0)
- {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
- }
-
- if (index < 0)
- {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.arrayIndex, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
- }
-
- if (array.Length - index < collection.Count)
- {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
- }
-
- // Easy out if the ICollection<T> implements the non-generic ICollection
- if (collection is ICollection nonGenericCollection)
- {
- nonGenericCollection.CopyTo(array, index);
- return;
- }
-
- if (array is T[] items)
- {
- collection.CopyTo(items, index);
- }
- else
- {
- //
- // Catch the obvious case assignment will fail.
- // We can found all possible problems by doing the check though.
- // For example, if the element type of the Array is derived from T,
- // we can't figure out if we can successfully copy the element beforehand.
- //
- Type targetType = array.GetType().GetElementType()!;
- Type sourceType = typeof(T);
- if (!(targetType.IsAssignableFrom(sourceType) || sourceType.IsAssignableFrom(targetType)))
- {
- ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
- }
-
- //
- // We can't cast array of value type to object[], so we don't support
- // widening of primitive types here.
- //
- object?[]? objects = array as object[];
- if (objects == null)
- {
- ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
- }
-
- try
- {
- foreach (T item in collection)
- {
- objects[index++] = item;
- }
- }
- catch (ArrayTypeMismatchException)
- {
- ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType();
- }
- }
- }
-
- #endregion Helper method for our KeyCollection and ValueCollection
- }
-}
// This class implements code:ICustomDebuggerNotification and provides a type to be used to notify
// the debugger that execution is about to enter a path that involves a cross-thread dependency.
// See code:NotifyOfCrossThreadDependency for more details.
- private class CrossThreadDependencyNotification : ICustomDebuggerNotification { }
+ private sealed class CrossThreadDependencyNotification : ICustomDebuggerNotification { }
// Do not inline the slow path
[MethodImpl(MethodImplOptions.NoInlining)]
// Modifying the order or fields of this object may require other changes
// to the unmanaged definition of the StackFrameHelper class, in
// VM\DebugDebugger.h. The binder will catch some of these layout problems.
- internal class StackFrameHelper
+ internal sealed class StackFrameHelper
{
private Thread? targetThread;
private int[]? rgiOffset;
}
}
- public virtual MethodBase? GetMethodBase(int i)
+ public MethodBase? GetMethodBase(int i)
{
// There may be a better way to do this.
// we got RuntimeMethodHandles here and we need to go to MethodBase
return RuntimeType.GetMethodBase(mhReal);
}
- public virtual int GetOffset(int i) { return rgiOffset![i]; }
- public virtual int GetILOffset(int i) { return rgiILOffset![i]; }
- public virtual string? GetFilename(int i) { return rgFilename?[i]; }
- public virtual int GetLineNumber(int i) { return rgiLineNumber == null ? 0 : rgiLineNumber[i]; }
- public virtual int GetColumnNumber(int i) { return rgiColumnNumber == null ? 0 : rgiColumnNumber[i]; }
+ public int GetOffset(int i) { return rgiOffset![i]; }
+ public int GetILOffset(int i) { return rgiILOffset![i]; }
+ public string? GetFilename(int i) { return rgFilename?[i]; }
+ public int GetLineNumber(int i) { return rgiLineNumber == null ? 0 : rgiLineNumber[i]; }
+ public int GetColumnNumber(int i) { return rgiColumnNumber == null ? 0 : rgiColumnNumber[i]; }
- public virtual bool IsLastFrameFromForeignExceptionStackTrace(int i)
+ public bool IsLastFrameFromForeignExceptionStackTrace(int i)
{
return (rgiLastFrameFromForeignExceptionStackTrace == null) ? false : rgiLastFrameFromForeignExceptionStackTrace[i];
}
- public virtual int GetNumberOfFrames() { return iFrameCount; }
+ public int GetNumberOfFrames() { return iFrameCount; }
}
}
namespace System
{
// Made serializable in anticipation of this class eventually having state.
- internal class OleAutBinder : DefaultBinder
+ internal sealed class OleAutBinder : DefaultBinder
{
// ChangeType
// This binder uses OLEAUT to change the type of the variant.
/// data member for AssemblyBuilder. Note that what ever data members added to
/// this class cannot be accessed from the EE.
/// </summary>
- internal class AssemblyBuilderData
+ internal sealed class AssemblyBuilderData
{
public const int AssemblyDefToken = 0x20000001;
namespace System.Reflection.Emit
{
- internal class DynamicILGenerator : ILGenerator
+ internal sealed class DynamicILGenerator : ILGenerator
{
internal DynamicScope m_scope;
private int m_methodSigToken;
}
- internal class DynamicResolver : Resolver
+ internal sealed class DynamicResolver : Resolver
{
#region Private Data Members
private __ExceptionInfo[]? m_exceptions;
scout.m_methodHandle = method.m_methodHandle.Value;
}
- private class DestroyScout
+ private sealed class DestroyScout
{
internal RuntimeMethodHandleInternal m_methodHandle;
#endregion
}
- internal class DynamicScope
+ internal sealed class DynamicScope
{
#region Private Data Members
internal readonly List<object?> m_tokens = new List<object?> { null };
// SymWrapperCore is never instantiated and is used as an encapsulation class.
// It is our "ISymWrapper.dll" assembly within an assembly.
//------------------------------------------------------------------------------
- internal class SymWrapperCore
+ internal sealed class SymWrapperCore
{
//------------------------------------------------------------------------------
// Block instantiation
#endregion
}
- internal class LocalSymInfo
+ internal sealed class LocalSymInfo
{
// This class tracks the local variable's debugging information
// and namespace information with a given active lexical scope.
checked { m_iNameSpaceCount++; }
}
- internal virtual void EmitLocalSymInfo(ISymbolWriter symWriter)
+ internal void EmitLocalSymInfo(ISymbolWriter symWriter)
{
int i;
// This is a package private class. This class hold all of the managed
// data member for ModuleBuilder. Note that what ever data members added to
// this class cannot be accessed from the EE.
- internal class ModuleBuilderData
+ internal sealed class ModuleBuilderData
{
public const string MultiByteValueClass = "$ArrayType$";
}
#region Declarations
- private class CustAttr
+ private sealed class CustAttr
{
private readonly ConstructorInfo? m_con;
private readonly byte[]? m_binaryAttribute;
#endregion
}
- internal class MetadataException : Exception
+ internal sealed class MetadataException : Exception
{
private int m_hr;
internal MetadataException(int hr) { m_hr = hr; }
/// data.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
- internal class LAHashDependentHashTracker
+ internal sealed class LAHashDependentHashTracker
{
private GCHandle _dependentHandle;
private IntPtr _loaderAllocator;
/// to LAHashDependentHashTracker's
/// </summary>
[StructLayout(LayoutKind.Sequential)]
- internal class LAHashKeyToTrackers
+ internal sealed class LAHashKeyToTrackers
{
private object? _trackerOrTrackerSet;
private object? _laLocalKeyValueStore;
/// by C++ runtime code which manages its memory in the GC heap.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
- internal class GCHeapHash
+ internal sealed class GCHeapHash
{
private Array? _data;
private int _count;
}
// Helper class to assist with unsafe pinning of arbitrary objects.
// It's used by VM code.
- internal class RawData
+ internal sealed class RawData
{
public byte Data;
}
// The BaseSize of an array includes all the fields before the array data,
// including the sync block and method table. The reference to RawData.Data
// points at the number of components, skipping over these two pointer-sized fields.
- internal class RawArrayData
+ internal sealed class RawArrayData
{
public uint Length; // Array._numComponents padded to IntPtr
#if TARGET_64BIT
namespace System.Runtime.InteropServices
{
[SupportedOSPlatform("windows")]
- internal class ComEventsInfo
+ internal sealed class ComEventsInfo
{
private ComEventsSink? _sinks;
private readonly object _rcw;
namespace System.Runtime.InteropServices.CustomMarshalers
{
- internal class EnumVariantViewOfEnumerator : ComTypes.IEnumVARIANT, ICustomAdapter
+ internal sealed class EnumVariantViewOfEnumerator : ComTypes.IEnumVARIANT, ICustomAdapter
{
public EnumVariantViewOfEnumerator(IEnumerator enumerator)
{
namespace System.Runtime.InteropServices.CustomMarshalers
{
[SupportedOSPlatform("windows")]
- internal class EnumerableToDispatchMarshaler : ICustomMarshaler
+ internal sealed class EnumerableToDispatchMarshaler : ICustomMarshaler
{
private static readonly EnumerableToDispatchMarshaler s_enumerableToDispatchMarshaler = new EnumerableToDispatchMarshaler();
namespace System.Runtime.InteropServices.CustomMarshalers
{
- internal class EnumerableViewOfDispatch : ICustomAdapter, System.Collections.IEnumerable
+ internal sealed class EnumerableViewOfDispatch : ICustomAdapter, System.Collections.IEnumerable
{
// Reserved DISPID slot for getting an enumerator from an IDispatch-implementing COM interface.
private const int DISPID_NEWENUM = -4;
namespace System.Runtime.InteropServices.CustomMarshalers
{
[SupportedOSPlatform("windows")]
- internal class EnumeratorToEnumVariantMarshaler : ICustomMarshaler
+ internal sealed class EnumeratorToEnumVariantMarshaler : ICustomMarshaler
{
private static readonly EnumeratorToEnumVariantMarshaler s_enumeratorToEnumVariantMarshaler = new EnumeratorToEnumVariantMarshaler();
namespace System.Runtime.InteropServices.CustomMarshalers
{
- internal class EnumeratorViewOfEnumVariant : ICustomAdapter, System.Collections.IEnumerator
+ internal sealed class EnumeratorViewOfEnumVariant : ICustomAdapter, System.Collections.IEnumerator
{
private readonly IEnumVARIANT _enumVariantObject;
private bool _fetchedLastObject;
namespace System.Runtime.InteropServices.CustomMarshalers
{
- internal class ExpandoToDispatchExMarshaler : ICustomMarshaler
+ internal sealed class ExpandoToDispatchExMarshaler : ICustomMarshaler
{
private static readonly ExpandoToDispatchExMarshaler s_ExpandoToDispatchExMarshaler = new ExpandoToDispatchExMarshaler();
namespace System.Runtime.InteropServices.CustomMarshalers
{
- internal class TypeToTypeInfoMarshaler : ICustomMarshaler
+ internal sealed class TypeToTypeInfoMarshaler : ICustomMarshaler
{
private static readonly TypeToTypeInfoMarshaler s_typeToTypeInfoMarshaler = new TypeToTypeInfoMarshaler();
internal IntPtr m_handle;
}
- internal class RuntimeMethodInfoStub : IRuntimeMethodInfo
+ internal sealed class RuntimeMethodInfoStub : IRuntimeMethodInfo
{
public RuntimeMethodInfoStub(RuntimeMethodHandleInternal methodHandleValue, object keepalive)
{
}
[StructLayout(LayoutKind.Sequential)]
- internal class RuntimeFieldInfoStub : IRuntimeFieldInfo
+ internal sealed class RuntimeFieldInfoStub : IRuntimeFieldInfo
{
// These unused variables are used to ensure that this class has the same layout as RuntimeFieldInfo
#pragma warning disable 414, 169
}
}
- internal class RuntimeTypeCache
+ internal sealed class RuntimeTypeCache
{
private const int MAXNAMELEN = 1024;
}
}
- private class MemberInfoCache<T> where T : MemberInfo
+ private sealed class MemberInfoCache<T> where T : MemberInfo
{
#region Private Data Members
// reliable in the presence of asynchronous exceptions.
internal struct CerHashtable<K, V> where K : class
{
- private class Table
+ private sealed class Table
{
// Note that m_keys and m_values arrays are immutable to allow lock-free reads. A new instance
// of CerHashtable has to be allocated to grow the size of the hashtable.
/// Part of ComEventHelpers APIs which allow binding
/// managed delegates to COM's connection point based events.
/// </summary>
- internal class ComEventsMethod
+ internal sealed class ComEventsMethod
{
/// <summary>
/// This delegate wrapper class handles dynamic invocation of delegates. The reason for the wrapper's
{
public partial class EventSourceGenerator
{
- private class Emitter
+ private sealed class Emitter
{
private readonly StringBuilder _builder = new StringBuilder(1024);
private readonly GeneratorExecutionContext _context;
{
public partial class EventSourceGenerator
{
- private class Parser
+ private sealed class Parser
{
private readonly CancellationToken _cancellationToken;
private readonly Compilation _compilation;
}
}
- private class EventSourceClass
+ private sealed class EventSourceClass
{
public string Namespace = string.Empty;
public string ClassName = string.Empty;
// This class wraps an IList, exposing it as a ArrayList
// Note this requires reimplementing half of ArrayList...
- private class IListWrapper : ArrayList
+ private sealed class IListWrapper : ArrayList
{
private readonly IList _list;
}
}
- private class SyncArrayList : ArrayList
+ private sealed class SyncArrayList : ArrayList
{
private readonly ArrayList _list;
private readonly object _root;
}
- private class SyncIList : IList
+ private sealed class SyncIList : IList
{
private readonly IList _list;
private readonly object _root;
_root = list.SyncRoot;
}
- public virtual int Count
+ public int Count
{
get { lock (_root) { return _list.Count; } }
}
- public virtual bool IsReadOnly => _list.IsReadOnly;
+ public bool IsReadOnly => _list.IsReadOnly;
- public virtual bool IsFixedSize => _list.IsFixedSize;
+ public bool IsFixedSize => _list.IsFixedSize;
- public virtual bool IsSynchronized => true;
+ public bool IsSynchronized => true;
- public virtual object? this[int index]
+ public object? this[int index]
{
get
{
}
}
- public virtual object SyncRoot => _root;
+ public object SyncRoot => _root;
- public virtual int Add(object? value)
+ public int Add(object? value)
{
lock (_root)
{
}
- public virtual void Clear()
+ public void Clear()
{
lock (_root)
{
}
}
- public virtual bool Contains(object? item)
+ public bool Contains(object? item)
{
lock (_root)
{
}
}
- public virtual void CopyTo(Array array, int index)
+ public void CopyTo(Array array, int index)
{
lock (_root)
{
}
}
- public virtual IEnumerator GetEnumerator()
+ public IEnumerator GetEnumerator()
{
lock (_root)
{
}
}
- public virtual int IndexOf(object? value)
+ public int IndexOf(object? value)
{
lock (_root)
{
}
}
- public virtual void Insert(int index, object? value)
+ public void Insert(int index, object? value)
{
lock (_root)
{
}
}
- public virtual void Remove(object? value)
+ public void Remove(object? value)
{
lock (_root)
{
}
}
- public virtual void RemoveAt(int index)
+ public void RemoveAt(int index)
{
lock (_root)
{
}
}
- private class FixedSizeList : IList
+ private sealed class FixedSizeList : IList
{
private readonly IList _list;
_list = l;
}
- public virtual int Count => _list.Count;
+ public int Count => _list.Count;
- public virtual bool IsReadOnly => _list.IsReadOnly;
+ public bool IsReadOnly => _list.IsReadOnly;
- public virtual bool IsFixedSize => true;
+ public bool IsFixedSize => true;
- public virtual bool IsSynchronized => _list.IsSynchronized;
+ public bool IsSynchronized => _list.IsSynchronized;
- public virtual object? this[int index]
+ public object? this[int index]
{
get => _list[index];
set => _list[index] = value;
}
- public virtual object SyncRoot => _list.SyncRoot;
+ public object SyncRoot => _list.SyncRoot;
- public virtual int Add(object? obj)
+ public int Add(object? obj)
{
throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
}
- public virtual void Clear()
+ public void Clear()
{
throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
}
- public virtual bool Contains(object? obj)
+ public bool Contains(object? obj)
{
return _list.Contains(obj);
}
- public virtual void CopyTo(Array array, int index)
+ public void CopyTo(Array array, int index)
{
_list.CopyTo(array, index);
}
- public virtual IEnumerator GetEnumerator()
+ public IEnumerator GetEnumerator()
{
return _list.GetEnumerator();
}
- public virtual int IndexOf(object? value)
+ public int IndexOf(object? value)
{
return _list.IndexOf(value);
}
- public virtual void Insert(int index, object? obj)
+ public void Insert(int index, object? obj)
{
throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
}
- public virtual void Remove(object? value)
+ public void Remove(object? value)
{
throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
}
- public virtual void RemoveAt(int index)
+ public void RemoveAt(int index)
{
throw new NotSupportedException(SR.NotSupported_FixedSizeCollection);
}
}
- private class FixedSizeArrayList : ArrayList
+ private sealed class FixedSizeArrayList : ArrayList
{
private ArrayList _list;
}
}
- private class ReadOnlyList : IList
+ private sealed class ReadOnlyList : IList
{
private readonly IList _list;
_list = l;
}
- public virtual int Count => _list.Count;
+ public int Count => _list.Count;
- public virtual bool IsReadOnly => true;
+ public bool IsReadOnly => true;
- public virtual bool IsFixedSize => true;
+ public bool IsFixedSize => true;
- public virtual bool IsSynchronized => _list.IsSynchronized;
+ public bool IsSynchronized => _list.IsSynchronized;
- public virtual object? this[int index]
+ public object? this[int index]
{
get => _list[index];
set => throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
- public virtual object SyncRoot => _list.SyncRoot;
+ public object SyncRoot => _list.SyncRoot;
- public virtual int Add(object? obj)
+ public int Add(object? obj)
{
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
- public virtual void Clear()
+ public void Clear()
{
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
- public virtual bool Contains(object? obj)
+ public bool Contains(object? obj)
{
return _list.Contains(obj);
}
- public virtual void CopyTo(Array array, int index)
+ public void CopyTo(Array array, int index)
{
_list.CopyTo(array, index);
}
- public virtual IEnumerator GetEnumerator()
+ public IEnumerator GetEnumerator()
{
return _list.GetEnumerator();
}
- public virtual int IndexOf(object? value)
+ public int IndexOf(object? value)
{
return _list.IndexOf(value);
}
- public virtual void Insert(int index, object? obj)
+ public void Insert(int index, object? obj)
{
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
- public virtual void Remove(object? value)
+ public void Remove(object? value)
{
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
- public virtual void RemoveAt(int index)
+ public void RemoveAt(int index)
{
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
}
- private class ReadOnlyArrayList : ArrayList
+ private sealed class ReadOnlyArrayList : ArrayList
{
private ArrayList _list;
// Implementation of a generic list subrange. An instance of this class
// is returned by the default implementation of List.GetRange.
- private class Range : ArrayList
+ private sealed class Range : ArrayList
{
private ArrayList _baseList;
private readonly int _baseIndex;
}
}
- internal class ArrayListDebugView
+ internal sealed class ArrayListDebugView
{
private readonly ArrayList _arrayList;
// Implements a Collection for the keys of a hashtable. An instance of this
// class is created by the GetKeys method of a hashtable.
- private class KeyCollection : ICollection
+ private sealed class KeyCollection : ICollection
{
private readonly Hashtable _hashtable;
_hashtable = hashtable;
}
- public virtual void CopyTo(Array array, int arrayIndex)
+ public void CopyTo(Array array, int arrayIndex)
{
if (array == null)
throw new ArgumentNullException(nameof(array));
_hashtable.CopyKeys(array, arrayIndex);
}
- public virtual IEnumerator GetEnumerator()
+ public IEnumerator GetEnumerator()
{
return new HashtableEnumerator(_hashtable, HashtableEnumerator.Keys);
}
- public virtual bool IsSynchronized => _hashtable.IsSynchronized;
+ public bool IsSynchronized => _hashtable.IsSynchronized;
- public virtual object SyncRoot => _hashtable.SyncRoot;
+ public object SyncRoot => _hashtable.SyncRoot;
- public virtual int Count => _hashtable._count;
+ public int Count => _hashtable._count;
}
// Implements a Collection for the values of a hashtable. An instance of
// this class is created by the GetValues method of a hashtable.
- private class ValueCollection : ICollection
+ private sealed class ValueCollection : ICollection
{
private readonly Hashtable _hashtable;
_hashtable = hashtable;
}
- public virtual void CopyTo(Array array, int arrayIndex)
+ public void CopyTo(Array array, int arrayIndex)
{
if (array == null)
throw new ArgumentNullException(nameof(array));
_hashtable.CopyValues(array, arrayIndex);
}
- public virtual IEnumerator GetEnumerator()
+ public IEnumerator GetEnumerator()
{
return new HashtableEnumerator(_hashtable, HashtableEnumerator.Values);
}
- public virtual bool IsSynchronized => _hashtable.IsSynchronized;
+ public bool IsSynchronized => _hashtable.IsSynchronized;
- public virtual object SyncRoot => _hashtable.SyncRoot;
+ public object SyncRoot => _hashtable.SyncRoot;
- public virtual int Count => _hashtable._count;
+ public int Count => _hashtable._count;
}
// Synchronized wrapper for hashtable
- private class SyncHashtable : Hashtable, IEnumerable
+ private sealed class SyncHashtable : Hashtable, IEnumerable
{
- protected Hashtable _table;
+ private Hashtable _table;
internal SyncHashtable(Hashtable table) : base(false)
{
// Implements an enumerator for a hashtable. The enumerator uses the
// internal version number of the hashtable to ensure that no modifications
// are made to the hashtable while an enumeration is in progress.
- private class HashtableEnumerator : IDictionaryEnumerator, ICloneable
+ private sealed class HashtableEnumerator : IDictionaryEnumerator, ICloneable
{
private readonly Hashtable _hashtable;
private int _bucket;
public object Clone() => MemberwiseClone();
- public virtual object Key
+ public object Key
{
get
{
}
}
- public virtual bool MoveNext()
+ public bool MoveNext()
{
if (_version != _hashtable._version)
throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
return false;
}
- public virtual DictionaryEntry Entry
+ public DictionaryEntry Entry
{
get
{
}
}
- public virtual object? Current
+ public object? Current
{
get
{
}
}
- public virtual object? Value
+ public object? Value
{
get
{
}
}
- public virtual void Reset()
+ public void Reset()
{
if (_version != _hashtable._version)
throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
// internal debug view class for hashtable
- internal class HashtableDebugView
+ internal sealed class HashtableDebugView
{
private readonly Hashtable _hashtable;
namespace System.Collections
{
[DebuggerDisplay("{_value}", Name = "[{_key}]")]
- internal class KeyValuePairs
+ internal sealed class KeyValuePairs
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private readonly object _key;
count--;
}
- private class NodeEnumerator : IDictionaryEnumerator
+ private sealed class NodeEnumerator : IDictionaryEnumerator
{
private readonly ListDictionaryInternal list;
private DictionaryNode? current;
}
}
- private class NodeKeyValueCollection : ICollection
+ private sealed class NodeKeyValueCollection : ICollection
{
private readonly ListDictionaryInternal list;
private readonly bool isKeys;
return new NodeKeyValueEnumerator(list, isKeys);
}
- private class NodeKeyValueEnumerator : IEnumerator
+ private sealed class NodeKeyValueEnumerator : IEnumerator
{
private readonly ListDictionaryInternal list;
private DictionaryNode? current;
}
[Serializable]
- private class DictionaryNode
+ private sealed class DictionaryNode
{
public object key = null!;
public object? value;
namespace System
{
[Obsolete("System.CurrentSystemTimeZone has been deprecated. Please investigate the use of System.TimeZoneInfo.Local instead.")]
- internal class CurrentSystemTimeZone : TimeZone
+ internal sealed class CurrentSystemTimeZone : TimeZone
{
// Standard offset in ticks to the Universal time if
// no daylight saving is in used.
String = 1 << TypeCode.String,
}
- internal class BinderState
+ internal sealed class BinderState
{
internal readonly int[] _argsMap;
internal readonly int _originalSize;
///
/// On any normal event log the event with activityTracker.CurrentActivityId
/// </summary>
- internal class ActivityTracker
+ internal sealed class ActivityTracker
{
/// <summary>
/// Called on work item begins. The activity name = providerName + activityName without 'Start' suffix.
/// the 'list of live parents' which indicate of those ancestors, which are alive (if they
/// are not marked dead they are alive).
/// </summary>
- private class ActivityInfo
+ private sealed class ActivityInfo
{
public ActivityInfo(string name, long uniqueId, ActivityInfo? creator, Guid activityIDToRestore, EventActivityOptions options)
{
/// </summary>
///
[EventSource(Name = "Microsoft.Tasks.Nuget")]
- internal class TplEventSource : EventSource
+ internal sealed class TplEventSource : EventSource
{
public class Keywords
{
#endif
{
[UnsupportedOSPlatform("browser")]
- internal class CounterGroup
+ internal sealed class CounterGroup
{
private readonly EventSource _eventSource;
private readonly List<DiagnosticCounter> _counters;
#endif
{
[EventData]
- internal class CounterPayload : IEnumerable<KeyValuePair<string, object?>>
+ internal sealed class CounterPayload : IEnumerable<KeyValuePair<string, object?>>
{
public string? Name { get; set; }
}
[EventData]
- internal class IncrementingCounterPayload : IEnumerable<KeyValuePair<string, object?>>
+ internal sealed class IncrementingCounterPayload : IEnumerable<KeyValuePair<string, object?>>
{
public string? Name { get; set; }
/// This is the payload that is sent in the with EventSource.Write
/// </summary>
[EventData]
- internal class CounterPayloadType
+ internal sealed class CounterPayloadType
{
public CounterPayloadType(CounterPayload payload) { Payload = payload; }
public CounterPayload Payload { get; set; }
/// <summary>
/// This class lets us hook the 'OnEventCommand' from the eventSource.
/// </summary>
- private class OverrideEventProvider : EventProvider
+ private sealed class OverrideEventProvider : EventProvider
{
public OverrideEventProvider(EventSource eventSource, EventProviderType providerType)
: base(providerType)
/// one EventListener (although EventDispatcher does not 'remember' the EventSource it is
/// associated with.
/// </summary>
- internal class EventDispatcher
+ internal sealed class EventDispatcher
{
internal EventDispatcher(EventDispatcher? next, bool[]? eventEnabled, EventListener listener)
{
/// ManifestBuilder is designed to isolate the details of the message of the event from the
/// rest of EventSource. This one happens to create XML.
/// </summary>
- internal class ManifestBuilder
+ internal sealed class ManifestBuilder
{
/// <summary>
/// Build a manifest for 'providerName' with the given GUID, which will be packaged into 'dllName'.
}
#if FEATURE_MANAGED_ETW_CHANNELS
- private class ChannelInfo
+ private sealed class ChannelInfo
{
public string? Name;
public ulong Keywords;
/// This is the payload that is sent in the with EventSource.Write
/// </summary>
[EventData]
- internal class IncrementingEventCounterPayloadType
+ internal sealed class IncrementingEventCounterPayloadType
{
public IncrementingEventCounterPayloadType(IncrementingCounterPayload payload) { Payload = payload; }
public IncrementingCounterPayload Payload { get; set; }
/// This is the payload that is sent in the with EventSource.Write
/// </summary>
[EventData]
- internal class IncrementingPollingCounterPayloadType
+ internal sealed class IncrementingPollingCounterPayloadType
{
public IncrementingPollingCounterPayloadType(IncrementingCounterPayload payload) { Payload = payload; }
public IncrementingCounterPayload Payload { get; set; }
/// This is the payload that is sent in the with EventSource.Write
/// </summary>
[EventData]
- internal class PollingPayloadType
+ internal sealed class PollingPayloadType
{
public PollingPayloadType(CounterPayload payload) { Payload = payload; }
public CounterPayload Payload { get; set; }
/// EventSource APIs.
/// Preserving the order of the elements as they were found inside user defined types is the most important characteristic of this class.
/// </summary>
- internal class EventPayload : IDictionary<string, object?>
+ internal sealed class EventPayload : IDictionary<string, object?>
{
internal EventPayload(List<string> payloadNames, List<object?> payloadValues)
{
/// TraceLogging: Contains the information needed to generate tracelogging
/// metadata for an event field.
/// </summary>
- internal class FieldMetadata
+ internal sealed class FieldMetadata
{
/// <summary>
/// Name of the field
/// TraceLogging: used when implementing a custom TraceLoggingTypeInfo.
/// An instance of this type is provided to the TypeInfo.WriteMetadata method.
/// </summary>
- internal class TraceLoggingMetadataCollector
+ internal sealed class TraceLoggingMetadataCollector
{
private readonly Impl impl;
private readonly FieldMetadata? currentGroup;
}
}
- private class Impl
+ private sealed class Impl
{
internal readonly List<FieldMetadata> fields = new List<FieldMetadata>();
internal short scratchSize;
namespace System.Diagnostics.Tracing
{
- internal class XplatEventLogger : EventListener
+ internal sealed class XplatEventLogger : EventListener
{
public XplatEventLogger() {}
};
[StructLayout(LayoutKind.Sequential)]
- internal class GCMemoryInfoData
+ internal sealed class GCMemoryInfoData
{
internal long _highMemoryLoadThresholdBytes;
internal long _totalAvailableMemoryBytes;
return Culture.CompareInfo.Compare(string1, offset1, length1, string2, offset2, length2, CompareOptions.IgnoreCase) == 0;
}
- internal class TokenHashValue
+ internal sealed class TokenHashValue
{
internal string tokenString;
internal TokenType tokenType;
LAST_CALENDAR = 23 // Last calendar ID
}
- internal class DateTimeFormatInfoScanner
+ internal sealed class DateTimeFormatInfoScanner
{
// Special prefix-like flag char in DateWord array.
namespace System.Globalization
{
// Gregorian Calendars use Era Info
- internal class EraInfo
+ internal sealed class EraInfo
{
internal int era; // The value of the era.
internal long ticks; // The time in ticks when the era starts
// This calendar recognizes two era values:
// 0 CurrentEra (AD)
// 1 BeforeCurrentEra (BC)
- internal class GregorianCalendarHelper
+ internal sealed class GregorianCalendarHelper
{
// 1 tick = 100ns = 10E-7 second
// Number of ticks per time unit
return year;
}
- internal class DateBuffer
+ internal sealed class DateBuffer
{
internal int year;
internal int month;
/// - allows for instantiation for ExecutionAndPublication so as to create an object for locking on
/// - holds exception information.
/// </summary>
- internal class LazyHelper
+ internal sealed class LazyHelper
{
internal static readonly LazyHelper NoneViaConstructor = new LazyHelper(LazyState.NoneViaConstructor);
internal static readonly LazyHelper NoneViaFactory = new LazyHelper(LazyState.NoneViaFactory);
namespace System.Reflection.Emit
{
- internal class EmptyCAHolder : ICustomAttributeProvider
+ internal sealed class EmptyCAHolder : ICustomAttributeProvider
{
internal EmptyCAHolder() { }
namespace System.Reflection.Emit
{
- internal class TypeNameBuilder
+ internal sealed class TypeNameBuilder
{
private StringBuilder _str = new StringBuilder();
private int _instNesting;
namespace System.Resources
{
- internal class FileBasedResourceGroveler : IResourceGroveler
+ internal sealed class FileBasedResourceGroveler : IResourceGroveler
{
private readonly ResourceManager.ResourceManagerMediator _mediator;
namespace System.Resources
{
- internal class ResourceFallbackManager : IEnumerable<CultureInfo>
+ internal sealed class ResourceFallbackManager : IEnumerable<CultureInfo>
{
private readonly CultureInfo m_startingCulture;
private readonly CultureInfo? m_neutralResourcesCulture;
public partial class ResourceManager
{
- internal class CultureNameResourceSetPair
+ internal sealed class CultureNameResourceSetPair
{
public string? lastCultureName;
public ResourceSet? lastResourceSet;
return ums;
}
- internal class ResourceManagerMediator
+ internal sealed class ResourceManagerMediator
{
private readonly ResourceManager _rm;
namespace System.Text
{
- internal class CodePageDataItem
+ internal sealed class CodePageDataItem
{
public int UIFamilyCodePage { get; }
public string WebName { get; }
_encoding.GetChars(bytes, byteCount, chars, charCount);
}
- internal class EncodingCharBuffer
+ internal sealed class EncodingCharBuffer
{
private unsafe char* _chars;
private readonly unsafe char* _charStart;
internal int Count => _charCountResult;
}
- internal class EncodingByteBuffer
+ internal sealed class EncodingByteBuffer
{
private unsafe byte* _bytes;
private readonly unsafe byte* _byteStart;
/// <summary>
/// Used to hold all the chunks indexes when you have many chunks.
/// </summary>
- private class ManyChunkInfo
+ private sealed class ManyChunkInfo
{
private readonly StringBuilder[] _chunks; // These are in normal order (first chunk first)
private int _chunkPos;
}
}
- private class WaitThreadNode
+ private sealed class WaitThreadNode
{
public WaitThread Thread { get; }
public WaitThreadNode? Next { get; set; }
/// <summary>
/// A thread pool wait thread.
/// </summary>
- internal class WaitThread
+ internal sealed class WaitThread
{
/// <summary>
/// The wait handles registered on this wait thread.
// allocate N of these, where N is the maximum number of locks held simultaneously
// by that thread.
//
- internal class ReaderWriterCount
+ internal sealed class ReaderWriterCount
{
// Which lock does this object belong to? This is a numeric ID for two reasons:
// 1) We don't want this field to keep the lock object alive, and a WeakReference would
#region Debugger proxy class
/// <summary>
- /// Internal class used by debug type proxy attribute to display the owner thread ID
+ /// internal sealed class used by debug type proxy attribute to display the owner thread ID
/// </summary>
- internal class SystemThreading_SpinLockDebugView
+ internal sealed class SystemThreading_SpinLockDebugView
{
// SpinLock object
private SpinLock _spinLock;
}
// Proxy class for better debugging experience
- internal class SystemThreadingTasks_FutureDebugView<TResult>
+ internal sealed class SystemThreadingTasks_FutureDebugView<TResult>
{
private readonly Task<TResult> m_task;
// need to be accessed during the life cycle of a Task, so we don't want to instantiate them every time. Once
// one of these properties needs to be written, we will instantiate a ContingentProperties object and set
// the appropriate property.
- internal class ContingentProperties
+ internal sealed class ContingentProperties
{
// Additional context
}
// Proxy class for better debugging experience
- internal class SystemThreadingTasks_TaskDebugView
+ internal sealed class SystemThreadingTasks_TaskDebugView
{
private readonly Task m_task;
/// is ever GC'd without the holder's contents ever having been requested
/// (e.g. by a Task.Wait, Task.get_Exception, etc).
/// </summary>
- internal class TaskExceptionHolder
+ internal sealed class TaskExceptionHolder
{
/// <summary>The task with which this holder is associated.</summary>
private readonly Task m_task;
/// <summary>
/// A manager class that assigns IDs to ThreadLocal instances
/// </summary>
- private class IdManager
+ private sealed class IdManager
{
// The next ID to try
private int _nextIdToTry;
/// (all those LinkedSlot instances can be found by following references from the table slots) and
/// releases the table so that it can get GC'd.
/// </summary>
- private class FinalizationHelper
+ private sealed class FinalizationHelper
{
internal LinkedSlotVolatile[] SlotArray;
private readonly bool _trackAllValues;
// The .NET Foundation licenses this file to you under the MIT license.
-// This file defines an internal class used to throw exceptions in BCL code.
+// This file defines an internal static class used to throw exceptions in BCL code.
// The main purpose is to reduce code size.
//
// The old way to throw an exception generates quite a lot IL code and assembly code.
{
}
- internal class NullByRefReturnException : Exception
+ internal sealed class NullByRefReturnException : Exception
{
public NullByRefReturnException()
{
public partial class Array
{
[StructLayout(LayoutKind.Sequential)]
- private class RawData
+ private sealed class RawData
{
public IntPtr Bounds;
// The following is to prevent a mismatch between the managed and runtime
{
// Need our own stackframe class since the shared version has its own fields
[StructLayout(LayoutKind.Sequential)]
- internal class MonoStackFrame
+ internal sealed class MonoStackFrame
{
#region Keep in sync with object-internals.h
internal int ilOffset;
private static readonly AttributeUsageAttribute DefaultAttributeUsage =
new AttributeUsageAttribute(AttributeTargets.All);
- private class AttributeInfo
+ private sealed class AttributeInfo
{
private AttributeUsageAttribute _usage;
private int _inheritanceLevel;
{
public class CustomAttributeData
{
- private class LazyCAttrData
+ private sealed class LazyCAttrData
{
internal Assembly assembly = null!; // only call site always sets it
internal IntPtr data;
namespace System.Reflection.Emit
{
- internal class GenericInstanceKey
+ internal sealed class GenericInstanceKey
{
private Type gtd;
internal Type[] args;
}
}
- internal class DynamicMethodTokenGenerator : ITokenGenerator
+ internal sealed class DynamicMethodTokenGenerator : ITokenGenerator
{
private DynamicMethod m;
* This class represents an event of an instantiation of a generic type builder.
*/
[StructLayout(LayoutKind.Sequential)]
- internal class EventOnTypeBuilderInst : EventInfo
+ internal sealed class EventOnTypeBuilderInst : EventInfo
{
private TypeBuilderInstantiation instantiation;
private EventBuilder? event_builder;
}
}
- internal class SequencePointList
+ internal sealed class SequencePointList
{
private ISymbolDocumentWriter doc;
private SequencePoint[]? points;
public int EndCol;
}
- internal class Stack
+ internal sealed class Stack
{
private object?[] _array;
private int _size;
_version = 0;
}
- public virtual int Count
+ public int Count
{
get
{
}
}
- public virtual object? Peek()
+ public object? Peek()
{
if (_size == 0)
throw new InvalidOperationException();
return _array[_size - 1];
}
- public virtual object? Pop()
+ public object? Pop()
{
if (_size == 0)
throw new InvalidOperationException();
return obj;
}
- public virtual void Push(object obj)
+ public void Push(object obj)
{
if (_size == _array.Length)
{
}
}
- internal class ModuleBuilderTokenGenerator : ITokenGenerator
+ internal sealed class ModuleBuilderTokenGenerator : ITokenGenerator
{
private ModuleBuilder mb;
namespace System.Reflection
{
[StructLayout(LayoutKind.Sequential)]
- internal class MonoArrayMethod : MethodInfo
+ internal sealed class MonoArrayMethod : MethodInfo
{
#pragma warning disable 649
internal RuntimeMethodHandle mhandle;
* This class represents a property of an instantiation of a generic type builder.
*/
[StructLayout(LayoutKind.Sequential)]
- internal class PropertyOnTypeBuilderInst : PropertyInfo
+ internal sealed class PropertyOnTypeBuilderInst : PropertyInfo
{
private TypeBuilderInstantiation instantiation;
private PropertyInfo prop;
}
[StructLayout(LayoutKind.Sequential)]
- internal class RuntimeFieldInfo : RtFieldInfo
+ internal sealed class RuntimeFieldInfo : RtFieldInfo
{
#pragma warning disable 649
internal IntPtr klass;
#region Sync with _MonoReflectionMethod in object-internals.h
[StructLayout(LayoutKind.Sequential)]
- internal class RuntimeMethodInfo : MethodInfo
+ internal sealed class RuntimeMethodInfo : MethodInfo
{
#pragma warning disable 649
internal IntPtr mhandle;
}
#region Sync with _MonoReflectionMethod in object-internals.h
[StructLayout(LayoutKind.Sequential)]
- internal class RuntimeConstructorInfo : ConstructorInfo
+ internal sealed class RuntimeConstructorInfo : ConstructorInfo
{
#pragma warning disable 649
internal IntPtr mhandle;
{
[StructLayout(LayoutKind.Sequential)]
- internal class RuntimeModule : Module
+ internal sealed class RuntimeModule : Module
{
#pragma warning disable 649
#region Sync with object-internals.h
namespace System.Reflection
{
- internal class RuntimeParameterInfo : ParameterInfo
+ internal sealed class RuntimeParameterInfo : ParameterInfo
{
internal MarshalAsAttribute? marshalAs;
internal delegate R Getter<T, R>(T _this);
[StructLayout(LayoutKind.Sequential)]
- internal class RuntimePropertyInfo : PropertyInfo
+ internal sealed class RuntimePropertyInfo : PropertyInfo
{
#pragma warning disable 649
internal IntPtr klass;
}
}
- private class Display : ATypeName
+ private sealed class Display : ATypeName
{
private readonly string displayName;
return new NoEscape(simpleName);
}
- private class Display : TypeNames.ATypeName, ITypeIdentifier
+ private sealed class Display : TypeNames.ATypeName, ITypeIdentifier
{
private readonly string displayName;
private string? internal_name; //cached
TypeNames.FromDisplay(DisplayName + "+" + innerName.DisplayName);
}
- private class Internal : TypeNames.ATypeName, ITypeIdentifier
+ private sealed class Internal : TypeNames.ATypeName, ITypeIdentifier
{
private readonly string internalName;
private string? display_name; //cached
TypeNames.FromDisplay(DisplayName + "+" + innerName.DisplayName);
}
- private class NoEscape : TypeNames.ATypeName, ITypeIdentifier
+ private sealed class NoEscape : TypeNames.ATypeName, ITypeIdentifier
{
private readonly string simpleName;
internal NoEscape(string simpleName)
return sb.ToString();
}
- private class ParsedName
+ private sealed class ParsedName
{
public List<string>? Names;
public List<ParsedName>? TypeArguments;
Type Resolve(Type type);
Text.StringBuilder Append(Text.StringBuilder sb);
}
- internal class IArraySpec : IModifierSpec
+ internal sealed class IArraySpec : IModifierSpec
{
// dimensions == 1 and bound, or dimensions > 1 and !bound
private readonly int dimensions;
}
}
- internal class PointerSpec : IModifierSpec
+ internal sealed class PointerSpec : IModifierSpec
{
private readonly int pointer_level;
}
- internal class TypeSpec
+ internal sealed class TypeSpec
{
private ITypeIdentifier? name;
private string? assembly_name;
get { return new TypeSpecTypeName(this, true); }
}
- private class TypeSpecTypeName : TypeNames.ATypeName, ITypeName
+ private sealed class TypeSpecTypeName : TypeNames.ATypeName, ITypeName
{
private readonly TypeSpec ts;
private readonly bool want_modifiers;