diff options
author | Stephen Toub <stoub@microsoft.com> | 2018-06-24 08:22:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-24 08:22:35 -0400 |
commit | 0fbd855e38bc3ec269479b5f6bf561dcfd67cbb6 (patch) | |
tree | d2e491bcc12be107d00e496171274c7c180b6013 /src/System.Private.CoreLib/src | |
parent | eb31c358b27182dae487406a3247dfe995beb40f (diff) | |
download | coreclr-0fbd855e38bc3ec269479b5f6bf561dcfd67cbb6.tar.gz coreclr-0fbd855e38bc3ec269479b5f6bf561dcfd67cbb6.tar.bz2 coreclr-0fbd855e38bc3ec269479b5f6bf561dcfd67cbb6.zip |
Simply type names in Corelib (#18623)
Diffstat (limited to 'src/System.Private.CoreLib/src')
184 files changed, 1852 insertions, 1852 deletions
diff --git a/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs b/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs index 80c11594b1..9a2204bf24 100644 --- a/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs +++ b/src/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeThread.cs @@ -242,8 +242,8 @@ namespace Internal.Runtime.Augments Debug.Assert(ProcessorIdRefreshRate <= ProcessorIdCacheCountDownMask); - // Mask with Int32.MaxValue to ensure the execution Id is not negative - t_currentProcessorIdCache = ((currentProcessorId << ProcessorIdCacheShift) & Int32.MaxValue) | ProcessorIdRefreshRate; + // Mask with int.MaxValue to ensure the execution Id is not negative + t_currentProcessorIdCache = ((currentProcessorId << ProcessorIdCacheShift) & int.MaxValue) | ProcessorIdRefreshRate; return currentProcessorId; } diff --git a/src/System.Private.CoreLib/src/Internal/Threading/Tasks/AsyncCausalitySupport.cs b/src/System.Private.CoreLib/src/Internal/Threading/Tasks/AsyncCausalitySupport.cs index aa1b8dd1fd..b16157f8be 100644 --- a/src/System.Private.CoreLib/src/Internal/Threading/Tasks/AsyncCausalitySupport.cs +++ b/src/System.Private.CoreLib/src/Internal/Threading/Tasks/AsyncCausalitySupport.cs @@ -41,7 +41,7 @@ namespace Internal.Threading.Tasks } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void TraceOperationCreation(Task task, String operationName) + public static void TraceOperationCreation(Task task, string operationName) { AsyncCausalityTracer.TraceOperationCreation(CausalityTraceLevel.Required, task.Id, operationName, 0); } diff --git a/src/System.Private.CoreLib/src/Microsoft/Win32/OAVariantLib.cs b/src/System.Private.CoreLib/src/Microsoft/Win32/OAVariantLib.cs index 053507b2d4..99ac9ba6a3 100644 --- a/src/System.Private.CoreLib/src/Microsoft/Win32/OAVariantLib.cs +++ b/src/System.Private.CoreLib/src/Microsoft/Win32/OAVariantLib.cs @@ -36,24 +36,24 @@ namespace Microsoft.Win32 internal static readonly Type[] ClassTypes = { typeof(Empty), typeof(void), - typeof(Boolean), - typeof(Char), - typeof(SByte), - typeof(Byte), - typeof(Int16), - typeof(UInt16), - typeof(Int32), - typeof(UInt32), - typeof(Int64), - typeof(UInt64), - typeof(Single), - typeof(Double), - typeof(String), + typeof(bool), + typeof(char), + typeof(sbyte), + typeof(byte), + typeof(short), + typeof(ushort), + typeof(int), + typeof(uint), + typeof(long), + typeof(ulong), + typeof(float), + typeof(double), + typeof(string), typeof(void), typeof(DateTime), typeof(TimeSpan), - typeof(Object), - typeof(Decimal), + typeof(object), + typeof(decimal), null, // Enums - what do we do here? typeof(Missing), typeof(DBNull), @@ -100,7 +100,7 @@ namespace Microsoft.Win32 private static int GetCVTypeFromClass(Type ctype) { Debug.Assert(ctype != null); - Debug.Assert(ClassTypes[CV_OBJECT] == typeof(Object), "OAVariantLib::ClassTypes[CV_OBJECT] == Object.class"); + Debug.Assert(ClassTypes[CV_OBJECT] == typeof(object), "OAVariantLib::ClassTypes[CV_OBJECT] == Object.class"); int cvtype = -1; for (int i = 0; i < ClassTypes.Length; i++) diff --git a/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.cs b/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.cs index f861e5f9b8..28f86f35dd 100644 --- a/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.cs +++ b/src/System.Private.CoreLib/src/Microsoft/Win32/RegistryKey.cs @@ -523,12 +523,12 @@ namespace Microsoft.Win32 * * @return the data associated with the value. */ - public Object GetValue(string name, Object defaultValue) + public object GetValue(string name, object defaultValue) { return InternalGetValue(name, defaultValue, false, true); } - public Object GetValue(string name, Object defaultValue, RegistryValueOptions options) + public object GetValue(string name, object defaultValue, RegistryValueOptions options) { if (options < RegistryValueOptions.None || options > RegistryValueOptions.DoNotExpandEnvironmentNames) { @@ -538,7 +538,7 @@ namespace Microsoft.Win32 return InternalGetValue(name, defaultValue, doNotExpand, true); } - internal Object InternalGetValue(string name, Object defaultValue, bool doNotExpand, bool checkSecurity) + internal object InternalGetValue(string name, object defaultValue, bool doNotExpand, bool checkSecurity) { if (checkSecurity) { @@ -546,7 +546,7 @@ namespace Microsoft.Win32 EnsureNotDisposed(); } - Object data = defaultValue; + object data = defaultValue; int type = 0; int datasize = 0; @@ -563,15 +563,15 @@ namespace Microsoft.Win32 byte[] blob = new byte[size]; while (Interop.Errors.ERROR_MORE_DATA == (r = Win32Native.RegQueryValueEx(_hkey, name, null, ref type, blob, ref sizeInput))) { - if (size == Int32.MaxValue) + if (size == int.MaxValue) { - // ERROR_MORE_DATA was returned however we cannot increase the buffer size beyond Int32.MaxValue + // ERROR_MORE_DATA was returned however we cannot increase the buffer size beyond int.MaxValue Win32Error(r, name); } - else if (size > (Int32.MaxValue / 2)) + else if (size > (int.MaxValue / 2)) { // at this point in the loop "size * 2" would cause an overflow - size = Int32.MaxValue; + size = int.MaxValue; } else { @@ -798,12 +798,12 @@ namespace Microsoft.Win32 * @param name Name of value to store data in. * @param value Data to store. */ - public void SetValue(string name, Object value) + public void SetValue(string name, object value) { SetValue(name, value, RegistryValueKind.Unknown); } - public unsafe void SetValue(string name, Object value, RegistryValueKind valueKind) + public unsafe void SetValue(string name, object value, RegistryValueKind valueKind) { if (value == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value); @@ -956,12 +956,12 @@ namespace Microsoft.Win32 Win32Error(ret, null); } - private RegistryValueKind CalculateValueKind(Object value) + private RegistryValueKind CalculateValueKind(object value) { // This logic matches what used to be in SetValue(string name, object value) in the v1.0 and v1.1 days. // Even though we could add detection for an int64 in here, we want to maintain compatibility with the // old behavior. - if (value is Int32) + if (value is int) return RegistryValueKind.DWord; else if (value is Array) { diff --git a/src/System.Private.CoreLib/src/Microsoft/Win32/UnsafeNativeMethods.cs b/src/System.Private.CoreLib/src/Microsoft/Win32/UnsafeNativeMethods.cs index cc8887aed6..0c6fb93a9d 100644 --- a/src/System.Private.CoreLib/src/Microsoft/Win32/UnsafeNativeMethods.cs +++ b/src/System.Private.CoreLib/src/Microsoft/Win32/UnsafeNativeMethods.cs @@ -193,7 +193,7 @@ namespace Microsoft.Win32 internal static extern int RoGetActivationFactory( [MarshalAs(UnmanagedType.HString)] string activatableClassId, [In] ref Guid iid, - [Out, MarshalAs(UnmanagedType.IInspectable)] out Object factory); + [Out, MarshalAs(UnmanagedType.IInspectable)] out object factory); #endif } } diff --git a/src/System.Private.CoreLib/src/Microsoft/Win32/Win32Native.cs b/src/System.Private.CoreLib/src/Microsoft/Win32/Win32Native.cs index e1cfd11194..a53ec79229 100644 --- a/src/System.Private.CoreLib/src/Microsoft/Win32/Win32Native.cs +++ b/src/System.Private.CoreLib/src/Microsoft/Win32/Win32Native.cs @@ -219,12 +219,12 @@ namespace Microsoft.Win32 internal uint Type; } - internal const String ADVAPI32 = "advapi32.dll"; - internal const String SHELL32 = "shell32.dll"; - internal const String SHIM = "mscoree.dll"; - internal const String CRYPT32 = "crypt32.dll"; - internal const String SECUR32 = "secur32.dll"; - internal const String MSCORWKS = "coreclr.dll"; + internal const string ADVAPI32 = "advapi32.dll"; + internal const string SHELL32 = "shell32.dll"; + internal const string SHIM = "mscoree.dll"; + internal const string CRYPT32 = "crypt32.dll"; + internal const string SECUR32 = "secur32.dll"; + internal const string MSCORWKS = "coreclr.dll"; [DllImport(Interop.Libraries.Kernel32, EntryPoint = "LocalAlloc")] internal static extern IntPtr LocalAlloc_NoSafeHandle(int uFlags, UIntPtr sizetdwBytes); @@ -260,7 +260,7 @@ namespace Microsoft.Win32 internal static extern int lstrlenW(IntPtr ptr); [DllImport(Interop.Libraries.OleAut32, CharSet = CharSet.Unicode)] - internal static extern IntPtr SysAllocStringLen(String src, int len); // BSTR + internal static extern IntPtr SysAllocStringLen(string src, int len); // BSTR [DllImport(Interop.Libraries.OleAut32)] internal static extern uint SysStringLen(IntPtr bstr); @@ -337,7 +337,7 @@ namespace Microsoft.Win32 #if FEATURE_WIN32_REGISTRY [DllImport(ADVAPI32, CharSet = CharSet.Auto, BestFitMapping = false)] - internal static extern int RegDeleteValue(SafeRegistryHandle hKey, String lpValueName); + internal static extern int RegDeleteValue(SafeRegistryHandle hKey, string lpValueName); [DllImport(ADVAPI32, CharSet = CharSet.Auto, BestFitMapping = false)] internal static extern unsafe int RegEnumKeyEx(SafeRegistryHandle hKey, int dwIndex, @@ -352,48 +352,48 @@ namespace Microsoft.Win32 int[] lpcbData); [DllImport(ADVAPI32, CharSet = CharSet.Auto, BestFitMapping = false)] - internal static extern int RegOpenKeyEx(SafeRegistryHandle hKey, String lpSubKey, + internal static extern int RegOpenKeyEx(SafeRegistryHandle hKey, string lpSubKey, int ulOptions, int samDesired, out SafeRegistryHandle hkResult); [DllImport(ADVAPI32, CharSet = CharSet.Auto, BestFitMapping = false)] - internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, String lpValueName, + internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, string lpValueName, int[] lpReserved, ref int lpType, [Out] byte[] lpData, ref int lpcbData); [DllImport(ADVAPI32, CharSet = CharSet.Auto, BestFitMapping = false)] - internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, String lpValueName, + internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, string lpValueName, int[] lpReserved, ref int lpType, ref int lpData, ref int lpcbData); [DllImport(ADVAPI32, CharSet = CharSet.Auto, BestFitMapping = false)] - internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, String lpValueName, + internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, string lpValueName, int[] lpReserved, ref int lpType, ref long lpData, ref int lpcbData); [DllImport(ADVAPI32, CharSet = CharSet.Auto, BestFitMapping = false)] - internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, String lpValueName, + internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, string lpValueName, int[] lpReserved, ref int lpType, [Out] char[] lpData, ref int lpcbData); [DllImport(ADVAPI32, CharSet = CharSet.Auto, BestFitMapping = false)] - internal static extern int RegSetValueEx(SafeRegistryHandle hKey, String lpValueName, + internal static extern int RegSetValueEx(SafeRegistryHandle hKey, string lpValueName, int Reserved, RegistryValueKind dwType, byte[] lpData, int cbData); [DllImport(ADVAPI32, CharSet = CharSet.Auto, BestFitMapping = false)] - internal static extern int RegSetValueEx(SafeRegistryHandle hKey, String lpValueName, + internal static extern int RegSetValueEx(SafeRegistryHandle hKey, string lpValueName, int Reserved, RegistryValueKind dwType, ref int lpData, int cbData); [DllImport(ADVAPI32, CharSet = CharSet.Auto, BestFitMapping = false)] - internal static extern int RegSetValueEx(SafeRegistryHandle hKey, String lpValueName, + internal static extern int RegSetValueEx(SafeRegistryHandle hKey, string lpValueName, int Reserved, RegistryValueKind dwType, ref long lpData, int cbData); [DllImport(ADVAPI32, CharSet = CharSet.Auto, BestFitMapping = false)] - internal static extern int RegSetValueEx(SafeRegistryHandle hKey, String lpValueName, - int Reserved, RegistryValueKind dwType, String lpData, int cbData); + internal static extern int RegSetValueEx(SafeRegistryHandle hKey, string lpValueName, + int Reserved, RegistryValueKind dwType, string lpData, int cbData); #endif // FEATURE_WIN32_REGISTRY [DllImport(Interop.Libraries.Kernel32, CharSet = CharSet.Auto, SetLastError = true, BestFitMapping = false)] - internal static extern int ExpandEnvironmentStrings(String lpSrc, [Out]StringBuilder lpDst, int nSize); + internal static extern int ExpandEnvironmentStrings(string lpSrc, [Out]StringBuilder lpDst, int nSize); [DllImport(Interop.Libraries.Kernel32)] internal static extern IntPtr LocalReAlloc(IntPtr handle, IntPtr sizetcbBytes, int uFlags); diff --git a/src/System.Private.CoreLib/src/System/AppDomainSetup.cs b/src/System.Private.CoreLib/src/System/AppDomainSetup.cs index f3b3d8c823..d22ebf92ca 100644 --- a/src/System.Private.CoreLib/src/System/AppDomainSetup.cs +++ b/src/System.Private.CoreLib/src/System/AppDomainSetup.cs @@ -55,7 +55,7 @@ namespace System private string[] _Entries; #pragma warning disable 169 - private String _AppBase; // for compat with v1.1 + private string _AppBase; // for compat with v1.1 #pragma warning restore 169 // A collection of strings used to indicate which breaking changes shouldn't be applied @@ -120,12 +120,12 @@ namespace System get { if (_Entries == null) - _Entries = new String[(int)LoaderInformation.LoaderMaximum]; + _Entries = new string[(int)LoaderInformation.LoaderMaximum]; return _Entries; } } - public String ApplicationBase + public string ApplicationBase { get { @@ -144,12 +144,12 @@ namespace System return _CompatFlags; } - public void SetCompatibilitySwitches(IEnumerable<String> switches) + public void SetCompatibilitySwitches(IEnumerable<string> switches) { if (switches != null) { _CompatFlags = new Dictionary<string, object>(); - foreach (String str in switches) + foreach (string str in switches) { _CompatFlags.Add(str, null); } @@ -161,7 +161,7 @@ namespace System } // A target Framework moniker, in a format parsible by the FrameworkName class. - public String TargetFrameworkName + public string TargetFrameworkName { get { @@ -169,7 +169,7 @@ namespace System } } - public String ApplicationName + public string ApplicationName { get { diff --git a/src/System.Private.CoreLib/src/System/ArgIterator.cs b/src/System.Private.CoreLib/src/System/ArgIterator.cs index 7a4131ef25..72ea2548e2 100644 --- a/src/System.Private.CoreLib/src/System/ArgIterator.cs +++ b/src/System.Private.CoreLib/src/System/ArgIterator.cs @@ -128,7 +128,7 @@ namespace System } // Inherited from object - public override bool Equals(Object o) + public override bool Equals(object o) { throw new NotSupportedException(SR.NotSupported_NYI); } diff --git a/src/System.Private.CoreLib/src/System/Array.cs b/src/System.Private.CoreLib/src/System/Array.cs index dc4c8060fe..630ccfc09c 100644 --- a/src/System.Private.CoreLib/src/System/Array.cs +++ b/src/System.Private.CoreLib/src/System/Array.cs @@ -162,7 +162,7 @@ namespace System for (int i = 0; i < lengths.Length; ++i) { long len = lengths[i]; - if (len > Int32.MaxValue || len < Int32.MinValue) + if (len > int.MaxValue || len < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.len, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); intLengths[i] = (int)len; } @@ -249,7 +249,7 @@ namespace System public static void Copy(Array sourceArray, Array destinationArray, long length) { - if (length > Int32.MaxValue || length < Int32.MinValue) + if (length > int.MaxValue || length < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); Array.Copy(sourceArray, destinationArray, (int)length); @@ -257,11 +257,11 @@ namespace System public static void Copy(Array sourceArray, long sourceIndex, Array destinationArray, long destinationIndex, long length) { - if (sourceIndex > Int32.MaxValue || sourceIndex < Int32.MinValue) + if (sourceIndex > int.MaxValue || sourceIndex < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.sourceIndex, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); - if (destinationIndex > Int32.MaxValue || destinationIndex < Int32.MinValue) + if (destinationIndex > int.MaxValue || destinationIndex < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.destinationIndex, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); - if (length > Int32.MaxValue || length < Int32.MinValue) + if (length > int.MaxValue || length < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); Array.Copy(sourceArray, (int)sourceIndex, destinationArray, (int)destinationIndex, (int)length); @@ -296,7 +296,7 @@ namespace System private static extern ref byte GetRawArrayGeometry(Array array, out uint numComponents, out uint elementSize, out int lowerBound, out bool containsGCPointers); // The various Get values... - public unsafe Object GetValue(params int[] indices) + public unsafe object GetValue(params int[] indices) { if (indices == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.indices); @@ -309,7 +309,7 @@ namespace System return TypedReference.InternalToObject(&elemref); } - public unsafe Object GetValue(int index) + public unsafe object GetValue(int index) { if (Rank != 1) ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_Need1DArray); @@ -319,7 +319,7 @@ namespace System return TypedReference.InternalToObject(&elemref); } - public unsafe Object GetValue(int index1, int index2) + public unsafe object GetValue(int index1, int index2) { if (Rank != 2) ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_Need2DArray); @@ -333,7 +333,7 @@ namespace System return TypedReference.InternalToObject(&elemref); } - public unsafe Object GetValue(int index1, int index2, int index3) + public unsafe object GetValue(int index1, int index2, int index3) { if (Rank != 3) ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_Need3DArray); @@ -348,37 +348,37 @@ namespace System return TypedReference.InternalToObject(&elemref); } - public Object GetValue(long index) + public object GetValue(long index) { - if (index > Int32.MaxValue || index < Int32.MinValue) + if (index > int.MaxValue || index < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); return this.GetValue((int)index); } - public Object GetValue(long index1, long index2) + public object GetValue(long index1, long index2) { - if (index1 > Int32.MaxValue || index1 < Int32.MinValue) + if (index1 > int.MaxValue || index1 < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index1, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); - if (index2 > Int32.MaxValue || index2 < Int32.MinValue) + if (index2 > int.MaxValue || index2 < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index2, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); return this.GetValue((int)index1, (int)index2); } - public Object GetValue(long index1, long index2, long index3) + public object GetValue(long index1, long index2, long index3) { - if (index1 > Int32.MaxValue || index1 < Int32.MinValue) + if (index1 > int.MaxValue || index1 < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index1, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); - if (index2 > Int32.MaxValue || index2 < Int32.MinValue) + if (index2 > int.MaxValue || index2 < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index2, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); - if (index3 > Int32.MaxValue || index3 < Int32.MinValue) + if (index3 > int.MaxValue || index3 < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index3, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); return this.GetValue((int)index1, (int)index2, (int)index3); } - public Object GetValue(params long[] indices) + public object GetValue(params long[] indices) { if (indices == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.indices); @@ -390,7 +390,7 @@ namespace System for (int i = 0; i < indices.Length; ++i) { long index = indices[i]; - if (index > Int32.MaxValue || index < Int32.MinValue) + if (index > int.MaxValue || index < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); intIndices[i] = (int)index; } @@ -399,7 +399,7 @@ namespace System } - public unsafe void SetValue(Object value, int index) + public unsafe void SetValue(object value, int index) { if (Rank != 1) ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_Need1DArray); @@ -409,7 +409,7 @@ namespace System InternalSetValue(&elemref, value); } - public unsafe void SetValue(Object value, int index1, int index2) + public unsafe void SetValue(object value, int index1, int index2) { if (Rank != 2) ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_Need2DArray); @@ -423,7 +423,7 @@ namespace System InternalSetValue(&elemref, value); } - public unsafe void SetValue(Object value, int index1, int index2, int index3) + public unsafe void SetValue(object value, int index1, int index2, int index3) { if (Rank != 3) ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_Need3DArray); @@ -438,7 +438,7 @@ namespace System InternalSetValue(&elemref, value); } - public unsafe void SetValue(Object value, params int[] indices) + public unsafe void SetValue(object value, params int[] indices) { if (indices == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.indices); @@ -451,37 +451,37 @@ namespace System InternalSetValue(&elemref, value); } - public void SetValue(Object value, long index) + public void SetValue(object value, long index) { - if (index > Int32.MaxValue || index < Int32.MinValue) + if (index > int.MaxValue || index < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); this.SetValue(value, (int)index); } - public void SetValue(Object value, long index1, long index2) + public void SetValue(object value, long index1, long index2) { - if (index1 > Int32.MaxValue || index1 < Int32.MinValue) + if (index1 > int.MaxValue || index1 < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index1, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); - if (index2 > Int32.MaxValue || index2 < Int32.MinValue) + if (index2 > int.MaxValue || index2 < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index2, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); this.SetValue(value, (int)index1, (int)index2); } - public void SetValue(Object value, long index1, long index2, long index3) + public void SetValue(object value, long index1, long index2, long index3) { - if (index1 > Int32.MaxValue || index1 < Int32.MinValue) + if (index1 > int.MaxValue || index1 < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index1, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); - if (index2 > Int32.MaxValue || index2 < Int32.MinValue) + if (index2 > int.MaxValue || index2 < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index2, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); - if (index3 > Int32.MaxValue || index3 < Int32.MinValue) + if (index3 > int.MaxValue || index3 < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index3, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); this.SetValue(value, (int)index1, (int)index2, (int)index3); } - public void SetValue(Object value, params long[] indices) + public void SetValue(object value, params long[] indices) { if (indices == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.indices); @@ -493,7 +493,7 @@ namespace System for (int i = 0; i < indices.Length; ++i) { long index = indices[i]; - if (index > Int32.MaxValue || index < Int32.MinValue) + if (index > int.MaxValue || index < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); intIndices[i] = (int)index; } @@ -508,7 +508,7 @@ namespace System // Ideally, we would like to use TypedReference.SetValue instead. Unfortunately, TypedReference.SetValue // always throws not-supported exception [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern unsafe void InternalSetValue(void* target, Object value); + private static extern unsafe void InternalSetValue(void* target, object value); public extern int Length { @@ -569,7 +569,7 @@ namespace System // Returns an object appropriate for synchronizing access to this // Array. - public Object SyncRoot + public object SyncRoot { get { return this; } } // Is this Array read-only? @@ -589,19 +589,19 @@ namespace System { get { return false; } } - Object IList.this[int index] + object IList.this[int index] { get { return GetValue(index); } set { SetValue(value, index); } } - int IList.Add(Object value) + int IList.Add(object value) { ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection); return default; } - bool IList.Contains(Object value) + bool IList.Contains(object value) { return Array.IndexOf(this, value) >= this.GetLowerBound(0); } @@ -611,17 +611,17 @@ namespace System Array.Clear(this, this.GetLowerBound(0), this.Length); } - int IList.IndexOf(Object value) + int IList.IndexOf(object value) { return Array.IndexOf(this, value); } - void IList.Insert(int index, Object value) + void IList.Insert(int index, object value) { ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection); } - void IList.Remove(Object value) + void IList.Remove(object value) { ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection); } @@ -633,12 +633,12 @@ namespace System // Make a new array which is a shallow copy of the original array. // - public Object Clone() + public object Clone() { return MemberwiseClone(); } - Int32 IStructuralComparable.CompareTo(Object other, IComparer comparer) + int IStructuralComparable.CompareTo(object other, IComparer comparer) { if (other == null) { @@ -667,14 +667,14 @@ namespace System return c; } - Boolean IStructuralEquatable.Equals(Object other, IEqualityComparer comparer) + bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) { if (other == null) { return false; } - if (Object.ReferenceEquals(this, other)) + if (object.ReferenceEquals(this, other)) { return true; } @@ -736,7 +736,7 @@ namespace System // negative result to produce the index of the first element (if any) that // is larger than the given search value. // - public static int BinarySearch(Array array, Object value) + public static int BinarySearch(Array array, object value) { if (array == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); @@ -757,7 +757,7 @@ namespace System // negative result to produce the index of the first element (if any) that // is larger than the given search value. // - public static int BinarySearch(Array array, int index, int length, Object value) + public static int BinarySearch(Array array, int index, int length, object value) { return BinarySearch(array, index, length, value, null); } @@ -776,7 +776,7 @@ namespace System // negative result to produce the index of the first element (if any) that // is larger than the given search value. // - public static int BinarySearch(Array array, Object value, IComparer comparer) + public static int BinarySearch(Array array, object value, IComparer comparer) { if (array == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); @@ -799,7 +799,7 @@ namespace System // negative result to produce the index of the first element (if any) that // is larger than the given search value. // - public static int BinarySearch(Array array, int index, int length, Object value, IComparer comparer) + public static int BinarySearch(Array array, int index, int length, object value, IComparer comparer) { if (array == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); @@ -824,7 +824,7 @@ namespace System int lo = index; int hi = index + length - 1; - Object[] objArray = array as Object[]; + object[] objArray = array as object[]; if (objArray != null) { while (lo <= hi) @@ -882,7 +882,7 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern bool TrySZBinarySearch(Array sourceArray, int sourceIndex, int count, Object value, out int retVal); + private static extern bool TrySZBinarySearch(Array sourceArray, int sourceIndex, int count, object value, out int retVal); public static int BinarySearch<T>(T[] array, T value) { @@ -955,7 +955,7 @@ namespace System public void CopyTo(Array array, long index) { - if (index > Int32.MaxValue || index < Int32.MinValue) + if (index > int.MaxValue || index < int.MinValue) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index, ExceptionResource.ArgumentOutOfRange_HugeArrayNotSupported); this.CopyTo(array, (int)index); @@ -1230,7 +1230,7 @@ namespace System // The array is searched forwards, and the elements of the array are // compared to the given value using the Object.Equals method. // - public static int IndexOf(Array array, Object value) + public static int IndexOf(Array array, object value) { if (array == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); @@ -1244,7 +1244,7 @@ namespace System // elements of the array are compared to the given value using the // Object.Equals method. // - public static int IndexOf(Array array, Object value, int startIndex) + public static int IndexOf(Array array, object value, int startIndex) { if (array == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); @@ -1258,7 +1258,7 @@ namespace System // elements of the array are compared to the given value using the // Object.Equals method. // - public static int IndexOf(Array array, Object value, int startIndex, int count) + public static int IndexOf(Array array, object value, int startIndex, int count) { if (array == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); @@ -1277,7 +1277,7 @@ namespace System if (r) return retVal; - Object[] objArray = array as Object[]; + object[] objArray = array as object[]; int endIndex = startIndex + count; if (objArray != null) { @@ -1292,7 +1292,7 @@ namespace System { for (int i = startIndex; i < endIndex; i++) { - Object obj = objArray[i]; + object obj = objArray[i]; if (obj != null && obj.Equals(value)) return i; } } @@ -1301,7 +1301,7 @@ namespace System { for (int i = startIndex; i < endIndex; i++) { - Object obj = array.GetValue(i); + object obj = array.GetValue(i); if (obj == null) { if (value == null) return i; @@ -1360,14 +1360,14 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern bool TrySZIndexOf(Array sourceArray, int sourceIndex, int count, Object value, out int retVal); + private static extern bool TrySZIndexOf(Array sourceArray, int sourceIndex, int count, object value, out int retVal); // Returns the index of the last occurrence of a given value in an array. // The array is searched backwards, and the elements of the array are // compared to the given value using the Object.Equals method. // - public static int LastIndexOf(Array array, Object value) + public static int LastIndexOf(Array array, object value) { if (array == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); @@ -1380,7 +1380,7 @@ namespace System // startIndex and ending at index 0. The elements of the array are // compared to the given value using the Object.Equals method. // - public static int LastIndexOf(Array array, Object value, int startIndex) + public static int LastIndexOf(Array array, object value, int startIndex) { if (array == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); @@ -1394,7 +1394,7 @@ namespace System // the array are compared to the given value using the Object.Equals // method. // - public static int LastIndexOf(Array array, Object value, int startIndex, int count) + public static int LastIndexOf(Array array, object value, int startIndex, int count) { if (array == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array); @@ -1419,7 +1419,7 @@ namespace System if (r) return retVal; - Object[] objArray = array as Object[]; + object[] objArray = array as object[]; int endIndex = startIndex - count + 1; if (objArray != null) { @@ -1434,7 +1434,7 @@ namespace System { for (int i = startIndex; i >= endIndex; i--) { - Object obj = objArray[i]; + object obj = objArray[i]; if (obj != null && obj.Equals(value)) return i; } } @@ -1443,7 +1443,7 @@ namespace System { for (int i = startIndex; i >= endIndex; i--) { - Object obj = array.GetValue(i); + object obj = array.GetValue(i); if (obj == null) { if (value == null) return i; @@ -1519,7 +1519,7 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern bool TrySZLastIndexOf(Array sourceArray, int sourceIndex, int count, Object value, out int retVal); + private static extern bool TrySZLastIndexOf(Array sourceArray, int sourceIndex, int count, object value, out int retVal); // Reverses all elements of the given array. Following a call to this @@ -1562,7 +1562,7 @@ namespace System if (r) return; - Object[] objArray = array as Object[]; + object[] objArray = array as object[]; if (objArray != null) { Array.Reverse<object>(objArray, index, length); @@ -1573,7 +1573,7 @@ namespace System int j = index + length - 1; while (i < j) { - Object temp = array.GetValue(i); + object temp = array.GetValue(i); array.SetValue(array.GetValue(j), i); array.SetValue(temp, j); i++; @@ -1736,10 +1736,10 @@ namespace System return; } - Object[] objKeys = keys as Object[]; - Object[] objItems = null; + object[] objKeys = keys as object[]; + object[] objItems = null; if (objKeys != null) - objItems = items as Object[]; + objItems = items as object[]; if (objKeys != null && (items == null || objItems != null)) { SorterObjectArray sorter = new SorterObjectArray(objKeys, objItems, comparer); @@ -1891,11 +1891,11 @@ namespace System // Private value type used by the Sort methods. private struct SorterObjectArray { - private Object[] keys; - private Object[] items; + private object[] keys; + private object[] items; private IComparer comparer; - internal SorterObjectArray(Object[] keys, Object[] items, IComparer comparer) + internal SorterObjectArray(object[] keys, object[] items, IComparer comparer) { if (comparer == null) comparer = Comparer.Default; this.keys = keys; @@ -1909,12 +1909,12 @@ namespace System { if (comparer.Compare(keys[a], keys[b]) > 0) { - Object temp = keys[a]; + object temp = keys[a]; keys[a] = keys[b]; keys[b] = temp; if (items != null) { - Object item = items[a]; + object item = items[a]; items[a] = items[b]; items[b] = item; } @@ -1924,13 +1924,13 @@ namespace System private void Swap(int i, int j) { - Object t = keys[i]; + object t = keys[i]; keys[i] = keys[j]; keys[j] = t; if (items != null) { - Object item = items[i]; + object item = items[i]; items[i] = items[j]; items[j] = item; } @@ -2010,7 +2010,7 @@ namespace System SwapIfGreaterWithItems(lo, hi); SwapIfGreaterWithItems(mid, hi); - Object pivot = keys[mid]; + object pivot = keys[mid]; Swap(mid, hi - 1); int left = lo, right = hi - 1; // We already partitioned lo and hi and put the pivot in hi - 1. And we pre-increment & decrement below. @@ -2047,8 +2047,8 @@ namespace System private void DownHeap(int i, int n, int lo) { - Object d = keys[lo + i - 1]; - Object dt = (items != null) ? items[lo + i - 1] : null; + object d = keys[lo + i - 1]; + object dt = (items != null) ? items[lo + i - 1] : null; int child; while (i <= n / 2) { @@ -2072,7 +2072,7 @@ namespace System private void InsertionSort(int lo, int hi) { int i, j; - Object t, ti; + object t, ti; for (i = lo; i < hi; i++) { j = i; @@ -2115,12 +2115,12 @@ namespace System { if (comparer.Compare(keys.GetValue(a), keys.GetValue(b)) > 0) { - Object key = keys.GetValue(a); + object key = keys.GetValue(a); keys.SetValue(keys.GetValue(b), a); keys.SetValue(key, b); if (items != null) { - Object item = items.GetValue(a); + object item = items.GetValue(a); items.SetValue(items.GetValue(b), a); items.SetValue(item, b); } @@ -2130,13 +2130,13 @@ namespace System private void Swap(int i, int j) { - Object t1 = keys.GetValue(i); + object t1 = keys.GetValue(i); keys.SetValue(keys.GetValue(j), i); keys.SetValue(t1, j); if (items != null) { - Object t2 = items.GetValue(i); + object t2 = items.GetValue(i); items.SetValue(items.GetValue(j), i); items.SetValue(t2, j); } @@ -2216,7 +2216,7 @@ namespace System SwapIfGreaterWithItems(lo, hi); SwapIfGreaterWithItems(mid, hi); - Object pivot = keys.GetValue(mid); + object pivot = keys.GetValue(mid); Swap(mid, hi - 1); int left = lo, right = hi - 1; // We already partitioned lo and hi and put the pivot in hi - 1. And we pre-increment & decrement below. @@ -2253,8 +2253,8 @@ namespace System private void DownHeap(int i, int n, int lo) { - Object d = keys.GetValue(lo + i - 1); - Object dt = (items != null) ? items.GetValue(lo + i - 1) : null; + object d = keys.GetValue(lo + i - 1); + object dt = (items != null) ? items.GetValue(lo + i - 1) : null; int child; while (i <= n / 2) { @@ -2280,7 +2280,7 @@ namespace System private void InsertionSort(int lo, int hi) { int i, j; - Object t, dt; + object t, dt; for (i = lo; i < hi; i++) { j = i; @@ -2317,7 +2317,7 @@ namespace System _endIndex = array.Length; } - public Object Clone() + public object Clone() { return MemberwiseClone(); } @@ -2332,7 +2332,7 @@ namespace System return false; } - public Object Current + public object Current { get { @@ -2404,7 +2404,7 @@ namespace System } } - public Object Clone() + public object Clone() { return MemberwiseClone(); } @@ -2421,7 +2421,7 @@ namespace System return !_complete; } - public Object Current + public object Current { get { diff --git a/src/System.Private.CoreLib/src/System/Attribute.cs b/src/System.Private.CoreLib/src/System/Attribute.cs index 5934284c0f..fd84dd33b0 100644 --- a/src/System.Private.CoreLib/src/System/Attribute.cs +++ b/src/System.Private.CoreLib/src/System/Attribute.cs @@ -245,7 +245,7 @@ namespace System // class inherits from and return the respective ParameterInfo attributes List<Type> disAllowMultiple = new List<Type>(); - Object[] objAttr; + object[] objAttr; if (type == null) type = typeof(Attribute); @@ -344,7 +344,7 @@ namespace System while (baseParam != null) { - Object[] objAttr = baseParam.GetCustomAttributes(type, false); + object[] objAttr = baseParam.GetCustomAttributes(type, false); for (int i = 0; i < objAttr.Length; i++) { @@ -422,7 +422,7 @@ namespace System private static AttributeUsageAttribute InternalGetAttributeUsage(Type type) { // Check if the custom attributes is Inheritable - Object[] obj = type.GetCustomAttributes(typeof(AttributeUsageAttribute), false); + object[] obj = type.GetCustomAttributes(typeof(AttributeUsageAttribute), false); if (obj.Length == 1) return (AttributeUsageAttribute)obj[0]; @@ -814,7 +814,7 @@ namespace System #endregion #region Object Overrides - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (obj == null) return false; @@ -825,8 +825,8 @@ namespace System if (thatType != thisType) return false; - Object thisObj = this; - Object thisResult, thatResult; + object thisObj = this; + object thisResult, thatResult; while (thisType != typeof(Attribute)) { @@ -850,7 +850,7 @@ namespace System } // Compares values of custom-attribute fields. - private static bool AreFieldValuesEqual(Object thisValue, Object thatValue) + private static bool AreFieldValuesEqual(object thisValue, object thatValue) { if (thisValue == null && thatValue == null) return true; @@ -903,12 +903,12 @@ namespace System while (type != typeof(Attribute)) { FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly); - Object vThis = null; + object vThis = null; for (int i = 0; i < fields.Length; i++) { // Visibility check and consistency check are not necessary. - Object fieldValue = ((RtFieldInfo)fields[i]).UnsafeGetValue(this); + object fieldValue = ((RtFieldInfo)fields[i]).UnsafeGetValue(this); // The hashcode of an array ignores the contents of the array, so it can produce // different hashcodes for arrays with the same contents. @@ -932,9 +932,9 @@ namespace System #endregion #region Public Virtual Members - public virtual Object TypeId { get { return GetType(); } } + public virtual object TypeId { get { return GetType(); } } - public virtual bool Match(Object obj) { return Equals(obj); } + public virtual bool Match(object obj) { return Equals(obj); } #endregion #region Public Members diff --git a/src/System.Private.CoreLib/src/System/Buffer.cs b/src/System.Private.CoreLib/src/System/Buffer.cs index 8245aa9940..d9cd453107 100644 --- a/src/System.Private.CoreLib/src/System/Buffer.cs +++ b/src/System.Private.CoreLib/src/System/Buffer.cs @@ -181,12 +181,12 @@ namespace System #if PLATFORM_WINDOWS // Determined optimal value for Windows. // https://github.com/dotnet/coreclr/issues/13843 - const nuint CopyThreshold = UInt64.MaxValue; + const nuint CopyThreshold = ulong.MaxValue; #else // PLATFORM_WINDOWS // Managed code is currently faster than glibc unoptimized memmove // TODO-ARM64-UNIX-OPT revisit when glibc optimized memmove is in Linux distros // https://github.com/dotnet/coreclr/issues/13844 - const nuint CopyThreshold = UInt64.MaxValue; + const nuint CopyThreshold = ulong.MaxValue; #endif // PLATFORM_WINDOWS #else const nuint CopyThreshold = 512; @@ -392,12 +392,12 @@ namespace System #if PLATFORM_WINDOWS // Determined optimal value for Windows. // https://github.com/dotnet/coreclr/issues/13843 - const nuint CopyThreshold = UInt64.MaxValue; + const nuint CopyThreshold = ulong.MaxValue; #else // PLATFORM_WINDOWS // Managed code is currently faster than glibc unoptimized memmove // TODO-ARM64-UNIX-OPT revisit when glibc optimized memmove is in Linux distros // https://github.com/dotnet/coreclr/issues/13844 - const nuint CopyThreshold = UInt64.MaxValue; + const nuint CopyThreshold = ulong.MaxValue; #endif // PLATFORM_WINDOWS #else const nuint CopyThreshold = 512; diff --git a/src/System.Private.CoreLib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs b/src/System.Private.CoreLib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs index a6a04b4964..72e40c7ce1 100644 --- a/src/System.Private.CoreLib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs +++ b/src/System.Private.CoreLib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs @@ -60,7 +60,7 @@ namespace System.Collections } } - public Object SyncRoot + public object SyncRoot { get { @@ -78,7 +78,7 @@ namespace System.Collections // IDictionary members - public Object this[Object key] + public object this[object key] { get { @@ -109,7 +109,7 @@ namespace System.Collections { get { - return Array.Empty<Object>(); + return Array.Empty<object>(); } } @@ -117,16 +117,16 @@ namespace System.Collections { get { - return Array.Empty<Object>(); + return Array.Empty<object>(); } } - public bool Contains(Object key) + public bool Contains(object key) { return false; } - public void Add(Object key, Object value) + public void Add(object key, object value) { if (key == null) { @@ -168,7 +168,7 @@ namespace System.Collections return new NodeEnumerator(); } - public void Remove(Object key) + public void Remove(object key) { throw new InvalidOperationException(SR.InvalidOperation_ReadOnly); } @@ -186,7 +186,7 @@ namespace System.Collections return false; } - public Object Current + public object Current { get { @@ -200,7 +200,7 @@ namespace System.Collections // IDictionaryEnumerator members - public Object Key + public object Key { get { @@ -208,7 +208,7 @@ namespace System.Collections } } - public Object Value + public object Value { get { diff --git a/src/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs b/src/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs index 25d03355e4..29446b29c5 100644 --- a/src/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs +++ b/src/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs @@ -23,7 +23,7 @@ namespace System.Collections.ObjectModel internal class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary, IReadOnlyDictionary<TKey, TValue> { private readonly IDictionary<TKey, TValue> m_dictionary; - private Object m_syncRoot; + private object m_syncRoot; private KeyCollection m_keys; private ValueCollection m_values; @@ -350,7 +350,7 @@ namespace System.Collections.ObjectModel } else { - System.Threading.Interlocked.CompareExchange<Object>(ref m_syncRoot, new Object(), null); + System.Threading.Interlocked.CompareExchange<object>(ref m_syncRoot, new object(), null); } } return m_syncRoot; @@ -426,7 +426,7 @@ namespace System.Collections.ObjectModel public sealed class KeyCollection : ICollection<TKey>, ICollection, IReadOnlyCollection<TKey> { private readonly ICollection<TKey> m_collection; - private Object m_syncRoot; + private object m_syncRoot; internal KeyCollection(ICollection<TKey> collection) { @@ -520,7 +520,7 @@ namespace System.Collections.ObjectModel } else { - System.Threading.Interlocked.CompareExchange<Object>(ref m_syncRoot, new Object(), null); + System.Threading.Interlocked.CompareExchange<object>(ref m_syncRoot, new object(), null); } } return m_syncRoot; @@ -535,7 +535,7 @@ namespace System.Collections.ObjectModel public sealed class ValueCollection : ICollection<TValue>, ICollection, IReadOnlyCollection<TValue> { private readonly ICollection<TValue> m_collection; - private Object m_syncRoot; + private object m_syncRoot; internal ValueCollection(ICollection<TValue> collection) { @@ -629,7 +629,7 @@ namespace System.Collections.ObjectModel } else { - System.Threading.Interlocked.CompareExchange<Object>(ref m_syncRoot, new Object(), null); + System.Threading.Interlocked.CompareExchange<object>(ref m_syncRoot, new object(), null); } } return m_syncRoot; diff --git a/src/System.Private.CoreLib/src/System/Currency.cs b/src/System.Private.CoreLib/src/System/Currency.cs index 4b735bbfe3..81d0bbf8a5 100644 --- a/src/System.Private.CoreLib/src/System/Currency.cs +++ b/src/System.Private.CoreLib/src/System/Currency.cs @@ -16,9 +16,9 @@ namespace System // Constructs a Currency from a Decimal value. // - public Currency(Decimal value) + public Currency(decimal value) { - m_value = Decimal.ToCurrency(value).m_value; + m_value = decimal.ToCurrency(value).m_value; } // Constructs a Currency from a long value without scaling. The @@ -48,16 +48,16 @@ namespace System return m_value; } - // Converts a Currency to a Decimal. + // Converts a Currency to a decimal. // - public static Decimal ToDecimal(Currency c) + public static decimal ToDecimal(Currency c) { - Decimal result = new Decimal(); + decimal result = new decimal(); FCallToDecimal(ref result, c); return result; } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void FCallToDecimal(ref Decimal result, Currency c); + private static extern void FCallToDecimal(ref decimal result, Currency c); } } diff --git a/src/System.Private.CoreLib/src/System/DateTime.CoreCLR.cs b/src/System.Private.CoreLib/src/System/DateTime.CoreCLR.cs index 84cda1d813..c9a0f23c83 100644 --- a/src/System.Private.CoreLib/src/System/DateTime.CoreCLR.cs +++ b/src/System.Private.CoreLib/src/System/DateTime.CoreCLR.cs @@ -16,7 +16,7 @@ namespace System long ticks = 0; ticks = GetSystemTimeAsFileTime(); - return new DateTime(((UInt64)(ticks + FileTimeOffset)) | KindUtc); + return new DateTime(((ulong)(ticks + FileTimeOffset)) | KindUtc); } } diff --git a/src/System.Private.CoreLib/src/System/Decimal.cs b/src/System.Private.CoreLib/src/System/Decimal.cs index 2a11ee9d98..d91017f1d5 100644 --- a/src/System.Private.CoreLib/src/System/Decimal.cs +++ b/src/System.Private.CoreLib/src/System/Decimal.cs @@ -60,7 +60,7 @@ namespace System [Serializable] [System.Runtime.Versioning.NonVersionable] // This only applies to field layout [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public partial struct Decimal : IFormattable, IComparable, IConvertible, IComparable<Decimal>, IEquatable<Decimal>, IDeserializationCallback, ISpanFormattable + public partial struct Decimal : IFormattable, IComparable, IConvertible, IComparable<decimal>, IEquatable<decimal>, IDeserializationCallback, ISpanFormattable { // Sign mask for the flags field. A value of zero in this bit indicates a // positive Decimal value, and a value of one in this bit indicates a @@ -81,10 +81,10 @@ namespace System private const int ScaleShift = 16; // The maximum power of 10 that a 32 bit integer can store - private const Int32 MaxInt32Scale = 9; + private const int MaxInt32Scale = 9; // Fast access for 10^n where n is 0-9 - private static UInt32[] Powers10 = new UInt32[] { + private static uint[] Powers10 = new uint[] { 1, 10, 100, @@ -98,30 +98,30 @@ namespace System }; // Constant representing the Decimal value 0. - public const Decimal Zero = 0m; + public const decimal Zero = 0m; // Constant representing the Decimal value 1. - public const Decimal One = 1m; + public const decimal One = 1m; // Constant representing the Decimal value -1. - public const Decimal MinusOne = -1m; + public const decimal MinusOne = -1m; // Constant representing the largest possible Decimal value. The value of // this constant is 79,228,162,514,264,337,593,543,950,335. - public const Decimal MaxValue = 79228162514264337593543950335m; + public const decimal MaxValue = 79228162514264337593543950335m; // Constant representing the smallest possible Decimal value. The value of // this constant is -79,228,162,514,264,337,593,543,950,335. - public const Decimal MinValue = -79228162514264337593543950335m; + public const decimal MinValue = -79228162514264337593543950335m; // Constant representing the negative number that is the closest possible // Decimal value to -0m. - private const Decimal NearNegativeZero = -0.0000000000000000000000000001m; + private const decimal NearNegativeZero = -0.0000000000000000000000000001m; // Constant representing the positive number that is the closest possible // Decimal value to +0m. - private const Decimal NearPositiveZero = +0.0000000000000000000000000001m; + private const decimal NearPositiveZero = +0.0000000000000000000000000001m; // The lo, mid, hi, and flags fields contain the representation of the // Decimal value. The lo, mid, and hi fields contain the 96-bit integer @@ -235,12 +235,12 @@ namespace System // Don't remove these 2 methods below. They are required by the fx when the are dealing with Currency in their // databases - public static long ToOACurrency(Decimal value) + public static long ToOACurrency(decimal value) { return new Currency(value).ToOACurrency(); } - public static Decimal FromOACurrency(long cy) + public static decimal FromOACurrency(long cy) { return Currency.ToDecimal(Currency.FromOACurrency(cy)); } @@ -321,7 +321,7 @@ namespace System } } - void IDeserializationCallback.OnDeserialization(Object sender) + void IDeserializationCallback.OnDeserialization(object sender) { // OnDeserialization is called after each instance of this class is deserialized. // This callback method performs decimal validation after being deserialized. @@ -353,14 +353,14 @@ namespace System // positive, the result is d. If d is negative, the result // is -d. // - internal static Decimal Abs(ref Decimal d) + internal static decimal Abs(ref decimal d) { - return new Decimal(d.lo, d.mid, d.hi, d.flags & ~SignMask); + return new decimal(d.lo, d.mid, d.hi, d.flags & ~SignMask); } // Adds two Decimal values. // - public static Decimal Add(Decimal d1, Decimal d2) + public static decimal Add(decimal d1, decimal d2) { FCallAddSub(ref d1, ref d2, DECIMAL_ADD); return d1; @@ -375,25 +375,25 @@ namespace System // addition or subtraction, respectively. // [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void FCallAddSub(ref Decimal d1, ref Decimal d2, byte bSign); + private static extern void FCallAddSub(ref decimal d1, ref decimal d2, byte bSign); // Rounds a Decimal to an integer value. The Decimal argument is rounded // towards positive infinity. - public static Decimal Ceiling(Decimal d) + public static decimal Ceiling(decimal d) { - return (-(Decimal.Floor(-d))); + return (-(decimal.Floor(-d))); } // Compares two Decimal values, returning an integer that indicates their // relationship. // - public static int Compare(Decimal d1, Decimal d2) + public static int Compare(decimal d1, decimal d2) { return FCallCompare(ref d1, ref d2); } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern int FCallCompare(ref Decimal d1, ref Decimal d2); + private static extern int FCallCompare(ref decimal d1, ref decimal d2); // Compares this object to another object, returning an integer that // indicates the relationship. @@ -401,25 +401,25 @@ namespace System // null is considered to be less than any instance. // If object is not of type Decimal, this method throws an ArgumentException. // - public int CompareTo(Object value) + public int CompareTo(object value) { if (value == null) return 1; - if (!(value is Decimal)) + if (!(value is decimal)) throw new ArgumentException(SR.Arg_MustBeDecimal); - Decimal other = (Decimal)value; + decimal other = (decimal)value; return FCallCompare(ref this, ref other); } - public int CompareTo(Decimal value) + public int CompareTo(decimal value) { return FCallCompare(ref this, ref value); } // Divides two Decimal values. // - public static Decimal Divide(Decimal d1, Decimal d2) + public static decimal Divide(decimal d1, decimal d2) { FCallDivide(ref d1, ref d2); return d1; @@ -429,24 +429,24 @@ namespace System // of the operation. // [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void FCallDivide(ref Decimal d1, ref Decimal d2); + private static extern void FCallDivide(ref decimal d1, ref decimal d2); // Checks if this Decimal is equal to a given object. Returns true // if the given object is a boxed Decimal and its value is equal to the // value of this Decimal. Returns false otherwise. // - public override bool Equals(Object value) + public override bool Equals(object value) { - if (value is Decimal) + if (value is decimal) { - Decimal other = (Decimal)value; + decimal other = (decimal)value; return FCallCompare(ref this, ref other) == 0; } return false; } - public bool Equals(Decimal value) + public bool Equals(decimal value) { return FCallCompare(ref this, ref value) == 0; } @@ -458,7 +458,7 @@ namespace System // Compares two Decimal values for equality. Returns true if the two // Decimal values are equal, or false if they are not equal. // - public static bool Equals(Decimal d1, Decimal d2) + public static bool Equals(decimal d1, decimal d2) { return FCallCompare(ref d1, ref d2) == 0; } @@ -466,36 +466,36 @@ namespace System // Rounds a Decimal to an integer value. The Decimal argument is rounded // towards negative infinity. // - public static Decimal Floor(Decimal d) + public static decimal Floor(decimal d) { FCallFloor(ref d); return d; } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void FCallFloor(ref Decimal d); + private static extern void FCallFloor(ref decimal d); // Converts this Decimal to a string. The resulting string consists of an // optional minus sign ("-") followed to a sequence of digits ("0" - "9"), // optionally followed by a decimal point (".") and another sequence of // digits. // - public override String ToString() + public override string ToString() { return Number.FormatDecimal(this, null, NumberFormatInfo.CurrentInfo); } - public String ToString(String format) + public string ToString(string format) { return Number.FormatDecimal(this, format, NumberFormatInfo.CurrentInfo); } - public String ToString(IFormatProvider provider) + public string ToString(IFormatProvider provider) { return Number.FormatDecimal(this, null, NumberFormatInfo.GetInstance(provider)); } - public String ToString(String format, IFormatProvider provider) + public string ToString(string format, IFormatProvider provider) { return Number.FormatDecimal(this, format, NumberFormatInfo.GetInstance(provider)); } @@ -512,26 +512,26 @@ namespace System // Parse also allows a currency symbol, a trailing negative sign, and // parentheses in the number. // - public static Decimal Parse(String s) + public static decimal Parse(string s) { if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); return Number.ParseDecimal(s, NumberStyles.Number, NumberFormatInfo.CurrentInfo); } - public static Decimal Parse(String s, NumberStyles style) + public static decimal Parse(string s, NumberStyles style) { NumberFormatInfo.ValidateParseStyleFloatingPoint(style); if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); return Number.ParseDecimal(s, style, NumberFormatInfo.CurrentInfo); } - public static Decimal Parse(String s, IFormatProvider provider) + public static decimal Parse(string s, IFormatProvider provider) { if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); return Number.ParseDecimal(s, NumberStyles.Number, NumberFormatInfo.GetInstance(provider)); } - public static Decimal Parse(String s, NumberStyles style, IFormatProvider provider) + public static decimal Parse(string s, NumberStyles style, IFormatProvider provider) { NumberFormatInfo.ValidateParseStyleFloatingPoint(style); if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); @@ -544,7 +544,7 @@ namespace System return Number.ParseDecimal(s, style, NumberFormatInfo.GetInstance(provider)); } - public static Boolean TryParse(String s, out Decimal result) + public static bool TryParse(string s, out decimal result) { if (s == null) { @@ -560,7 +560,7 @@ namespace System return Number.TryParseDecimal(s, NumberStyles.Number, NumberFormatInfo.CurrentInfo, out result); } - public static Boolean TryParse(String s, NumberStyles style, IFormatProvider provider, out Decimal result) + public static bool TryParse(string s, NumberStyles style, IFormatProvider provider, out decimal result) { NumberFormatInfo.ValidateParseStyleFloatingPoint(style); @@ -589,12 +589,12 @@ namespace System // indicates the sign of the Decimal value, 0 meaning positive and 1 // meaning negative. // - public static int[] GetBits(Decimal d) + public static int[] GetBits(decimal d) { return new int[] { d.lo, d.mid, d.hi, d.flags }; } - internal static void GetBytes(Decimal d, byte[] buffer) + internal static void GetBytes(decimal d, byte[] buffer) { Debug.Assert((buffer != null && buffer.Length >= 16), "[GetBytes]buffer != null && buffer.Length >= 16"); buffer[0] = (byte)d.lo; @@ -625,7 +625,7 @@ namespace System int mid = ((int)buffer[4]) | ((int)buffer[5] << 8) | ((int)buffer[6] << 16) | ((int)buffer[7] << 24); int hi = ((int)buffer[8]) | ((int)buffer[9] << 8) | ((int)buffer[10] << 16) | ((int)buffer[11] << 24); int flags = ((int)buffer[12]) | ((int)buffer[13] << 8) | ((int)buffer[14] << 16) | ((int)buffer[15] << 24); - return new Decimal(lo, mid, hi, flags); + return new decimal(lo, mid, hi, flags); } // This method does a 'raw' and 'unchecked' addition of a UInt32 to a Decimal in place. @@ -633,21 +633,21 @@ namespace System // ingores the sign and scale. This means that it is not equivalent to just adding // that number, as the sign and scale are effectively applied to the UInt32 value also. // 'unchecked' means that it does not fail if you overflow the 96 bit value. - private static void InternalAddUInt32RawUnchecked(ref Decimal value, UInt32 i) + private static void InternalAddUInt32RawUnchecked(ref decimal value, uint i) { - UInt32 v; - UInt32 sum; - v = (UInt32)value.lo; + uint v; + uint sum; + v = (uint)value.lo; sum = v + i; - value.lo = (Int32)sum; + value.lo = (int)sum; if (sum < v || sum < i) { - v = (UInt32)value.mid; + v = (uint)value.mid; sum = v + 1; - value.mid = (Int32)sum; + value.mid = (int)sum; if (sum < v || sum < 1) { - value.hi = (Int32)((UInt32)value.hi + 1); + value.hi = (int)((uint)value.hi + 1); } } } @@ -655,47 +655,47 @@ namespace System // This method does an in-place division of a decimal by a UInt32, returning the remainder. // Although it does not operate on the sign or scale, this does not result in any // caveat for the result. It is equivalent to dividing by that number. - private static UInt32 InternalDivRemUInt32(ref Decimal value, UInt32 divisor) + private static uint InternalDivRemUInt32(ref decimal value, uint divisor) { - UInt32 remainder = 0; - UInt64 n; + uint remainder = 0; + ulong n; if (value.hi != 0) { - n = ((UInt32)value.hi); - value.hi = (Int32)((UInt32)(n / divisor)); - remainder = (UInt32)(n % divisor); + n = ((uint)value.hi); + value.hi = (int)((uint)(n / divisor)); + remainder = (uint)(n % divisor); } if (value.mid != 0 || remainder != 0) { - n = ((UInt64)remainder << 32) | (UInt32)value.mid; - value.mid = (Int32)((UInt32)(n / divisor)); - remainder = (UInt32)(n % divisor); + n = ((ulong)remainder << 32) | (uint)value.mid; + value.mid = (int)((uint)(n / divisor)); + remainder = (uint)(n % divisor); } if (value.lo != 0 || remainder != 0) { - n = ((UInt64)remainder << 32) | (UInt32)value.lo; - value.lo = (Int32)((UInt32)(n / divisor)); - remainder = (UInt32)(n % divisor); + n = ((ulong)remainder << 32) | (uint)value.lo; + value.lo = (int)((uint)(n / divisor)); + remainder = (uint)(n % divisor); } return remainder; } // Does an in-place round the specified number of digits, rounding mid-point values // away from zero - private static void InternalRoundFromZero(ref Decimal d, int decimalCount) + private static void InternalRoundFromZero(ref decimal d, int decimalCount) { - Int32 scale = (d.flags & ScaleMask) >> ScaleShift; - Int32 scaleDifference = scale - decimalCount; + int scale = (d.flags & ScaleMask) >> ScaleShift; + int scaleDifference = scale - decimalCount; if (scaleDifference <= 0) { return; } // Divide the value by 10^scaleDifference - UInt32 lastRemainder; - UInt32 lastDivisor; + uint lastRemainder; + uint lastDivisor; do { - Int32 diffChunk = (scaleDifference > MaxInt32Scale) ? MaxInt32Scale : scaleDifference; + int diffChunk = (scaleDifference > MaxInt32Scale) ? MaxInt32Scale : scaleDifference; lastDivisor = Powers10[diffChunk]; lastRemainder = InternalDivRemUInt32(ref d, lastDivisor); scaleDifference -= diffChunk; @@ -713,19 +713,19 @@ namespace System // Returns the larger of two Decimal values. // - internal static Decimal Max(ref Decimal d1, ref Decimal d2) + internal static decimal Max(ref decimal d1, ref decimal d2) { return FCallCompare(ref d1, ref d2) >= 0 ? d1 : d2; } // Returns the smaller of two Decimal values. // - internal static Decimal Min(ref Decimal d1, ref Decimal d2) + internal static decimal Min(ref decimal d1, ref decimal d2) { return FCallCompare(ref d1, ref d2) < 0 ? d1 : d2; } - public static Decimal Remainder(Decimal d1, Decimal d2) + public static decimal Remainder(decimal d1, decimal d2) { // OleAut doesn't provide a VarDecMod. @@ -749,9 +749,9 @@ namespace System } // Formula: d1 - (RoundTowardsZero(d1 / d2) * d2) - Decimal dividedResult = Truncate(d1 / d2); - Decimal multipliedResult = dividedResult * d2; - Decimal result = d1 - multipliedResult; + decimal dividedResult = Truncate(d1 / d2); + decimal multipliedResult = dividedResult * d2; + decimal result = d1 - multipliedResult; // See if the result has crossed 0 if ((d1.flags & SignMask) != (result.flags & SignMask)) { @@ -775,7 +775,7 @@ namespace System // Multiplies two Decimal values. // - public static Decimal Multiply(Decimal d1, Decimal d2) + public static decimal Multiply(decimal d1, decimal d2) { FCallMultiply(ref d1, ref d2); return d1; @@ -785,14 +785,14 @@ namespace System // of the operation. // [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void FCallMultiply(ref Decimal d1, ref Decimal d2); + private static extern void FCallMultiply(ref decimal d1, ref decimal d2); // Returns the negated value of the given Decimal. If d is non-zero, // the result is -d. If d is zero, the result is zero. // - public static Decimal Negate(Decimal d) + public static decimal Negate(decimal d) { - return new Decimal(d.lo, d.mid, d.hi, d.flags ^ SignMask); + return new decimal(d.lo, d.mid, d.hi, d.flags ^ SignMask); } // Rounds a Decimal value to a given number of decimal places. The value @@ -803,23 +803,23 @@ namespace System // By default a mid-point value is rounded to the nearest even number. If the mode is // passed in, it can also round away from zero. - public static Decimal Round(Decimal d) + public static decimal Round(decimal d) { return Round(d, 0); } - public static Decimal Round(Decimal d, int decimals) + public static decimal Round(decimal d, int decimals) { FCallRound(ref d, decimals); return d; } - public static Decimal Round(Decimal d, MidpointRounding mode) + public static decimal Round(decimal d, MidpointRounding mode) { return Round(d, 0, mode); } - public static Decimal Round(Decimal d, int decimals, MidpointRounding mode) + public static decimal Round(decimal d, int decimals, MidpointRounding mode) { if ((decimals < 0) || (decimals > 28)) throw new ArgumentOutOfRangeException(nameof(decimals), SR.ArgumentOutOfRange_DecimalRound); @@ -840,13 +840,13 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void FCallRound(ref Decimal d, int decimals); + private static extern void FCallRound(ref decimal d, int decimals); internal static int Sign(ref decimal d) => (d.lo | d.mid | d.hi) == 0 ? 0 : (d.flags >> 31) | 1; // Subtracts two Decimal values. // - public static Decimal Subtract(Decimal d1, Decimal d2) + public static decimal Subtract(decimal d1, decimal d2) { FCallAddSub(ref d1, ref d2, DECIMAL_NEG); return d1; @@ -856,7 +856,7 @@ namespace System // towards zero to the nearest integer value, and the result of this // operation is returned as a byte. // - public static byte ToByte(Decimal value) + public static byte ToByte(decimal value) { uint temp; try @@ -867,7 +867,7 @@ namespace System { throw new OverflowException(SR.Overflow_Byte, e); } - if (temp < Byte.MinValue || temp > Byte.MaxValue) throw new OverflowException(SR.Overflow_Byte); + if (temp < byte.MinValue || temp > byte.MaxValue) throw new OverflowException(SR.Overflow_Byte); return (byte)temp; } @@ -876,7 +876,7 @@ namespace System // operation is returned as a byte. // [CLSCompliant(false)] - public static sbyte ToSByte(Decimal value) + public static sbyte ToSByte(decimal value) { int temp; try @@ -887,7 +887,7 @@ namespace System { throw new OverflowException(SR.Overflow_SByte, e); } - if (temp < SByte.MinValue || temp > SByte.MaxValue) throw new OverflowException(SR.Overflow_SByte); + if (temp < sbyte.MinValue || temp > sbyte.MaxValue) throw new OverflowException(SR.Overflow_SByte); return (sbyte)temp; } @@ -895,7 +895,7 @@ namespace System // rounded towards zero to the nearest integer value, and the result of // this operation is returned as a short. // - public static short ToInt16(Decimal value) + public static short ToInt16(decimal value) { int temp; try @@ -906,7 +906,7 @@ namespace System { throw new OverflowException(SR.Overflow_Int16, e); } - if (temp < Int16.MinValue || temp > Int16.MaxValue) throw new OverflowException(SR.Overflow_Int16); + if (temp < short.MinValue || temp > short.MaxValue) throw new OverflowException(SR.Overflow_Int16); return (short)temp; } @@ -915,7 +915,7 @@ namespace System // has fewer significant digits than a Decimal, this operation may // produce round-off errors. // - internal static Currency ToCurrency(Decimal d) + internal static Currency ToCurrency(decimal d) { Currency result = new Currency(); FCallToCurrency(ref result, d); @@ -923,22 +923,22 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void FCallToCurrency(ref Currency result, Decimal d); + private static extern void FCallToCurrency(ref Currency result, decimal d); // Converts a Decimal to a double. Since a double has fewer significant // digits than a Decimal, this operation may produce round-off errors. // [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern double ToDouble(Decimal d); + public static extern double ToDouble(decimal d); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern int FCallToInt32(Decimal d); + internal static extern int FCallToInt32(decimal d); // Converts a Decimal to an integer. The Decimal value is rounded towards // zero to the nearest integer value, and the result of this operation is // returned as an integer. // - public static int ToInt32(Decimal d) + public static int ToInt32(decimal d) { if ((d.flags & ScaleMask) != 0) FCallTruncate(ref d); if (d.hi == 0 && d.mid == 0) @@ -961,7 +961,7 @@ namespace System // to the nearest integer value, and the result of this operation is // returned as a long. // - public static long ToInt64(Decimal d) + public static long ToInt64(decimal d) { if ((d.flags & ScaleMask) != 0) FCallTruncate(ref d); if (d.hi == 0) @@ -985,7 +985,7 @@ namespace System // result of this operation is returned as an ushort. // [CLSCompliant(false)] - public static ushort ToUInt16(Decimal value) + public static ushort ToUInt16(decimal value) { uint temp; try @@ -996,7 +996,7 @@ namespace System { throw new OverflowException(SR.Overflow_UInt16, e); } - if (temp < UInt16.MinValue || temp > UInt16.MaxValue) throw new OverflowException(SR.Overflow_UInt16); + if (temp < ushort.MinValue || temp > ushort.MaxValue) throw new OverflowException(SR.Overflow_UInt16); return (ushort)temp; } @@ -1005,7 +1005,7 @@ namespace System // result of this operation is returned as an unsigned integer. // [CLSCompliant(false)] - public static uint ToUInt32(Decimal d) + public static uint ToUInt32(decimal d) { if ((d.flags & ScaleMask) != 0) FCallTruncate(ref d); if (d.hi == 0 && d.mid == 0) @@ -1022,7 +1022,7 @@ namespace System // result of this operation is returned as a long. // [CLSCompliant(false)] - public static ulong ToUInt64(Decimal d) + public static ulong ToUInt64(decimal d) { if ((d.flags & ScaleMask) != 0) FCallTruncate(ref d); if (d.hi == 0) @@ -1038,13 +1038,13 @@ namespace System // digits than a Decimal, this operation may produce round-off errors. // [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern float ToSingle(Decimal d); + public static extern float ToSingle(decimal d); // Truncates a Decimal to an integer value. The Decimal argument is rounded // towards zero to the nearest integer value, corresponding to removing all // digits after the decimal point. // - public static Decimal Truncate(Decimal d) + public static decimal Truncate(decimal d) { FCallTruncate(ref d); return d; @@ -1052,83 +1052,83 @@ namespace System [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void FCallTruncate(ref Decimal d); + private static extern void FCallTruncate(ref decimal d); - public static implicit operator Decimal(byte value) + public static implicit operator decimal(byte value) { - return new Decimal(value); + return new decimal(value); } [CLSCompliant(false)] - public static implicit operator Decimal(sbyte value) + public static implicit operator decimal(sbyte value) { - return new Decimal(value); + return new decimal(value); } - public static implicit operator Decimal(short value) + public static implicit operator decimal(short value) { - return new Decimal(value); + return new decimal(value); } [CLSCompliant(false)] - public static implicit operator Decimal(ushort value) + public static implicit operator decimal(ushort value) { - return new Decimal(value); + return new decimal(value); } - public static implicit operator Decimal(char value) + public static implicit operator decimal(char value) { - return new Decimal(value); + return new decimal(value); } - public static implicit operator Decimal(int value) + public static implicit operator decimal(int value) { - return new Decimal(value); + return new decimal(value); } [CLSCompliant(false)] - public static implicit operator Decimal(uint value) + public static implicit operator decimal(uint value) { - return new Decimal(value); + return new decimal(value); } - public static implicit operator Decimal(long value) + public static implicit operator decimal(long value) { - return new Decimal(value); + return new decimal(value); } [CLSCompliant(false)] - public static implicit operator Decimal(ulong value) + public static implicit operator decimal(ulong value) { - return new Decimal(value); + return new decimal(value); } - public static explicit operator Decimal(float value) + public static explicit operator decimal(float value) { - return new Decimal(value); + return new decimal(value); } - public static explicit operator Decimal(double value) + public static explicit operator decimal(double value) { - return new Decimal(value); + return new decimal(value); } - public static explicit operator byte(Decimal value) + public static explicit operator byte(decimal value) { return ToByte(value); } [CLSCompliant(false)] - public static explicit operator sbyte(Decimal value) + public static explicit operator sbyte(decimal value) { return ToSByte(value); } - public static explicit operator char(Decimal value) + public static explicit operator char(decimal value) { - UInt16 temp; + ushort temp; try { temp = ToUInt16(value); @@ -1140,124 +1140,124 @@ namespace System return (char)temp; } - public static explicit operator short(Decimal value) + public static explicit operator short(decimal value) { return ToInt16(value); } [CLSCompliant(false)] - public static explicit operator ushort(Decimal value) + public static explicit operator ushort(decimal value) { return ToUInt16(value); } - public static explicit operator int(Decimal value) + public static explicit operator int(decimal value) { return ToInt32(value); } [CLSCompliant(false)] - public static explicit operator uint(Decimal value) + public static explicit operator uint(decimal value) { return ToUInt32(value); } - public static explicit operator long(Decimal value) + public static explicit operator long(decimal value) { return ToInt64(value); } [CLSCompliant(false)] - public static explicit operator ulong(Decimal value) + public static explicit operator ulong(decimal value) { return ToUInt64(value); } - public static explicit operator float(Decimal value) + public static explicit operator float(decimal value) { return ToSingle(value); } - public static explicit operator double(Decimal value) + public static explicit operator double(decimal value) { return ToDouble(value); } - public static Decimal operator +(Decimal d) + public static decimal operator +(decimal d) { return d; } - public static Decimal operator -(Decimal d) + public static decimal operator -(decimal d) { return Negate(d); } - public static Decimal operator ++(Decimal d) + public static decimal operator ++(decimal d) { return Add(d, One); } - public static Decimal operator --(Decimal d) + public static decimal operator --(decimal d) { return Subtract(d, One); } - public static Decimal operator +(Decimal d1, Decimal d2) + public static decimal operator +(decimal d1, decimal d2) { FCallAddSub(ref d1, ref d2, DECIMAL_ADD); return d1; } - public static Decimal operator -(Decimal d1, Decimal d2) + public static decimal operator -(decimal d1, decimal d2) { FCallAddSub(ref d1, ref d2, DECIMAL_NEG); return d1; } - public static Decimal operator *(Decimal d1, Decimal d2) + public static decimal operator *(decimal d1, decimal d2) { FCallMultiply(ref d1, ref d2); return d1; } - public static Decimal operator /(Decimal d1, Decimal d2) + public static decimal operator /(decimal d1, decimal d2) { FCallDivide(ref d1, ref d2); return d1; } - public static Decimal operator %(Decimal d1, Decimal d2) + public static decimal operator %(decimal d1, decimal d2) { return Remainder(d1, d2); } - public static bool operator ==(Decimal d1, Decimal d2) + public static bool operator ==(decimal d1, decimal d2) { return FCallCompare(ref d1, ref d2) == 0; } - public static bool operator !=(Decimal d1, Decimal d2) + public static bool operator !=(decimal d1, decimal d2) { return FCallCompare(ref d1, ref d2) != 0; } - public static bool operator <(Decimal d1, Decimal d2) + public static bool operator <(decimal d1, decimal d2) { return FCallCompare(ref d1, ref d2) < 0; } - public static bool operator <=(Decimal d1, Decimal d2) + public static bool operator <=(decimal d1, decimal d2) { return FCallCompare(ref d1, ref d2) <= 0; } - public static bool operator >(Decimal d1, Decimal d2) + public static bool operator >(decimal d1, decimal d2) { return FCallCompare(ref d1, ref d2) > 0; } - public static bool operator >=(Decimal d1, Decimal d2) + public static bool operator >=(decimal d1, decimal d2) { return FCallCompare(ref d1, ref d2) >= 0; } @@ -1332,7 +1332,7 @@ namespace System return Convert.ToDouble(this); } - Decimal IConvertible.ToDecimal(IFormatProvider provider) + decimal IConvertible.ToDecimal(IFormatProvider provider) { return this; } @@ -1342,7 +1342,7 @@ namespace System throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Decimal", "DateTime")); } - Object IConvertible.ToType(Type type, IFormatProvider provider) + object IConvertible.ToType(Type type, IFormatProvider provider) { return Convert.DefaultToType((IConvertible)this, type, provider); } diff --git a/src/System.Private.CoreLib/src/System/Delegate.cs b/src/System.Private.CoreLib/src/System/Delegate.cs index 690fafb819..0d6c1e1523 100644 --- a/src/System.Private.CoreLib/src/System/Delegate.cs +++ b/src/System.Private.CoreLib/src/System/Delegate.cs @@ -19,11 +19,11 @@ namespace System public abstract class Delegate : ICloneable, ISerializable { // _target is the object we will invoke on - internal Object _target; + internal object _target; // MethodBase, either cached after first request or assigned from a DynamicMethod // For open delegates to collectible types, this may be a LoaderAllocator object - internal Object _methodBase; + internal object _methodBase; // _methodPtr is a pointer to the method we will invoke // It could be a small thunk if this is a static or UM call @@ -37,7 +37,7 @@ namespace System // This constructor is called from the class generated by the // compiler generated code - protected Delegate(Object target, String method) + protected Delegate(object target, string method) { if (target == null) throw new ArgumentNullException(nameof(target)); @@ -60,7 +60,7 @@ namespace System // This constructor is called from a class to generate a // delegate based upon a static method name and the Type object // for the class defining the method. - protected unsafe Delegate(Type target, String method) + protected unsafe Delegate(Type target, string method) { if (target == null) throw new ArgumentNullException(nameof(target)); @@ -93,7 +93,7 @@ namespace System { } - public Object DynamicInvoke(params Object[] args) + public object DynamicInvoke(params object[] args) { // Theoretically we should set up a LookForMyCaller stack mark here and pass that along. // But to maintain backward compatibility we can't switch to calling an @@ -113,7 +113,7 @@ namespace System } - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (obj == null || !InternalEqualTypes(this, obj)) return false; @@ -183,7 +183,7 @@ namespace System public static Delegate Combine(Delegate a, Delegate b) { - if ((Object)a == null) // cast to object for a more efficient test + if ((object)a == null) // cast to object for a more efficient test return b; return a.CombineImpl(b); @@ -272,7 +272,7 @@ namespace System return (MethodInfo)_methodBase; } - public Object Target + public object Target { get { @@ -320,25 +320,25 @@ namespace System } - public virtual Object Clone() + public virtual object Clone() { return MemberwiseClone(); } // V1 API. - public static Delegate CreateDelegate(Type type, Object target, String method) + public static Delegate CreateDelegate(Type type, object target, string method) { return CreateDelegate(type, target, method, false, true); } // V1 API. - public static Delegate CreateDelegate(Type type, Object target, String method, bool ignoreCase) + public static Delegate CreateDelegate(Type type, object target, string method, bool ignoreCase) { return CreateDelegate(type, target, method, ignoreCase, true); } // V1 API. - public static Delegate CreateDelegate(Type type, Object target, String method, bool ignoreCase, bool throwOnBindFailure) + public static Delegate CreateDelegate(Type type, object target, string method, bool ignoreCase, bool throwOnBindFailure) { if (type == null) throw new ArgumentNullException(nameof(type)); @@ -376,19 +376,19 @@ namespace System } // V1 API. - public static Delegate CreateDelegate(Type type, Type target, String method) + public static Delegate CreateDelegate(Type type, Type target, string method) { return CreateDelegate(type, target, method, false, true); } // V1 API. - public static Delegate CreateDelegate(Type type, Type target, String method, bool ignoreCase) + public static Delegate CreateDelegate(Type type, Type target, string method, bool ignoreCase) { return CreateDelegate(type, target, method, ignoreCase, true); } // V1 API. - public static Delegate CreateDelegate(Type type, Type target, String method, bool ignoreCase, bool throwOnBindFailure) + public static Delegate CreateDelegate(Type type, Type target, string method, bool ignoreCase, bool throwOnBindFailure) { if (type == null) throw new ArgumentNullException(nameof(type)); @@ -467,13 +467,13 @@ namespace System } // V2 API. - public static Delegate CreateDelegate(Type type, Object firstArgument, MethodInfo method) + public static Delegate CreateDelegate(Type type, object firstArgument, MethodInfo method) { return CreateDelegate(type, firstArgument, method, true); } // V2 API. - public static Delegate CreateDelegate(Type type, Object firstArgument, MethodInfo method, bool throwOnBindFailure) + public static Delegate CreateDelegate(Type type, object firstArgument, MethodInfo method, bool throwOnBindFailure) { // Validate the parameters. if (type == null) @@ -511,16 +511,16 @@ namespace System public static bool operator ==(Delegate d1, Delegate d2) { - if ((Object)d1 == null) - return (Object)d2 == null; + if ((object)d1 == null) + return (object)d2 == null; return d1.Equals(d2); } public static bool operator !=(Delegate d1, Delegate d2) { - if ((Object)d1 == null) - return (Object)d2 != null; + if ((object)d1 == null) + return (object)d2 != null; return !d1.Equals(d2); } @@ -540,7 +540,7 @@ namespace System // V2 internal API. // This is Critical because it skips the security check when creating the delegate. - internal static unsafe Delegate CreateDelegateNoSecurityCheck(Type type, Object target, RuntimeMethodHandle method) + internal static unsafe Delegate CreateDelegateNoSecurityCheck(Type type, object target, RuntimeMethodHandle method) { // Validate the parameters. if (type == null) @@ -572,7 +572,7 @@ namespace System } // Caution: this method is intended for deserialization only, no security checks are performed. - internal static Delegate CreateDelegateNoSecurityCheck(RuntimeType type, Object firstArgument, MethodInfo method) + internal static Delegate CreateDelegateNoSecurityCheck(RuntimeType type, object firstArgument, MethodInfo method) { // Validate the parameters. if (type == null) @@ -612,7 +612,7 @@ namespace System return CreateDelegate(type, method, true); } - internal static Delegate CreateDelegateInternal(RuntimeType rtType, RuntimeMethodInfo rtMethod, Object firstArgument, DelegateBindingFlags flags) + internal static Delegate CreateDelegateInternal(RuntimeType rtType, RuntimeMethodInfo rtMethod, object firstArgument, DelegateBindingFlags flags) { Delegate d = InternalAlloc(rtType); @@ -627,10 +627,10 @@ namespace System // [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern bool BindToMethodName(Object target, RuntimeType methodType, String method, DelegateBindingFlags flags); + private extern bool BindToMethodName(object target, RuntimeType methodType, string method, DelegateBindingFlags flags); [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern bool BindToMethodInfo(Object target, IRuntimeMethodInfo method, RuntimeType methodType, DelegateBindingFlags flags); + private extern bool BindToMethodInfo(object target, IRuntimeMethodInfo method, RuntimeType methodType, DelegateBindingFlags flags); [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern MulticastDelegate InternalAlloc(RuntimeType type); @@ -644,7 +644,7 @@ namespace System // Used by the ctor. Do not call directly. // The name of this function will appear in managed stacktraces as delegate constructor. [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern void DelegateConstruct(Object target, IntPtr slot); + private extern void DelegateConstruct(object target, IntPtr slot); [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern IntPtr GetMulticastInvoke(); @@ -659,12 +659,12 @@ namespace System internal static extern bool InternalEqualMethodHandles(Delegate left, Delegate right); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal extern IntPtr AdjustTarget(Object target, IntPtr methodPtr); + internal extern IntPtr AdjustTarget(object target, IntPtr methodPtr); [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern IntPtr GetCallStub(IntPtr methodPtr); - internal virtual Object GetTarget() + internal virtual object GetTarget() { return (_methodPtrAux == IntPtr.Zero) ? _target : null; } diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/Contracts/Contracts.cs b/src/System.Private.CoreLib/src/System/Diagnostics/Contracts/Contracts.cs index e94ef46f24..44bb846277 100644 --- a/src/System.Private.CoreLib/src/System/Diagnostics/Contracts/Contracts.cs +++ b/src/System.Private.CoreLib/src/System/Diagnostics/Contracts/Contracts.cs @@ -141,14 +141,14 @@ namespace System.Diagnostics.Contracts [AttributeUsage(AttributeTargets.Field)] public sealed class ContractPublicPropertyNameAttribute : Attribute { - private String _publicName; + private string _publicName; - public ContractPublicPropertyNameAttribute(String name) + public ContractPublicPropertyNameAttribute(string name) { _publicName = name; } - public String Name + public string Name { get { return _publicName; } } @@ -180,31 +180,31 @@ namespace System.Diagnostics.Contracts [Conditional("CONTRACTS_FULL")] public sealed class ContractOptionAttribute : Attribute { - private String _category; - private String _setting; + private string _category; + private string _setting; private bool _enabled; - private String _value; + private string _value; - public ContractOptionAttribute(String category, String setting, bool enabled) + public ContractOptionAttribute(string category, string setting, bool enabled) { _category = category; _setting = setting; _enabled = enabled; } - public ContractOptionAttribute(String category, String setting, String value) + public ContractOptionAttribute(string category, string setting, string value) { _category = category; _setting = setting; _value = value; } - public String Category + public string Category { get { return _category; } } - public String Setting + public string Setting { get { return _setting; } } @@ -214,7 +214,7 @@ namespace System.Diagnostics.Contracts get { return _enabled; } } - public String Value + public string Value { get { return _value; } } @@ -267,7 +267,7 @@ namespace System.Diagnostics.Contracts [Pure] [Conditional("DEBUG")] [Conditional("CONTRACTS_FULL")] - public static void Assume(bool condition, String userMessage) + public static void Assume(bool condition, string userMessage) { if (!condition) { @@ -300,7 +300,7 @@ namespace System.Diagnostics.Contracts [Pure] [Conditional("DEBUG")] [Conditional("CONTRACTS_FULL")] - public static void Assert(bool condition, String userMessage) + public static void Assert(bool condition, string userMessage) { if (!condition) ReportFailure(ContractFailureKind.Assert, userMessage, null, null); @@ -338,7 +338,7 @@ namespace System.Diagnostics.Contracts /// </remarks> [Pure] [Conditional("CONTRACTS_FULL")] - public static void Requires(bool condition, String userMessage) + public static void Requires(bool condition, string userMessage) { AssertMustUseRewriter(ContractFailureKind.Precondition, "Requires"); } @@ -369,7 +369,7 @@ namespace System.Diagnostics.Contracts /// Use this form when you want to throw a particular exception. /// </remarks> [Pure] - public static void Requires<TException>(bool condition, String userMessage) where TException : Exception + public static void Requires<TException>(bool condition, string userMessage) where TException : Exception { AssertMustUseRewriter(ContractFailureKind.Precondition, "Requires<TException>"); } @@ -406,7 +406,7 @@ namespace System.Diagnostics.Contracts /// </remarks> [Pure] [Conditional("CONTRACTS_FULL")] - public static void Ensures(bool condition, String userMessage) + public static void Ensures(bool condition, string userMessage) { AssertMustUseRewriter(ContractFailureKind.Postcondition, "Ensures"); } @@ -441,7 +441,7 @@ namespace System.Diagnostics.Contracts /// </remarks> [Pure] [Conditional("CONTRACTS_FULL")] - public static void EnsuresOnThrow<TException>(bool condition, String userMessage) where TException : Exception + public static void EnsuresOnThrow<TException>(bool condition, string userMessage) where TException : Exception { AssertMustUseRewriter(ContractFailureKind.PostconditionOnException, "EnsuresOnThrow"); } @@ -517,7 +517,7 @@ namespace System.Diagnostics.Contracts /// </remarks> [Pure] [Conditional("CONTRACTS_FULL")] - public static void Invariant(bool condition, String userMessage) + public static void Invariant(bool condition, string userMessage) { AssertMustUseRewriter(ContractFailureKind.Invariant, "Invariant"); } diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/Contracts/ContractsBCL.cs b/src/System.Private.CoreLib/src/System/Diagnostics/Contracts/ContractsBCL.cs index f1cb53c393..f0c2f0764e 100644 --- a/src/System.Private.CoreLib/src/System/Diagnostics/Contracts/ContractsBCL.cs +++ b/src/System.Private.CoreLib/src/System/Diagnostics/Contracts/ContractsBCL.cs @@ -201,7 +201,7 @@ namespace System.Runtime.CompilerServices #region Private fields private static volatile EventHandler<ContractFailedEventArgs> contractFailedEvent; - private static readonly Object lockObject = new Object(); + private static readonly object lockObject = new object(); internal const int COR_E_CODECONTRACTFAILED = unchecked((int)0x80131542); diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/Debug.Windows.cs b/src/System.Private.CoreLib/src/System/Diagnostics/Debug.Windows.cs index 1f5a545849..71f38f1a13 100644 --- a/src/System.Private.CoreLib/src/System/Diagnostics/Debug.Windows.cs +++ b/src/System.Private.CoreLib/src/System/Diagnostics/Debug.Windows.cs @@ -34,7 +34,7 @@ namespace System.Diagnostics } } - private static readonly object s_ForLock = new Object(); + private static readonly object s_ForLock = new object(); private static void WriteCore(string message) { diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/EditAndContinueHelper.cs b/src/System.Private.CoreLib/src/System/Diagnostics/EditAndContinueHelper.cs index 6b8c150ab8..89aec10164 100644 --- a/src/System.Private.CoreLib/src/System/Diagnostics/EditAndContinueHelper.cs +++ b/src/System.Private.CoreLib/src/System/Diagnostics/EditAndContinueHelper.cs @@ -20,7 +20,7 @@ namespace System.Diagnostics { #pragma warning disable 169 #pragma warning disable 414 // Field is not used from managed. - private Object _objectReference; + private object _objectReference; #pragma warning restore 414 #pragma warning restore 169 } diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs b/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs index 42061df043..214788ebc3 100644 --- a/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs +++ b/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipeEventProvider.cs @@ -87,7 +87,7 @@ namespace System.Diagnostics.Tracing } // Define an EventPipeEvent handle. - unsafe IntPtr IEventProvider.DefineEventHandle(uint eventID, string eventName, Int64 keywords, uint eventVersion, uint level, byte *pMetadata, uint metadataLength) + unsafe IntPtr IEventProvider.DefineEventHandle(uint eventID, string eventName, long keywords, uint eventVersion, uint level, byte *pMetadata, uint metadataLength) { IntPtr eventHandlePtr = EventPipeInternal.DefineEvent(m_provHandle, eventID, keywords, eventVersion, level, pMetadata, metadataLength); return eventHandlePtr; diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs b/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs index a1fbc1a6b9..740fff432d 100644 --- a/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs +++ b/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs @@ -230,20 +230,20 @@ namespace System.Diagnostics.Tracing // ResourceManager Event Definitions [Event(1, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerLookupStarted(String baseName, String mainAssemblyName, String cultureName) + public void ResourceManagerLookupStarted(string baseName, string mainAssemblyName, string cultureName) { WriteEvent(1, baseName, mainAssemblyName, cultureName); } [Event(2, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerLookingForResourceSet(String baseName, String mainAssemblyName, String cultureName) + public void ResourceManagerLookingForResourceSet(string baseName, string mainAssemblyName, string cultureName) { if (IsEnabled()) WriteEvent(2, baseName, mainAssemblyName, cultureName); } [Event(3, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerFoundResourceSetInCache(String baseName, String mainAssemblyName, String cultureName) + public void ResourceManagerFoundResourceSetInCache(string baseName, string mainAssemblyName, string cultureName) { if (IsEnabled()) WriteEvent(3, baseName, mainAssemblyName, cultureName); @@ -253,7 +253,7 @@ namespace System.Diagnostics.Tracing // the cache. This can happen if you have an assembly load callback that called into this // instance of the ResourceManager. [Event(4, Level = EventLevel.Warning, Keywords = Keywords.Loader)] - public void ResourceManagerFoundResourceSetInCacheUnexpected(String baseName, String mainAssemblyName, String cultureName) + public void ResourceManagerFoundResourceSetInCacheUnexpected(string baseName, string mainAssemblyName, string cultureName) { if (IsEnabled()) WriteEvent(4, baseName, mainAssemblyName, cultureName); @@ -261,7 +261,7 @@ namespace System.Diagnostics.Tracing // manifest resource stream lookup succeeded [Event(5, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerStreamFound(String baseName, String mainAssemblyName, String cultureName, String loadedAssemblyName, String resourceFileName) + public void ResourceManagerStreamFound(string baseName, string mainAssemblyName, string cultureName, string loadedAssemblyName, string resourceFileName) { if (IsEnabled()) WriteEvent(5, baseName, mainAssemblyName, cultureName, loadedAssemblyName, resourceFileName); @@ -269,35 +269,35 @@ namespace System.Diagnostics.Tracing // manifest resource stream lookup failed [Event(6, Level = EventLevel.Warning, Keywords = Keywords.Loader)] - public void ResourceManagerStreamNotFound(String baseName, String mainAssemblyName, String cultureName, String loadedAssemblyName, String resourceFileName) + public void ResourceManagerStreamNotFound(string baseName, string mainAssemblyName, string cultureName, string loadedAssemblyName, string resourceFileName) { if (IsEnabled()) WriteEvent(6, baseName, mainAssemblyName, cultureName, loadedAssemblyName, resourceFileName); } [Event(7, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerGetSatelliteAssemblySucceeded(String baseName, String mainAssemblyName, String cultureName, String assemblyName) + public void ResourceManagerGetSatelliteAssemblySucceeded(string baseName, string mainAssemblyName, string cultureName, string assemblyName) { if (IsEnabled()) WriteEvent(7, baseName, mainAssemblyName, cultureName, assemblyName); } [Event(8, Level = EventLevel.Warning, Keywords = Keywords.Loader)] - public void ResourceManagerGetSatelliteAssemblyFailed(String baseName, String mainAssemblyName, String cultureName, String assemblyName) + public void ResourceManagerGetSatelliteAssemblyFailed(string baseName, string mainAssemblyName, string cultureName, string assemblyName) { if (IsEnabled()) WriteEvent(8, baseName, mainAssemblyName, cultureName, assemblyName); } [Event(9, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerCaseInsensitiveResourceStreamLookupSucceeded(String baseName, String mainAssemblyName, String assemblyName, String resourceFileName) + public void ResourceManagerCaseInsensitiveResourceStreamLookupSucceeded(string baseName, string mainAssemblyName, string assemblyName, string resourceFileName) { if (IsEnabled()) WriteEvent(9, baseName, mainAssemblyName, assemblyName, resourceFileName); } [Event(10, Level = EventLevel.Warning, Keywords = Keywords.Loader)] - public void ResourceManagerCaseInsensitiveResourceStreamLookupFailed(String baseName, String mainAssemblyName, String assemblyName, String resourceFileName) + public void ResourceManagerCaseInsensitiveResourceStreamLookupFailed(string baseName, string mainAssemblyName, string assemblyName, string resourceFileName) { if (IsEnabled()) WriteEvent(10, baseName, mainAssemblyName, assemblyName, resourceFileName); @@ -305,7 +305,7 @@ namespace System.Diagnostics.Tracing // Could not access the manifest resource the assembly [Event(11, Level = EventLevel.Error, Keywords = Keywords.Loader)] - public void ResourceManagerManifestResourceAccessDenied(String baseName, String mainAssemblyName, String assemblyName, String canonicalName) + public void ResourceManagerManifestResourceAccessDenied(string baseName, string mainAssemblyName, string assemblyName, string canonicalName) { if (IsEnabled()) WriteEvent(11, baseName, mainAssemblyName, assemblyName, canonicalName); @@ -313,77 +313,77 @@ namespace System.Diagnostics.Tracing // Neutral resources are sufficient for this culture. Skipping satellites [Event(12, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerNeutralResourcesSufficient(String baseName, String mainAssemblyName, String cultureName) + public void ResourceManagerNeutralResourcesSufficient(string baseName, string mainAssemblyName, string cultureName) { if (IsEnabled()) WriteEvent(12, baseName, mainAssemblyName, cultureName); } [Event(13, Level = EventLevel.Warning, Keywords = Keywords.Loader)] - public void ResourceManagerNeutralResourceAttributeMissing(String mainAssemblyName) + public void ResourceManagerNeutralResourceAttributeMissing(string mainAssemblyName) { if (IsEnabled()) WriteEvent(13, mainAssemblyName); } [Event(14, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerCreatingResourceSet(String baseName, String mainAssemblyName, String cultureName, String fileName) + public void ResourceManagerCreatingResourceSet(string baseName, string mainAssemblyName, string cultureName, string fileName) { if (IsEnabled()) WriteEvent(14, baseName, mainAssemblyName, cultureName, fileName); } [Event(15, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerNotCreatingResourceSet(String baseName, String mainAssemblyName, String cultureName) + public void ResourceManagerNotCreatingResourceSet(string baseName, string mainAssemblyName, string cultureName) { if (IsEnabled()) WriteEvent(15, baseName, mainAssemblyName, cultureName); } [Event(16, Level = EventLevel.Warning, Keywords = Keywords.Loader)] - public void ResourceManagerLookupFailed(String baseName, String mainAssemblyName, String cultureName) + public void ResourceManagerLookupFailed(string baseName, string mainAssemblyName, string cultureName) { if (IsEnabled()) WriteEvent(16, baseName, mainAssemblyName, cultureName); } [Event(17, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerReleasingResources(String baseName, String mainAssemblyName) + public void ResourceManagerReleasingResources(string baseName, string mainAssemblyName) { if (IsEnabled()) WriteEvent(17, baseName, mainAssemblyName); } [Event(18, Level = EventLevel.Warning, Keywords = Keywords.Loader)] - public void ResourceManagerNeutralResourcesNotFound(String baseName, String mainAssemblyName, String resName) + public void ResourceManagerNeutralResourcesNotFound(string baseName, string mainAssemblyName, string resName) { if (IsEnabled()) WriteEvent(18, baseName, mainAssemblyName, resName); } [Event(19, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerNeutralResourcesFound(String baseName, String mainAssemblyName, String resName) + public void ResourceManagerNeutralResourcesFound(string baseName, string mainAssemblyName, string resName) { if (IsEnabled()) WriteEvent(19, baseName, mainAssemblyName, resName); } [Event(20, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerAddingCultureFromConfigFile(String baseName, String mainAssemblyName, String cultureName) + public void ResourceManagerAddingCultureFromConfigFile(string baseName, string mainAssemblyName, string cultureName) { if (IsEnabled()) WriteEvent(20, baseName, mainAssemblyName, cultureName); } [Event(21, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerCultureNotFoundInConfigFile(String baseName, String mainAssemblyName, String cultureName) + public void ResourceManagerCultureNotFoundInConfigFile(string baseName, string mainAssemblyName, string cultureName) { if (IsEnabled()) WriteEvent(21, baseName, mainAssemblyName, cultureName); } [Event(22, Level = EventLevel.Informational, Keywords = Keywords.Loader)] - public void ResourceManagerCultureFoundInConfigFile(String baseName, String mainAssemblyName, String cultureName) + public void ResourceManagerCultureFoundInConfigFile(string baseName, string mainAssemblyName, string cultureName) { if (IsEnabled()) WriteEvent(22, baseName, mainAssemblyName, cultureName); @@ -393,84 +393,84 @@ namespace System.Diagnostics.Tracing // ResourceManager Event Wrappers [NonEvent] - public void ResourceManagerLookupStarted(String baseName, Assembly mainAssembly, String cultureName) + public void ResourceManagerLookupStarted(string baseName, Assembly mainAssembly, string cultureName) { if (IsEnabled()) ResourceManagerLookupStarted(baseName, GetName(mainAssembly), cultureName); } [NonEvent] - public void ResourceManagerLookingForResourceSet(String baseName, Assembly mainAssembly, String cultureName) + public void ResourceManagerLookingForResourceSet(string baseName, Assembly mainAssembly, string cultureName) { if (IsEnabled()) ResourceManagerLookingForResourceSet(baseName, GetName(mainAssembly), cultureName); } [NonEvent] - public void ResourceManagerFoundResourceSetInCache(String baseName, Assembly mainAssembly, String cultureName) + public void ResourceManagerFoundResourceSetInCache(string baseName, Assembly mainAssembly, string cultureName) { if (IsEnabled()) ResourceManagerFoundResourceSetInCache(baseName, GetName(mainAssembly), cultureName); } [NonEvent] - public void ResourceManagerFoundResourceSetInCacheUnexpected(String baseName, Assembly mainAssembly, String cultureName) + public void ResourceManagerFoundResourceSetInCacheUnexpected(string baseName, Assembly mainAssembly, string cultureName) { if (IsEnabled()) ResourceManagerFoundResourceSetInCacheUnexpected(baseName, GetName(mainAssembly), cultureName); } [NonEvent] - public void ResourceManagerStreamFound(String baseName, Assembly mainAssembly, String cultureName, Assembly loadedAssembly, String resourceFileName) + public void ResourceManagerStreamFound(string baseName, Assembly mainAssembly, string cultureName, Assembly loadedAssembly, string resourceFileName) { if (IsEnabled()) ResourceManagerStreamFound(baseName, GetName(mainAssembly), cultureName, GetName(loadedAssembly), resourceFileName); } [NonEvent] - public void ResourceManagerStreamNotFound(String baseName, Assembly mainAssembly, String cultureName, Assembly loadedAssembly, String resourceFileName) + public void ResourceManagerStreamNotFound(string baseName, Assembly mainAssembly, string cultureName, Assembly loadedAssembly, string resourceFileName) { if (IsEnabled()) ResourceManagerStreamNotFound(baseName, GetName(mainAssembly), cultureName, GetName(loadedAssembly), resourceFileName); } [NonEvent] - public void ResourceManagerGetSatelliteAssemblySucceeded(String baseName, Assembly mainAssembly, String cultureName, String assemblyName) + public void ResourceManagerGetSatelliteAssemblySucceeded(string baseName, Assembly mainAssembly, string cultureName, string assemblyName) { if (IsEnabled()) ResourceManagerGetSatelliteAssemblySucceeded(baseName, GetName(mainAssembly), cultureName, assemblyName); } [NonEvent] - public void ResourceManagerGetSatelliteAssemblyFailed(String baseName, Assembly mainAssembly, String cultureName, String assemblyName) + public void ResourceManagerGetSatelliteAssemblyFailed(string baseName, Assembly mainAssembly, string cultureName, string assemblyName) { if (IsEnabled()) ResourceManagerGetSatelliteAssemblyFailed(baseName, GetName(mainAssembly), cultureName, assemblyName); } [NonEvent] - public void ResourceManagerCaseInsensitiveResourceStreamLookupSucceeded(String baseName, Assembly mainAssembly, String assemblyName, String resourceFileName) + public void ResourceManagerCaseInsensitiveResourceStreamLookupSucceeded(string baseName, Assembly mainAssembly, string assemblyName, string resourceFileName) { if (IsEnabled()) ResourceManagerCaseInsensitiveResourceStreamLookupSucceeded(baseName, GetName(mainAssembly), assemblyName, resourceFileName); } [NonEvent] - public void ResourceManagerCaseInsensitiveResourceStreamLookupFailed(String baseName, Assembly mainAssembly, String assemblyName, String resourceFileName) + public void ResourceManagerCaseInsensitiveResourceStreamLookupFailed(string baseName, Assembly mainAssembly, string assemblyName, string resourceFileName) { if (IsEnabled()) ResourceManagerCaseInsensitiveResourceStreamLookupFailed(baseName, GetName(mainAssembly), assemblyName, resourceFileName); } [NonEvent] - public void ResourceManagerManifestResourceAccessDenied(String baseName, Assembly mainAssembly, String assemblyName, String canonicalName) + public void ResourceManagerManifestResourceAccessDenied(string baseName, Assembly mainAssembly, string assemblyName, string canonicalName) { if (IsEnabled()) ResourceManagerManifestResourceAccessDenied(baseName, GetName(mainAssembly), assemblyName, canonicalName); } [NonEvent] - public void ResourceManagerNeutralResourcesSufficient(String baseName, Assembly mainAssembly, String cultureName) + public void ResourceManagerNeutralResourcesSufficient(string baseName, Assembly mainAssembly, string cultureName) { if (IsEnabled()) ResourceManagerNeutralResourcesSufficient(baseName, GetName(mainAssembly), cultureName); @@ -484,63 +484,63 @@ namespace System.Diagnostics.Tracing } [NonEvent] - public void ResourceManagerCreatingResourceSet(String baseName, Assembly mainAssembly, String cultureName, String fileName) + public void ResourceManagerCreatingResourceSet(string baseName, Assembly mainAssembly, string cultureName, string fileName) { if (IsEnabled()) ResourceManagerCreatingResourceSet(baseName, GetName(mainAssembly), cultureName, fileName); } [NonEvent] - public void ResourceManagerNotCreatingResourceSet(String baseName, Assembly mainAssembly, String cultureName) + public void ResourceManagerNotCreatingResourceSet(string baseName, Assembly mainAssembly, string cultureName) { if (IsEnabled()) ResourceManagerNotCreatingResourceSet(baseName, GetName(mainAssembly), cultureName); } [NonEvent] - public void ResourceManagerLookupFailed(String baseName, Assembly mainAssembly, String cultureName) + public void ResourceManagerLookupFailed(string baseName, Assembly mainAssembly, string cultureName) { if (IsEnabled()) ResourceManagerLookupFailed(baseName, GetName(mainAssembly), cultureName); } [NonEvent] - public void ResourceManagerReleasingResources(String baseName, Assembly mainAssembly) + public void ResourceManagerReleasingResources(string baseName, Assembly mainAssembly) { if (IsEnabled()) ResourceManagerReleasingResources(baseName, GetName(mainAssembly)); } [NonEvent] - public void ResourceManagerNeutralResourcesNotFound(String baseName, Assembly mainAssembly, String resName) + public void ResourceManagerNeutralResourcesNotFound(string baseName, Assembly mainAssembly, string resName) { if (IsEnabled()) ResourceManagerNeutralResourcesNotFound(baseName, GetName(mainAssembly), resName); } [NonEvent] - public void ResourceManagerNeutralResourcesFound(String baseName, Assembly mainAssembly, String resName) + public void ResourceManagerNeutralResourcesFound(string baseName, Assembly mainAssembly, string resName) { if (IsEnabled()) ResourceManagerNeutralResourcesFound(baseName, GetName(mainAssembly), resName); } [NonEvent] - public void ResourceManagerAddingCultureFromConfigFile(String baseName, Assembly mainAssembly, String cultureName) + public void ResourceManagerAddingCultureFromConfigFile(string baseName, Assembly mainAssembly, string cultureName) { if (IsEnabled()) ResourceManagerAddingCultureFromConfigFile(baseName, GetName(mainAssembly), cultureName); } [NonEvent] - public void ResourceManagerCultureNotFoundInConfigFile(String baseName, Assembly mainAssembly, String cultureName) + public void ResourceManagerCultureNotFoundInConfigFile(string baseName, Assembly mainAssembly, string cultureName) { if (IsEnabled()) ResourceManagerCultureNotFoundInConfigFile(baseName, GetName(mainAssembly), cultureName); } [NonEvent] - public void ResourceManagerCultureFoundInConfigFile(String baseName, Assembly mainAssembly, String cultureName) + public void ResourceManagerCultureFoundInConfigFile(string baseName, Assembly mainAssembly, string cultureName) { if (IsEnabled()) ResourceManagerCultureFoundInConfigFile(baseName, GetName(mainAssembly), cultureName); diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/XplatEventLogger.cs b/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/XplatEventLogger.cs index 31f79f5218..31cfb50876 100644 --- a/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/XplatEventLogger.cs +++ b/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/XplatEventLogger.cs @@ -71,10 +71,10 @@ namespace System.Diagnostics.Tracing private static string Serialize(ReadOnlyCollection<string> payloadName, ReadOnlyCollection<object> payload, string eventMessage) { if (payloadName == null || payload == null ) - return String.Empty; + return string.Empty; if (payloadName.Count == 0 || payload.Count == 0) - return String.Empty; + return string.Empty; int eventDataCount = payloadName.Count; @@ -157,7 +157,7 @@ namespace System.Diagnostics.Tracing internal protected override void OnEventSourceCreated(EventSource eventSource) { string eventSourceFilter = eventSourceNameFilter.Value; - if (String.IsNullOrEmpty(eventSourceFilter) || (eventSource.Name.IndexOf(eventSourceFilter, StringComparison.OrdinalIgnoreCase) >= 0)) + if (string.IsNullOrEmpty(eventSourceFilter) || (eventSource.Name.IndexOf(eventSourceFilter, StringComparison.OrdinalIgnoreCase) >= 0)) { EnableEvents(eventSource, EventLevel.LogAlways, EventKeywords.All, null); } @@ -166,7 +166,7 @@ namespace System.Diagnostics.Tracing internal protected override void OnEventWritten(EventWrittenEventArgs eventData) { string eventFilter = eventSourceEventFilter.Value; - if (String.IsNullOrEmpty(eventFilter) || (eventData.EventName.IndexOf(eventFilter, StringComparison.OrdinalIgnoreCase) >= 0)) + if (string.IsNullOrEmpty(eventFilter) || (eventData.EventName.IndexOf(eventFilter, StringComparison.OrdinalIgnoreCase) >= 0)) { LogOnEventWritten(eventData); } diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs b/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs index c5a07a2c53..e8d7ef5400 100644 --- a/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs +++ b/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs @@ -30,7 +30,7 @@ namespace System.Diagnostics #pragma warning disable 414 // dynamicMethods is an array of System.Resolver objects, used to keep // DynamicMethodDescs alive for the lifetime of StackFrameHelper. - private Object dynamicMethods; // Field is not used from managed. + private object dynamicMethods; // Field is not used from managed. private IntPtr[] rgMethodHandle; private string[] rgAssemblyPath; diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/ISymWriter.cs b/src/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/ISymWriter.cs index fa2a59797a..31f81e1bed 100644 --- a/src/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/ISymWriter.cs +++ b/src/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/ISymWriter.cs @@ -26,7 +26,7 @@ namespace System.Diagnostics.SymbolStore // Define a source document. Guid's will be provided for the // languages, vendors, and document types that we currently know // about. - ISymbolDocumentWriter DefineDocument(String url, + ISymbolDocumentWriter DefineDocument(string url, Guid language, Guid languageVendor, Guid documentType); @@ -86,7 +86,7 @@ namespace System.Diagnostics.SymbolStore // variable of the same name that has multiple homes throughout a // scope. (Note: start/end offsets must not overlap in such a // case.) - void DefineLocalVariable(String name, + void DefineLocalVariable(string name, FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, @@ -99,13 +99,13 @@ namespace System.Diagnostics.SymbolStore // Defines a custom attribute based upon its name. Not to be // confused with Metadata custom attributes, these attributes are // held in the symbol store. - void SetSymAttribute(SymbolToken parent, String name, byte[] data); + void SetSymAttribute(SymbolToken parent, string name, byte[] data); // Specifies that the given, fully qualified namespace name is // being used within the currently open lexical scope. Closing the // current scope will also stop using the namespace, and the // namespace will be in use in all scopes that inherit from the // currently open scope. - void UsingNamespace(String fullName); + void UsingNamespace(string fullName); } } diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/Token.cs b/src/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/Token.cs index a6e6fdc0ef..238e3a524d 100644 --- a/src/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/Token.cs +++ b/src/System.Private.CoreLib/src/System/Diagnostics/SymbolStore/Token.cs @@ -25,7 +25,7 @@ namespace System.Diagnostics.SymbolStore public override int GetHashCode() { return m_token; } - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (obj is SymbolToken) return Equals((SymbolToken)obj); diff --git a/src/System.Private.CoreLib/src/System/Enum.cs b/src/System.Private.CoreLib/src/System/Enum.cs index c837437a10..505c5acdfb 100644 --- a/src/System.Private.CoreLib/src/System/Enum.cs +++ b/src/System.Private.CoreLib/src/System/Enum.cs @@ -31,7 +31,7 @@ namespace System { #region Private Constants private const char enumSeparatorChar = ','; - private const String enumSeparatorString = ", "; + private const string enumSeparatorString = ", "; #endregion #region Private Static Methods @@ -42,7 +42,7 @@ namespace System if (entry == null || (getNames && entry.Names == null)) { ulong[] values = null; - String[] names = null; + string[] names = null; bool isFlags = enumType.IsDefined(typeof(System.FlagsAttribute), false); GetEnumValuesAndNames( @@ -58,7 +58,7 @@ namespace System return entry; } - private unsafe String InternalFormattedHexString() + private unsafe string InternalFormattedHexString() { fixed (void* pValue = &JitHelpers.GetPinningHelper(this).m_data) { @@ -86,7 +86,7 @@ namespace System } } - private static String InternalFormattedHexString(object value) + private static string InternalFormattedHexString(object value) { TypeCode typeCode = Convert.GetTypeCode(value); @@ -100,26 +100,26 @@ namespace System // direct cast from bool to byte is not allowed return Convert.ToByte((bool)value).ToString("X2", null); case TypeCode.Int16: - return ((UInt16)(Int16)value).ToString("X4", null); + return ((ushort)(short)value).ToString("X4", null); case TypeCode.UInt16: - return ((UInt16)value).ToString("X4", null); + return ((ushort)value).ToString("X4", null); case TypeCode.Char: - return ((UInt16)(Char)value).ToString("X4", null); + return ((ushort)(char)value).ToString("X4", null); case TypeCode.UInt32: - return ((UInt32)value).ToString("X8", null); + return ((uint)value).ToString("X8", null); case TypeCode.Int32: - return ((UInt32)(Int32)value).ToString("X8", null); + return ((uint)(int)value).ToString("X8", null); case TypeCode.UInt64: - return ((UInt64)value).ToString("X16", null); + return ((ulong)value).ToString("X16", null); case TypeCode.Int64: - return ((UInt64)(Int64)value).ToString("X16", null); + return ((ulong)(long)value).ToString("X16", null); // All unsigned types will be directly cast default: throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType); } } - internal static String GetEnumName(RuntimeType eT, ulong ulValue) + internal static string GetEnumName(RuntimeType eT, ulong ulValue) { Debug.Assert(eT != null); ulong[] ulValues = Enum.InternalGetValues(eT); @@ -134,7 +134,7 @@ namespace System return null; // return null so the caller knows to .ToString() the input } - private static String InternalFormat(RuntimeType eT, ulong value) + private static string InternalFormat(RuntimeType eT, ulong value) { Debug.Assert(eT != null); @@ -151,7 +151,7 @@ namespace System } } - private static String InternalFlagsFormat(RuntimeType eT, ulong result) + private static string InternalFlagsFormat(RuntimeType eT, ulong result) { // These values are sorted by value. Don't change this TypeValuesAndNames entry = GetCachedValuesAndNames(eT, true); @@ -159,11 +159,11 @@ namespace System return InternalFlagsFormat(eT, entry, result); } - private static String InternalFlagsFormat(RuntimeType eT, TypeValuesAndNames entry, ulong result) + private static string InternalFlagsFormat(RuntimeType eT, TypeValuesAndNames entry, ulong result) { Debug.Assert(eT != null); - String[] names = entry.Names; + string[] names = entry.Names; ulong[] values = entry.Values; Debug.Assert(names.Length == values.Length); @@ -220,7 +220,7 @@ namespace System return returnString; } - internal static ulong ToUInt64(Object value) + internal static ulong ToUInt64(object value) { // Helper function to silently convert the value to UInt64 from the other base types for enum without throwing an exception. // This is need since the Convert functions do overflow checks. @@ -240,16 +240,16 @@ namespace System result = Convert.ToByte((bool)value); break; case TypeCode.Int16: - result = (ulong)(Int16)value; + result = (ulong)(short)value; break; case TypeCode.UInt16: - result = (UInt16)value; + result = (ushort)value; break; case TypeCode.Char: - result = (UInt16)(Char)value; + result = (ushort)(char)value; break; case TypeCode.UInt32: - result = (UInt32)value; + result = (uint)value; break; case TypeCode.Int32: result = (ulong)(int)value; @@ -258,7 +258,7 @@ namespace System result = (ulong)value; break; case TypeCode.Int64: - result = (ulong)(Int64)value; + result = (ulong)(long)value; break; // All unsigned types will be directly cast default: @@ -269,7 +269,7 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern int InternalCompareTo(Object o1, Object o2); + private static extern int InternalCompareTo(object o1, object o2); [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern RuntimeType InternalGetUnderlyingType(RuntimeType enumType); @@ -278,7 +278,7 @@ namespace System private static extern void GetEnumValuesAndNames(RuntimeTypeHandle enumType, ObjectHandleOnStack values, ObjectHandleOnStack names, bool getNames); [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern Object InternalBoxEnum(RuntimeType enumType, long value); + private static extern object InternalBoxEnum(RuntimeType enumType, long value); #endregion #region Public Static Methods @@ -345,12 +345,12 @@ namespace System } } - public static bool TryParse(Type enumType, String value, out Object result) + public static bool TryParse(Type enumType, string value, out object result) { return TryParse(enumType, value, false, out result); } - public static bool TryParse(Type enumType, String value, bool ignoreCase, out Object result) + public static bool TryParse(Type enumType, string value, bool ignoreCase, out object result) { result = null; EnumResult parseResult = new EnumResult(); @@ -361,12 +361,12 @@ namespace System return retValue; } - public static bool TryParse<TEnum>(String value, out TEnum result) where TEnum : struct + public static bool TryParse<TEnum>(string value, out TEnum result) where TEnum : struct { return TryParse(value, false, out result); } - public static bool TryParse<TEnum>(String value, bool ignoreCase, out TEnum result) where TEnum : struct + public static bool TryParse<TEnum>(string value, bool ignoreCase, out TEnum result) where TEnum : struct { result = default; EnumResult parseResult = new EnumResult(); @@ -377,12 +377,12 @@ namespace System return retValue; } - public static Object Parse(Type enumType, String value) + public static object Parse(Type enumType, string value) { return Parse(enumType, value, false); } - public static Object Parse(Type enumType, String value, bool ignoreCase) + public static object Parse(Type enumType, string value, bool ignoreCase) { EnumResult parseResult = new EnumResult() { canThrow = true }; if (TryParseEnum(enumType, value, ignoreCase, ref parseResult)) @@ -391,12 +391,12 @@ namespace System throw parseResult.GetEnumParseException(); } - public static TEnum Parse<TEnum>(String value) where TEnum : struct + public static TEnum Parse<TEnum>(string value) where TEnum : struct { return Parse<TEnum>(value, false); } - public static TEnum Parse<TEnum>(String value, bool ignoreCase) where TEnum : struct + public static TEnum Parse<TEnum>(string value, bool ignoreCase) where TEnum : struct { EnumResult parseResult = new EnumResult() { canThrow = true }; if (TryParseEnum(typeof(TEnum), value, ignoreCase, ref parseResult)) @@ -405,7 +405,7 @@ namespace System throw parseResult.GetEnumParseException(); } - private static bool TryParseEnum(Type enumType, String value, bool ignoreCase, ref EnumResult parseResult) + private static bool TryParseEnum(Type enumType, string value, bool ignoreCase, ref EnumResult parseResult) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -426,7 +426,7 @@ namespace System int firstNonWhitespaceIndex = -1; for (int i = 0; i < value.Length; i++) { - if (!Char.IsWhiteSpace(value[i])) + if (!char.IsWhiteSpace(value[i])) { firstNonWhitespaceIndex = i; break; @@ -443,10 +443,10 @@ namespace System ulong result = 0; char firstNonWhitespaceChar = value[firstNonWhitespaceIndex]; - if (Char.IsDigit(firstNonWhitespaceChar) || firstNonWhitespaceChar == '-' || firstNonWhitespaceChar == '+') + if (char.IsDigit(firstNonWhitespaceChar) || firstNonWhitespaceChar == '-' || firstNonWhitespaceChar == '+') { Type underlyingType = GetUnderlyingType(enumType); - Object temp; + object temp; try { @@ -475,7 +475,7 @@ namespace System // Find the field. Let's assume that these are always static classes // because the class is an enum. TypeValuesAndNames entry = GetCachedValuesAndNames(rtType, true); - String[] enumNames = entry.Names; + string[] enumNames = entry.Names; ulong[] enumValues = entry.Values; StringComparison comparison = ignoreCase ? @@ -494,8 +494,8 @@ namespace System // Shift the starting and ending indices to eliminate whitespace int endIndexNoWhitespace = endIndex; - while (valueIndex < endIndex && Char.IsWhiteSpace(value[valueIndex])) valueIndex++; - while (endIndexNoWhitespace > valueIndex && Char.IsWhiteSpace(value[endIndexNoWhitespace - 1])) endIndexNoWhitespace--; + while (valueIndex < endIndex && char.IsWhiteSpace(value[valueIndex])) valueIndex++; + while (endIndexNoWhitespace > valueIndex && char.IsWhiteSpace(value[endIndexNoWhitespace - 1])) endIndexNoWhitespace--; int valueSubstringLength = endIndexNoWhitespace - valueIndex; // Try to match this substring against each enum name @@ -562,7 +562,7 @@ namespace System return GetCachedValuesAndNames(enumType, false).Values; } - public static String GetName(Type enumType, Object value) + public static string GetName(Type enumType, object value) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -570,7 +570,7 @@ namespace System return enumType.GetEnumName(value); } - public static String[] GetNames(Type enumType) + public static string[] GetNames(Type enumType) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -578,13 +578,13 @@ namespace System return enumType.GetEnumNames(); } - internal static String[] InternalGetNames(RuntimeType enumType) + internal static string[] InternalGetNames(RuntimeType enumType) { // Get all of the names return GetCachedValuesAndNames(enumType, true).Names; } - public static Object ToObject(Type enumType, Object value) + public static object ToObject(Type enumType, object value) { if (value == null) throw new ArgumentNullException(nameof(value)); @@ -630,7 +630,7 @@ namespace System } } - public static bool IsDefined(Type enumType, Object value) + public static bool IsDefined(Type enumType, object value) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -638,7 +638,7 @@ namespace System return enumType.IsEnumDefined(value); } - public static String Format(Type enumType, Object value, String format) + public static string Format(Type enumType, object value, string format) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -707,7 +707,7 @@ namespace System private class TypeValuesAndNames { // Each entry contains a list of sorted pair of enum field names and values, sorted by values - public TypeValuesAndNames(bool isFlag, ulong[] values, String[] names) + public TypeValuesAndNames(bool isFlag, ulong[] values, string[] names) { this.IsFlag = isFlag; this.Values = values; @@ -716,12 +716,12 @@ namespace System public bool IsFlag; public ulong[] Values; - public String[] Names; + public string[] Names; } #endregion #region Private Methods - internal unsafe Object GetValue() + internal unsafe object GetValue() { fixed (void* pValue = &JitHelpers.GetPinningHelper(this).m_data) { @@ -824,7 +824,7 @@ namespace System #region Object Overrides [MethodImplAttribute(MethodImplOptions.InternalCall)] - public extern override bool Equals(Object obj); + public extern override bool Equals(object obj); public override unsafe int GetHashCode() { @@ -871,7 +871,7 @@ namespace System } } - public override String ToString() + public override string ToString() { // Returns the value in a human readable format. For PASCAL style enums who's value maps directly the name of the field is returned. // For PASCAL style enums who's values do not map directly the decimal value of the field is returned. @@ -887,14 +887,14 @@ namespace System #region IFormattable [Obsolete("The provider argument is not used. Please use ToString(String).")] - public String ToString(String format, IFormatProvider provider) + public string ToString(string format, IFormatProvider provider) { return ToString(format); } #endregion #region IComparable - public int CompareTo(Object target) + public int CompareTo(object target) { const int retIncompatibleMethodTables = 2; // indicates that the method tables did not match const int retInvalidEnumType = 3; // indicates that the enum was of an unknown/unsupported underlying type @@ -927,7 +927,7 @@ namespace System #endregion #region Public Methods - public String ToString(String format) + public string ToString(string format) { char formatCh; if (format == null || format.Length == 0) @@ -953,13 +953,13 @@ namespace System } [Obsolete("The provider argument is not used. Please use ToString().")] - public String ToString(IFormatProvider provider) + public string ToString(IFormatProvider provider) { return ToString(); } [Intrinsic] - public Boolean HasFlag(Enum flag) + public bool HasFlag(Enum flag) { if (flag == null) throw new ArgumentNullException(nameof(flag)); @@ -1064,7 +1064,7 @@ namespace System return Convert.ToDouble(GetValue(), CultureInfo.CurrentCulture); } - Decimal IConvertible.ToDecimal(IFormatProvider provider) + decimal IConvertible.ToDecimal(IFormatProvider provider) { return Convert.ToDecimal(GetValue(), CultureInfo.CurrentCulture); } @@ -1074,7 +1074,7 @@ namespace System throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Enum", "DateTime")); } - Object IConvertible.ToType(Type type, IFormatProvider provider) + object IConvertible.ToType(Type type, IFormatProvider provider) { return Convert.DefaultToType((IConvertible)this, type, provider); } @@ -1082,7 +1082,7 @@ namespace System #region ToObject [CLSCompliant(false)] - public static Object ToObject(Type enumType, sbyte value) + public static object ToObject(Type enumType, sbyte value) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -1094,7 +1094,7 @@ namespace System return InternalBoxEnum(rtType, value); } - public static Object ToObject(Type enumType, short value) + public static object ToObject(Type enumType, short value) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -1106,7 +1106,7 @@ namespace System return InternalBoxEnum(rtType, value); } - public static Object ToObject(Type enumType, int value) + public static object ToObject(Type enumType, int value) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -1118,7 +1118,7 @@ namespace System return InternalBoxEnum(rtType, value); } - public static Object ToObject(Type enumType, byte value) + public static object ToObject(Type enumType, byte value) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -1131,7 +1131,7 @@ namespace System } [CLSCompliant(false)] - public static Object ToObject(Type enumType, ushort value) + public static object ToObject(Type enumType, ushort value) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -1144,7 +1144,7 @@ namespace System } [CLSCompliant(false)] - public static Object ToObject(Type enumType, uint value) + public static object ToObject(Type enumType, uint value) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -1156,7 +1156,7 @@ namespace System return InternalBoxEnum(rtType, value); } - public static Object ToObject(Type enumType, long value) + public static object ToObject(Type enumType, long value) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -1169,7 +1169,7 @@ namespace System } [CLSCompliant(false)] - public static Object ToObject(Type enumType, ulong value) + public static object ToObject(Type enumType, ulong value) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -1181,7 +1181,7 @@ namespace System return InternalBoxEnum(rtType, unchecked((long)value)); } - private static Object ToObject(Type enumType, char value) + private static object ToObject(Type enumType, char value) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); @@ -1193,7 +1193,7 @@ namespace System return InternalBoxEnum(rtType, value); } - private static Object ToObject(Type enumType, bool value) + private static object ToObject(Type enumType, bool value) { if (enumType == null) throw new ArgumentNullException(nameof(enumType)); diff --git a/src/System.Private.CoreLib/src/System/Environment.cs b/src/System.Private.CoreLib/src/System/Environment.cs index 902c6769ac..bfd9e06e12 100644 --- a/src/System.Private.CoreLib/src/System/Environment.cs +++ b/src/System.Private.CoreLib/src/System/Environment.cs @@ -57,7 +57,7 @@ namespace System // if you change this method's signature then you must change the code that calls it // in excep.cpp and probably you will have to visit mscorlib.h to add the new signature // as well as metasig.h to create the new signature type - internal static String GetResourceStringLocal(String key) + internal static string GetResourceStringLocal(string key) { return SR.GetResourceString(key); } @@ -97,7 +97,7 @@ namespace System // to assign blame for crashes. Don't mess with this, such as by making it call // another managed helper method, unless you consult with some CLR Watson experts. [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern void FailFast(String message); + public static extern void FailFast(string message); // This overload of FailFast will allow you to specify the exception object // whose bucket details *could* be used when undergoing the failfast process. @@ -113,14 +113,14 @@ namespace System // IP for bucketing. If the exception object is not preallocated, it will use the bucket // details contained in the object (if any). [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern void FailFast(String message, Exception exception); + public static extern void FailFast(string message, Exception exception); [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern void FailFast(String message, Exception exception, String errorMessage); + public static extern void FailFast(string message, Exception exception, string errorMessage); #if FEATURE_WIN32_REGISTRY // This is only used by RegistryKey on Windows. - public static String ExpandEnvironmentVariables(String name) + public static string ExpandEnvironmentVariables(string name) { if (name == null) throw new ArgumentNullException(nameof(name)); @@ -156,7 +156,7 @@ namespace System #endif // FEATURE_WIN32_REGISTRY [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - private static extern Int32 GetProcessorCount(); + private static extern int GetProcessorCount(); public static int ProcessorCount { @@ -173,7 +173,7 @@ namespace System **Arguments: None **Exceptions: None. ==============================================================================*/ - public static String[] GetCommandLineArgs() + public static string[] GetCommandLineArgs() { /* * There are multiple entry points to a hosted app. @@ -195,7 +195,7 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern String[] GetCommandLineArgsNative(); + private static extern string[] GetCommandLineArgsNative(); private static string[] s_CommandLineArgs = null; private static void SetCommandLineArgs(string[] cmdLineArgs) @@ -251,7 +251,7 @@ namespace System **Arguments: None. **Exceptions: None. ==============================================================================*/ - public static String NewLine + public static string NewLine { get { @@ -321,7 +321,7 @@ namespace System **Arguments: **Exceptions: ==============================================================================*/ - public static String StackTrace + public static string StackTrace { [MethodImpl(MethodImplOptions.NoInlining)] // Prevent inlining from affecting where the stacktrace starts get @@ -330,7 +330,7 @@ namespace System } } - internal static String GetStackTrace(Exception e, bool needFileInfo) + internal static string GetStackTrace(Exception e, bool needFileInfo) { // Note: Setting needFileInfo to true will start up COM and set our // apartment state. Try to not call this when passing "true" diff --git a/src/System.Private.CoreLib/src/System/Exception.cs b/src/System.Private.CoreLib/src/System/Exception.cs index 3ba1fdc7e8..b451000421 100644 --- a/src/System.Private.CoreLib/src/System/Exception.cs +++ b/src/System.Private.CoreLib/src/System/Exception.cs @@ -51,7 +51,7 @@ namespace System Init(); } - public Exception(String message) + public Exception(string message) { Init(); _message = message; @@ -62,7 +62,7 @@ namespace System // Note: the stack trace is not started until the exception // is thrown // - public Exception(String message, Exception innerException) + public Exception(string message, Exception innerException) { Init(); _message = message; @@ -92,7 +92,7 @@ namespace System // We use the no throw version since we could be deserializing a pre-V4 // exception object that may not have this entry. In such a case, we would // get null. - _watsonBuckets = (Object)info.GetValueNoThrow("WatsonBuckets", typeof(byte[])); // Do not rename (binary serialization) + _watsonBuckets = (object)info.GetValueNoThrow("WatsonBuckets", typeof(byte[])); // Do not rename (binary serialization) if (_className == null || HResult == 0) @@ -118,7 +118,7 @@ namespace System } - public virtual String Message + public virtual string Message { get { @@ -257,7 +257,7 @@ namespace System [MethodImplAttribute(MethodImplOptions.InternalCall)] - static private extern IRuntimeMethodInfo GetMethodFromStackTrace(Object stackTrace); + static private extern IRuntimeMethodInfo GetMethodFromStackTrace(object stackTrace); private MethodBase GetExceptionMethodFromStackTrace() { @@ -297,7 +297,7 @@ namespace System // Returns the stack trace as a string. If no stack trace is // available, null is returned. - public virtual String StackTrace + public virtual string StackTrace { get { @@ -330,7 +330,7 @@ namespace System // will add the path to the source file if the PDB is present and a demand // for FileIOPermission(PathDiscovery) succeeds, we need to make sure we // don't store the stack trace string in the _stackTraceString member variable. - String tempStackTraceString = Environment.GetStackTrace(this, needFileInfo); + string tempStackTraceString = Environment.GetStackTrace(this, needFileInfo); return remoteStackTraceString + tempStackTraceString; } @@ -338,7 +338,7 @@ namespace System // This should be in a URL/URN form, such as: // "file:///C:/Applications/Bazzal/help.html#ErrorNum42" // Changed to be a read-write String and not return an exception - public virtual String HelpLink + public virtual string HelpLink { get { @@ -350,7 +350,7 @@ namespace System } } - public virtual String Source + public virtual string Source { get { @@ -384,15 +384,15 @@ namespace System set { _source = value; } } - public override String ToString() + public override string ToString() { return ToString(true, true); } - private String ToString(bool needFileLineInfo, bool needMessage) + private string ToString(bool needFileLineInfo, bool needMessage) { - String message = (needMessage ? Message : null); - String s; + string message = (needMessage ? Message : null); + string s; if (message == null || message.Length <= 0) { @@ -431,7 +431,7 @@ namespace System throw new ArgumentNullException(nameof(info)); } - String tempStackTraceString = _stackTraceString; + string tempStackTraceString = _stackTraceString; if (_stackTrace != null) { @@ -450,17 +450,17 @@ namespace System _source = Source; // Set the Source information correctly before serialization } - info.AddValue("ClassName", GetClassName(), typeof(String)); // Do not rename (binary serialization) - info.AddValue("Message", _message, typeof(String)); // Do not rename (binary serialization) + info.AddValue("ClassName", GetClassName(), typeof(string)); // Do not rename (binary serialization) + info.AddValue("Message", _message, typeof(string)); // Do not rename (binary serialization) info.AddValue("Data", _data, typeof(IDictionary)); // Do not rename (binary serialization) info.AddValue("InnerException", _innerException, typeof(Exception)); // Do not rename (binary serialization) - info.AddValue("HelpURL", _helpURL, typeof(String)); // Do not rename (binary serialization) - info.AddValue("StackTraceString", tempStackTraceString, typeof(String)); // Do not rename (binary serialization) - info.AddValue("RemoteStackTraceString", _remoteStackTraceString, typeof(String)); // Do not rename (binary serialization) - info.AddValue("RemoteStackIndex", _remoteStackIndex, typeof(Int32)); // Do not rename (binary serialization) - info.AddValue("ExceptionMethod", null, typeof(String)); // Do not rename (binary serialization) + info.AddValue("HelpURL", _helpURL, typeof(string)); // Do not rename (binary serialization) + info.AddValue("StackTraceString", tempStackTraceString, typeof(string)); // Do not rename (binary serialization) + info.AddValue("RemoteStackTraceString", _remoteStackTraceString, typeof(string)); // Do not rename (binary serialization) + info.AddValue("RemoteStackIndex", _remoteStackIndex, typeof(int)); // Do not rename (binary serialization) + info.AddValue("ExceptionMethod", null, typeof(string)); // Do not rename (binary serialization) info.AddValue("HResult", HResult); // Do not rename (binary serialization) - info.AddValue("Source", _source, typeof(String)); // Do not rename (binary serialization) + info.AddValue("Source", _source, typeof(string)); // Do not rename (binary serialization) // Serialize the Watson bucket details as well info.AddValue("WatsonBuckets", _watsonBuckets, typeof(byte[])); // Do not rename (binary serialization) @@ -645,24 +645,24 @@ namespace System } } - private String _className; //Needed for serialization. + private string _className; //Needed for serialization. private MethodBase _exceptionMethod; //Needed for serialization. - internal String _message; + internal string _message; private IDictionary _data; private Exception _innerException; - private String _helpURL; - private Object _stackTrace; + private string _helpURL; + private object _stackTrace; [OptionalField] // This isnt present in pre-V4 exception objects that would be serialized. - private Object _watsonBuckets; - private String _stackTraceString; //Needed for serialization. - private String _remoteStackTraceString; + private object _watsonBuckets; + private string _stackTraceString; //Needed for serialization. + private string _remoteStackTraceString; private int _remoteStackIndex; #pragma warning disable 414 // Field is not used from managed. // _dynamicMethods is an array of System.Resolver objects, used to keep // DynamicMethodDescs alive for the lifetime of the exception. We do this because // the _stackTrace field holds MethodDescs, and a DynamicMethodDesc can be destroyed // unless a System.Resolver object roots it. - private Object _dynamicMethods; + private object _dynamicMethods; #pragma warning restore 414 // @MANAGED: HResult is used from within the EE! Rename with care - check VM directory @@ -680,7 +680,7 @@ namespace System } } - private String _source; // Mainly used by VB. + private string _source; // Mainly used by VB. // WARNING: Don't delete/rename _xptrs and _xcode - used by functions // on Marshal class. Native functions are in COMUtilNative.cpp & AppDomain private IntPtr _xptrs; // Internal EE stuff @@ -696,7 +696,7 @@ namespace System // InternalToString is called by the runtime to get the exception text // and create a corresponding CrossAppDomainMarshaledException - internal virtual String InternalToString() + internal virtual string InternalToString() { // Get the current stack trace string. return ToString(true, true); @@ -737,7 +737,7 @@ namespace System } // See comment on ExceptionMessageKind - internal static String GetMessageFromNativeResources(ExceptionMessageKind kind) + internal static string GetMessageFromNativeResources(ExceptionMessageKind kind) { string retMesg = null; GetMessageFromNativeResources(kind, JitHelpers.GetStringHandleOnStack(ref retMesg)); @@ -757,7 +757,7 @@ namespace System internal sealed class CrossAppDomainMarshaledException : SystemException { - public CrossAppDomainMarshaledException(String message, int errorCode) + public CrossAppDomainMarshaledException(string message, int errorCode) : base(message) { HResult = errorCode; @@ -766,7 +766,7 @@ namespace System // Normally, only Telesto's UEF will see these exceptions. // This override prints out the original Exception's ToString() // output and hides the fact that it is wrapped inside another excepton. - internal override String InternalToString() + internal override string InternalToString() { return Message; } diff --git a/src/System.Private.CoreLib/src/System/GC.cs b/src/System.Private.CoreLib/src/System/GC.cs index dd75601a5c..aac612a63a 100644 --- a/src/System.Private.CoreLib/src/System/GC.cs +++ b/src/System.Private.CoreLib/src/System/GC.cs @@ -105,10 +105,10 @@ namespace System internal static extern bool IsServerGC(); [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - private static extern void _AddMemoryPressure(UInt64 bytesAllocated); + private static extern void _AddMemoryPressure(ulong bytesAllocated); [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - private static extern void _RemoveMemoryPressure(UInt64 bytesAllocated); + private static extern void _RemoveMemoryPressure(ulong bytesAllocated); public static void AddMemoryPressure(long bytesAllocated) { @@ -118,7 +118,7 @@ namespace System SR.ArgumentOutOfRange_NeedPosNum); } - if ((4 == IntPtr.Size) && (bytesAllocated > Int32.MaxValue)) + if ((4 == IntPtr.Size) && (bytesAllocated > int.MaxValue)) { throw new ArgumentOutOfRangeException("pressure", SR.ArgumentOutOfRange_MustBeNonNegInt32); @@ -135,7 +135,7 @@ namespace System SR.ArgumentOutOfRange_NeedPosNum); } - if ((4 == IntPtr.Size) && (bytesAllocated > Int32.MaxValue)) + if ((4 == IntPtr.Size) && (bytesAllocated > int.MaxValue)) { throw new ArgumentOutOfRangeException(nameof(bytesAllocated), SR.ArgumentOutOfRange_MustBeNonNegInt32); @@ -148,7 +148,7 @@ namespace System // Returns the generation that obj is currently in. // [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern int GetGeneration(Object obj); + public static extern int GetGeneration(object obj); // Forces a collection of all generations from 0 through Generation. @@ -256,7 +256,7 @@ namespace System // If we insert a call to GC.KeepAlive(this) at the end of Problem(), then // Foo doesn't get finalized and the stream stays open. [MethodImplAttribute(MethodImplOptions.NoInlining)] // disable optimizations - public static void KeepAlive(Object obj) + public static void KeepAlive(object obj) { } @@ -288,9 +288,9 @@ namespace System // Indicates that the system should not call the Finalize() method on // an object that would normally require this call. [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void _SuppressFinalize(Object o); + private static extern void _SuppressFinalize(object o); - public static void SuppressFinalize(Object obj) + public static void SuppressFinalize(object obj) { if (obj == null) throw new ArgumentNullException(nameof(obj)); @@ -302,9 +302,9 @@ namespace System // where calling ReRegisterForFinalize is useful is inside a finalizer that // needs to resurrect itself or an object that it references. [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void _ReRegisterForFinalize(Object o); + private static extern void _ReRegisterForFinalize(object o); - public static void ReRegisterForFinalize(Object obj) + public static void ReRegisterForFinalize(object obj) { if (obj == null) throw new ArgumentNullException(nameof(obj)); diff --git a/src/System.Private.CoreLib/src/System/Globalization/CultureInfo.Windows.cs b/src/System.Private.CoreLib/src/System/Globalization/CultureInfo.Windows.cs index 79863c98c6..107a08cf07 100644 --- a/src/System.Private.CoreLib/src/System/Globalization/CultureInfo.Windows.cs +++ b/src/System.Private.CoreLib/src/System/Globalization/CultureInfo.Windows.cs @@ -93,7 +93,7 @@ namespace System.Globalization index++; } - CultureInfo temp = GetCultureByName(new String(languages, 0, index), true); + CultureInfo temp = GetCultureByName(new string(languages, 0, index), true); temp._isReadOnly = true; return temp; } diff --git a/src/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs b/src/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs index 7929956393..f0da4bf191 100644 --- a/src/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs +++ b/src/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs @@ -371,7 +371,7 @@ namespace System.Globalization { char c = cultureName[i]; // TODO: Names can only be RFC4646 names (ie: a-zA-Z0-9) while this allows any unicode letter/digit - if (Char.IsLetterOrDigit(c) || c == '-' || c == '_') + if (char.IsLetterOrDigit(c) || c == '-' || c == '_') { continue; } @@ -736,15 +736,15 @@ namespace System.Globalization // // Equals // - // Implements Object.Equals(). Returns a boolean indicating whether + // Implements object.Equals(). Returns a boolean indicating whether // or not object refers to the same CultureInfo as the current instance. // //////////////////////////////////////////////////////////////////////// - public override bool Equals(Object value) + public override bool Equals(object value) { - if (Object.ReferenceEquals(this, value)) + if (object.ReferenceEquals(this, value)) return true; CultureInfo that = value as CultureInfo; @@ -765,7 +765,7 @@ namespace System.Globalization // // GetHashCode // - // Implements Object.GetHashCode(). Returns the hash code for the + // Implements object.GetHashCode(). Returns the hash code for the // CultureInfo. The hash code is guaranteed to be the same for CultureInfo A // and B where A.Equals(B) is true. // @@ -781,7 +781,7 @@ namespace System.Globalization // // ToString // - // Implements Object.ToString(). Returns the name of the CultureInfo, + // Implements object.ToString(). Returns the name of the CultureInfo, // eg. "de-DE_phoneb", "en-US", or "fj-FJ". // //////////////////////////////////////////////////////////////////////// diff --git a/src/System.Private.CoreLib/src/System/IO/BinaryReader.cs b/src/System.Private.CoreLib/src/System/IO/BinaryReader.cs index 04fe45d378..7106d8bff4 100644 --- a/src/System.Private.CoreLib/src/System/IO/BinaryReader.cs +++ b/src/System.Private.CoreLib/src/System/IO/BinaryReader.cs @@ -281,7 +281,7 @@ namespace System.IO FillBuffer(16); try { - return Decimal.ToDecimal(_buffer); + return decimal.ToDecimal(_buffer); } catch (ArgumentException e) { diff --git a/src/System.Private.CoreLib/src/System/Internal.cs b/src/System.Private.CoreLib/src/System/Internal.cs index a3aa9d274a..033ae9aa99 100644 --- a/src/System.Private.CoreLib/src/System/Internal.cs +++ b/src/System.Private.CoreLib/src/System/Internal.cs @@ -59,91 +59,91 @@ namespace System new ArraySegment<byte>(new byte[1], 0, 0); - new Dictionary<Char, Object>(); - new Dictionary<Guid, Byte>(); - new Dictionary<Guid, Object>(); + new Dictionary<char, object>(); + new Dictionary<Guid, byte>(); + new Dictionary<Guid, object>(); new Dictionary<Guid, Guid>(); // Added for Visual Studio 2010 - new Dictionary<Int16, IntPtr>(); - new Dictionary<Int32, Byte>(); - new Dictionary<Int32, Int32>(); - new Dictionary<Int32, Object>(); - new Dictionary<IntPtr, Boolean>(); - new Dictionary<IntPtr, Int16>(); - new Dictionary<Object, Boolean>(); - new Dictionary<Object, Char>(); - new Dictionary<Object, Guid>(); - new Dictionary<Object, Int32>(); - new Dictionary<Object, Int64>(); // Added for Visual Studio 2010 + new Dictionary<short, IntPtr>(); + new Dictionary<int, byte>(); + new Dictionary<int, int>(); + new Dictionary<int, object>(); + new Dictionary<IntPtr, bool>(); + new Dictionary<IntPtr, short>(); + new Dictionary<object, bool>(); + new Dictionary<object, char>(); + new Dictionary<object, Guid>(); + new Dictionary<object, int>(); + new Dictionary<object, long>(); // Added for Visual Studio 2010 new Dictionary<uint, WeakReference>(); // NCL team needs this - new Dictionary<Object, UInt32>(); - new Dictionary<UInt32, Object>(); - new Dictionary<Int64, Object>(); + new Dictionary<object, uint>(); + new Dictionary<uint, object>(); + new Dictionary<long, object>(); // to genereate mdil for Dictionary instantiation when key is user defined value type - new Dictionary<Guid, Int32>(); + new Dictionary<Guid, int>(); // Microsoft.Windows.Design - new Dictionary<System.Reflection.MemberTypes, Object>(); + new Dictionary<System.Reflection.MemberTypes, object>(); new EnumEqualityComparer<System.Reflection.MemberTypes>(); // Microsoft.Expression.DesignModel - new Dictionary<Object, KeyValuePair<Object, Object>>(); - new Dictionary<KeyValuePair<Object, Object>, Object>(); + new Dictionary<object, KeyValuePair<object, object>>(); + new Dictionary<KeyValuePair<object, object>, object>(); - NullableHelper<Boolean>(); - NullableHelper<Byte>(); - NullableHelper<Char>(); + NullableHelper<bool>(); + NullableHelper<byte>(); + NullableHelper<char>(); NullableHelper<DateTime>(); - NullableHelper<Decimal>(); - NullableHelper<Double>(); + NullableHelper<decimal>(); + NullableHelper<double>(); NullableHelper<Guid>(); - NullableHelper<Int16>(); - NullableHelper<Int32>(); - NullableHelper<Int64>(); - NullableHelper<Single>(); + NullableHelper<short>(); + NullableHelper<int>(); + NullableHelper<long>(); + NullableHelper<float>(); NullableHelper<TimeSpan>(); NullableHelper<DateTimeOffset>(); // For SQL - new List<Boolean>(); - new List<Byte>(); - new List<Char>(); + new List<bool>(); + new List<byte>(); + new List<char>(); new List<DateTime>(); - new List<Decimal>(); - new List<Double>(); + new List<decimal>(); + new List<double>(); new List<Guid>(); - new List<Int16>(); - new List<Int32>(); - new List<Int64>(); + new List<short>(); + new List<int>(); + new List<long>(); new List<TimeSpan>(); - new List<SByte>(); - new List<Single>(); - new List<UInt16>(); - new List<UInt32>(); - new List<UInt64>(); + new List<sbyte>(); + new List<float>(); + new List<ushort>(); + new List<uint>(); + new List<ulong>(); new List<IntPtr>(); - new List<KeyValuePair<Object, Object>>(); + new List<KeyValuePair<object, object>>(); new List<GCHandle>(); // NCL team needs this new List<DateTimeOffset>(); - new KeyValuePair<Char, UInt16>('\0', UInt16.MinValue); - new KeyValuePair<UInt16, Double>(UInt16.MinValue, Double.MinValue); - new KeyValuePair<Object, Int32>(string.Empty, Int32.MinValue); - new KeyValuePair<Int32, Int32>(Int32.MinValue, Int32.MinValue); - SZArrayHelper<Boolean>(null); - SZArrayHelper<Byte>(null); + new KeyValuePair<char, ushort>('\0', ushort.MinValue); + new KeyValuePair<ushort, double>(ushort.MinValue, double.MinValue); + new KeyValuePair<object, int>(string.Empty, int.MinValue); + new KeyValuePair<int, int>(int.MinValue, int.MinValue); + SZArrayHelper<bool>(null); + SZArrayHelper<byte>(null); SZArrayHelper<DateTime>(null); - SZArrayHelper<Decimal>(null); - SZArrayHelper<Double>(null); + SZArrayHelper<decimal>(null); + SZArrayHelper<double>(null); SZArrayHelper<Guid>(null); - SZArrayHelper<Int16>(null); - SZArrayHelper<Int32>(null); - SZArrayHelper<Int64>(null); + SZArrayHelper<short>(null); + SZArrayHelper<int>(null); + SZArrayHelper<long>(null); SZArrayHelper<TimeSpan>(null); - SZArrayHelper<SByte>(null); - SZArrayHelper<Single>(null); - SZArrayHelper<UInt16>(null); - SZArrayHelper<UInt32>(null); - SZArrayHelper<UInt64>(null); + SZArrayHelper<sbyte>(null); + SZArrayHelper<float>(null); + SZArrayHelper<ushort>(null); + SZArrayHelper<uint>(null); + SZArrayHelper<ulong>(null); SZArrayHelper<DateTimeOffset>(null); SZArrayHelper<CustomAttributeTypedArgument>(null); @@ -181,7 +181,7 @@ namespace System } // System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[System.__Canon] // System.Runtime.CompilerServices.TaskAwaiter'[System.__Canon] - private static async Task<String> AsyncHelper2<T>() + private static async Task<string> AsyncHelper2<T>() { return await Task.FromResult<string>(""); } diff --git a/src/System.Private.CoreLib/src/System/MulticastDelegate.cs b/src/System.Private.CoreLib/src/System/MulticastDelegate.cs index ef630bc158..263481946c 100644 --- a/src/System.Private.CoreLib/src/System/MulticastDelegate.cs +++ b/src/System.Private.CoreLib/src/System/MulticastDelegate.cs @@ -18,20 +18,20 @@ namespace System // 1. Multicast delegate // 2. Secure/Wrapper delegate // 3. Inner delegate of secure delegate where the secure delegate security context is a collectible method - private Object _invocationList; + private object _invocationList; private IntPtr _invocationCount; // This constructor is called from the class generated by the // compiler generated code (This must match the constructor // in Delegate - protected MulticastDelegate(Object target, String method) : base(target, method) + protected MulticastDelegate(object target, string method) : base(target, method) { } // This constructor is called from a class to generate a // delegate based upon a static method name and the Type object // for the class defining the method. - protected MulticastDelegate(Type target, String method) : base(target, method) + protected MulticastDelegate(Type target, string method) : base(target, method) { } @@ -52,7 +52,7 @@ namespace System // equals returns true IIF the delegate is not null and has the // same target, method and invocation list as this object - public override sealed bool Equals(Object obj) + public override sealed bool Equals(object obj) { if (obj == null) return false; @@ -101,7 +101,7 @@ namespace System } else { - Debug.Assert((_invocationList as Object[]) != null, "empty invocation list on multicast delegate"); + Debug.Assert((_invocationList as object[]) != null, "empty invocation list on multicast delegate"); return InvocationListEquals(d); } } @@ -132,8 +132,8 @@ namespace System // Recursive function which will check for equality of the invocation list. private bool InvocationListEquals(MulticastDelegate d) { - Debug.Assert(d != null && (_invocationList as Object[]) != null, "bogus delegate in multicast list comparison"); - Object[] invocationList = _invocationList as Object[]; + Debug.Assert(d != null && (_invocationList as object[]) != null, "bogus delegate in multicast list comparison"); + object[] invocationList = _invocationList as object[]; if (d._invocationCount != _invocationCount) return false; @@ -141,16 +141,16 @@ namespace System for (int i = 0; i < invocationCount; i++) { Delegate dd = (Delegate)invocationList[i]; - Object[] dInvocationList = d._invocationList as Object[]; + object[] dInvocationList = d._invocationList as object[]; if (!dd.Equals(dInvocationList[i])) return false; } return true; } - private bool TrySetSlot(Object[] a, int index, Object o) + private bool TrySetSlot(object[] a, int index, object o) { - if (a[index] == null && System.Threading.Interlocked.CompareExchange<Object>(ref a[index], o, null) == null) + if (a[index] == null && System.Threading.Interlocked.CompareExchange<object>(ref a[index], o, null) == null) return true; // The slot may be already set because we have added and removed the same method before. @@ -170,7 +170,7 @@ namespace System return false; } - private MulticastDelegate NewMulticastDelegate(Object[] invocationList, int invocationCount, bool thisIsMultiCastAlready) + private MulticastDelegate NewMulticastDelegate(object[] invocationList, int invocationCount, bool thisIsMultiCastAlready) { // First, allocate a new multicast delegate just like this one, i.e. same type as the this object MulticastDelegate result = (MulticastDelegate)InternalAllocLike(this); @@ -194,7 +194,7 @@ namespace System return result; } - internal MulticastDelegate NewMulticastDelegate(Object[] invocationList, int invocationCount) + internal MulticastDelegate NewMulticastDelegate(object[] invocationList, int invocationCount) { return NewMulticastDelegate(invocationList, invocationCount, false); } @@ -216,7 +216,7 @@ namespace System // to form a new delegate. protected override sealed Delegate CombineImpl(Delegate follow) { - if ((Object)follow == null) // cast to object for a more efficient test + if ((object)follow == null) // cast to object for a more efficient test return this; // Verify that the types are the same... @@ -224,18 +224,18 @@ namespace System throw new ArgumentException(SR.Arg_DlgtTypeMis); MulticastDelegate dFollow = (MulticastDelegate)follow; - Object[] resultList; + object[] resultList; int followCount = 1; - Object[] followList = dFollow._invocationList as Object[]; + object[] followList = dFollow._invocationList as object[]; if (followList != null) followCount = (int)dFollow._invocationCount; int resultCount; - Object[] invocationList = _invocationList as Object[]; + object[] invocationList = _invocationList as object[]; if (invocationList == null) { resultCount = 1 + followCount; - resultList = new Object[resultCount]; + resultList = new object[resultCount]; resultList[0] = this; if (followList == null) { @@ -280,7 +280,7 @@ namespace System while (allocCount < resultCount) allocCount *= 2; - resultList = new Object[allocCount]; + resultList = new object[allocCount]; for (int i = 0; i < invocationCount; i++) resultList[i] = invocationList[i]; @@ -299,14 +299,14 @@ namespace System } } - private Object[] DeleteFromInvocationList(Object[] invocationList, int invocationCount, int deleteIndex, int deleteCount) + private object[] DeleteFromInvocationList(object[] invocationList, int invocationCount, int deleteIndex, int deleteCount) { - Object[] thisInvocationList = _invocationList as Object[]; + object[] thisInvocationList = _invocationList as object[]; int allocCount = thisInvocationList.Length; while (allocCount / 2 >= invocationCount - deleteCount) allocCount /= 2; - Object[] newInvocationList = new Object[allocCount]; + object[] newInvocationList = new object[allocCount]; for (int i = 0; i < deleteIndex; i++) newInvocationList[i] = invocationList[i]; @@ -317,7 +317,7 @@ namespace System return newInvocationList; } - private bool EqualInvocationLists(Object[] a, Object[] b, int start, int count) + private bool EqualInvocationLists(object[] a, object[] b, int start, int count) { for (int i = 0; i < count; i++) { @@ -341,9 +341,9 @@ namespace System if (v == null) return this; - if (v._invocationList as Object[] == null) + if (v._invocationList as object[] == null) { - Object[] invocationList = _invocationList as Object[]; + object[] invocationList = _invocationList as object[]; if (invocationList == null) { // they are both not real Multicast @@ -364,7 +364,7 @@ namespace System } else { - Object[] list = DeleteFromInvocationList(invocationList, invocationCount, i, 1); + object[] list = DeleteFromInvocationList(invocationList, invocationCount, i, 1); return NewMulticastDelegate(list, invocationCount - 1, true); } } @@ -373,14 +373,14 @@ namespace System } else { - Object[] invocationList = _invocationList as Object[]; + object[] invocationList = _invocationList as object[]; if (invocationList != null) { int invocationCount = (int)_invocationCount; int vInvocationCount = (int)v._invocationCount; for (int i = invocationCount - vInvocationCount; i >= 0; i--) { - if (EqualInvocationLists(invocationList, v._invocationList as Object[], i, vInvocationCount)) + if (EqualInvocationLists(invocationList, v._invocationList as object[], i, vInvocationCount)) { if (invocationCount - vInvocationCount == 0) { @@ -394,7 +394,7 @@ namespace System } else { - Object[] list = DeleteFromInvocationList(invocationList, invocationCount, i, vInvocationCount); + object[] list = DeleteFromInvocationList(invocationList, invocationCount, i, vInvocationCount); return NewMulticastDelegate(list, invocationCount - vInvocationCount, true); } } @@ -409,7 +409,7 @@ namespace System public override sealed Delegate[] GetInvocationList() { Delegate[] del; - Object[] invocationList = _invocationList as Object[]; + object[] invocationList = _invocationList as object[]; if (invocationList == null) { del = new Delegate[1]; @@ -463,7 +463,7 @@ namespace System } } - Object[] invocationList = _invocationList as Object[]; + object[] invocationList = _invocationList as object[]; if (invocationList == null) { return base.GetHashCode(); @@ -480,7 +480,7 @@ namespace System } } - internal override Object GetTarget() + internal override object GetTarget() { if (_invocationCount != (IntPtr)0) { @@ -496,7 +496,7 @@ namespace System } else { - Object[] invocationList = _invocationList as Object[]; + object[] invocationList = _invocationList as object[]; if (invocationList != null) { int invocationCount = (int)_invocationCount; @@ -518,7 +518,7 @@ namespace System if (_invocationCount != (IntPtr)0 && _invocationList != null) { // multicast case - Object[] invocationList = _invocationList as Object[]; + object[] invocationList = _invocationList as object[]; if (invocationList != null) { int index = (int)_invocationCount - 1; @@ -564,7 +564,7 @@ namespace System } [System.Diagnostics.DebuggerNonUserCode] - private void CtorClosed(Object target, IntPtr methodPtr) + private void CtorClosed(object target, IntPtr methodPtr) { if (target == null) ThrowNullThisInDelegateToInstance(); @@ -573,21 +573,21 @@ namespace System } [System.Diagnostics.DebuggerNonUserCode] - private void CtorClosedStatic(Object target, IntPtr methodPtr) + private void CtorClosedStatic(object target, IntPtr methodPtr) { this._target = target; this._methodPtr = methodPtr; } [System.Diagnostics.DebuggerNonUserCode] - private void CtorRTClosed(Object target, IntPtr methodPtr) + private void CtorRTClosed(object target, IntPtr methodPtr) { this._target = target; this._methodPtr = AdjustTarget(target, methodPtr); } [System.Diagnostics.DebuggerNonUserCode] - private void CtorOpened(Object target, IntPtr methodPtr, IntPtr shuffleThunk) + private void CtorOpened(object target, IntPtr methodPtr, IntPtr shuffleThunk) { this._target = this; this._methodPtr = shuffleThunk; @@ -595,7 +595,7 @@ namespace System } [System.Diagnostics.DebuggerNonUserCode] - private void CtorVirtualDispatch(Object target, IntPtr methodPtr, IntPtr shuffleThunk) + private void CtorVirtualDispatch(object target, IntPtr methodPtr, IntPtr shuffleThunk) { this._target = this; this._methodPtr = shuffleThunk; @@ -603,7 +603,7 @@ namespace System } [System.Diagnostics.DebuggerNonUserCode] - private void CtorCollectibleClosedStatic(Object target, IntPtr methodPtr, IntPtr gchandle) + private void CtorCollectibleClosedStatic(object target, IntPtr methodPtr, IntPtr gchandle) { this._target = target; this._methodPtr = methodPtr; @@ -611,7 +611,7 @@ namespace System } [System.Diagnostics.DebuggerNonUserCode] - private void CtorCollectibleOpened(Object target, IntPtr methodPtr, IntPtr shuffleThunk, IntPtr gchandle) + private void CtorCollectibleOpened(object target, IntPtr methodPtr, IntPtr shuffleThunk, IntPtr gchandle) { this._target = this; this._methodPtr = shuffleThunk; @@ -620,7 +620,7 @@ namespace System } [System.Diagnostics.DebuggerNonUserCode] - private void CtorCollectibleVirtualDispatch(Object target, IntPtr methodPtr, IntPtr shuffleThunk, IntPtr gchandle) + private void CtorCollectibleVirtualDispatch(object target, IntPtr methodPtr, IntPtr shuffleThunk, IntPtr gchandle) { this._target = this; this._methodPtr = shuffleThunk; diff --git a/src/System.Private.CoreLib/src/System/Numerics/Hashing/HashHelpers.cs b/src/System.Private.CoreLib/src/System/Numerics/Hashing/HashHelpers.cs index f017309a90..dd405eba78 100644 --- a/src/System.Private.CoreLib/src/System/Numerics/Hashing/HashHelpers.cs +++ b/src/System.Private.CoreLib/src/System/Numerics/Hashing/HashHelpers.cs @@ -8,7 +8,7 @@ namespace System.Numerics.Hashing internal static class HashHelpers { - public static readonly int RandomSeed = new Random().Next(Int32.MinValue, Int32.MaxValue); + public static readonly int RandomSeed = new Random().Next(int.MinValue, int.MaxValue); public static int Combine(int h1, int h2) { diff --git a/src/System.Private.CoreLib/src/System/Object.cs b/src/System.Private.CoreLib/src/System/Object.cs index 01e60ce826..7cb584af4e 100644 --- a/src/System.Private.CoreLib/src/System/Object.cs +++ b/src/System.Private.CoreLib/src/System/Object.cs @@ -57,12 +57,12 @@ namespace System // replace Equals with EqualsValue for value types). // - public virtual bool Equals(Object obj) + public virtual bool Equals(object obj) { return RuntimeHelpers.Equals(this, obj); } - public static bool Equals(Object objA, Object objB) + public static bool Equals(object objA, object objB) { if (objA == objB) { @@ -76,7 +76,7 @@ namespace System } [System.Runtime.Versioning.NonVersionable] - public static bool ReferenceEquals(Object objA, Object objB) + public static bool ReferenceEquals(object objA, object objB) { return objA == objB; } @@ -113,12 +113,12 @@ namespace System // support the ICloneable interface. // [MethodImplAttribute(MethodImplOptions.InternalCall)] - protected extern Object MemberwiseClone(); + protected extern object MemberwiseClone(); // Sets the value specified in the variant on the field // - private void FieldSetter(string typeName, string fieldName, Object val) + private void FieldSetter(string typeName, string fieldName, object val) { Debug.Assert(typeName != null); Debug.Assert(fieldName != null); @@ -148,7 +148,7 @@ namespace System // Gets the value specified in the variant on the field // - private void FieldGetter(string typeName, string fieldName, ref Object val) + private void FieldGetter(string typeName, string fieldName, ref object val) { Debug.Assert(typeName != null); Debug.Assert(fieldName != null); diff --git a/src/System.Private.CoreLib/src/System/OleAutBinder.cs b/src/System.Private.CoreLib/src/System/OleAutBinder.cs index 3a9f03c5f0..b0942232f2 100644 --- a/src/System.Private.CoreLib/src/System/OleAutBinder.cs +++ b/src/System.Private.CoreLib/src/System/OleAutBinder.cs @@ -19,7 +19,7 @@ namespace System { // ChangeType // This binder uses OLEAUT to change the type of the variant. - public override Object ChangeType(Object value, Type type, CultureInfo cultureInfo) + public override object ChangeType(object value, Type type, CultureInfo cultureInfo) { Variant myValue = new Variant(value); if (cultureInfo == null) @@ -66,7 +66,7 @@ namespace System #endif // Specify the LocalBool flag to have BOOL values converted to local language rather // than 0 or -1. - Object RetObj = OAVariantLib.ChangeType(myValue, type, OAVariantLib.LocalBool, cultureInfo).ToObject(); + object RetObj = OAVariantLib.ChangeType(myValue, type, OAVariantLib.LocalBool, cultureInfo).ToObject(); #if DISPLAY_DEBUG_INFO Console.WriteLine("Object returned from ChangeType is of type: " + RetObj.GetType().Name); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Assembly.CoreCLR.cs b/src/System.Private.CoreLib/src/System/Reflection/Assembly.CoreCLR.cs index 0931e3ccdc..6de94d4e8a 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Assembly.CoreCLR.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Assembly.CoreCLR.cs @@ -69,7 +69,7 @@ namespace System.Reflection return resolvedAssembly; } - public static Assembly LoadFrom(String assemblyFile) + public static Assembly LoadFrom(string assemblyFile) { if (assemblyFile == null) throw new ArgumentNullException(nameof(assemblyFile)); @@ -101,7 +101,7 @@ namespace System.Reflection return AssemblyLoadContext.Default.LoadFromAssemblyPath(fullPath); } - public static Assembly LoadFrom(String assemblyFile, + public static Assembly LoadFrom(string assemblyFile, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm) { @@ -111,7 +111,7 @@ namespace System.Reflection // Locate an assembly by the long form of the assembly name. // eg. "Toolbox.dll, version=1.1.10.1220, locale=en, publickey=1234567890123456789012345678901234567890" [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod - public static Assembly Load(String assemblyString) + public static Assembly Load(string assemblyString) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; return RuntimeAssembly.InternalLoad(assemblyString, ref stackMark); @@ -177,7 +177,7 @@ namespace System.Reflection private static Dictionary<string, Assembly> s_loadfile = new Dictionary<string, Assembly>(); - public static Assembly LoadFile(String path) + public static Assembly LoadFile(string path) { AppDomain.CheckLoadFileSupported(); diff --git a/src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs b/src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs index d541c4c1d4..b8e1573187 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs @@ -1253,13 +1253,13 @@ namespace System.Reflection return IsCustomAttributeDefined(module, module.MetadataToken, caType); } - internal static Object[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool inherit) + internal static object[] GetCustomAttributes(RuntimeType type, RuntimeType caType, bool inherit) { Debug.Assert(type != null); Debug.Assert(caType != null); if (type.GetElementType() != null) - return (caType.IsValueType) ? Array.Empty<Object>() : CreateAttributeArrayHelper(caType, 0); + return (caType.IsValueType) ? Array.Empty<object>() : CreateAttributeArrayHelper(caType, 0); if (type.IsGenericType && !type.IsGenericTypeDefinition) type = type.GetGenericTypeDefinition() as RuntimeType; @@ -1299,7 +1299,7 @@ namespace System.Reflection return typedResult; } - internal static Object[] GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, bool inherit) + internal static object[] GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, bool inherit) { Debug.Assert(method != null); Debug.Assert(caType != null); @@ -1342,7 +1342,7 @@ namespace System.Reflection return typedResult; } - internal static Object[] GetCustomAttributes(RuntimeConstructorInfo ctor, RuntimeType caType) + internal static object[] GetCustomAttributes(RuntimeConstructorInfo ctor, RuntimeType caType) { Debug.Assert(ctor != null); Debug.Assert(caType != null); @@ -1353,7 +1353,7 @@ namespace System.Reflection return attributes; } - internal static Object[] GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType) + internal static object[] GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType) { Debug.Assert(property != null); Debug.Assert(caType != null); @@ -1365,7 +1365,7 @@ namespace System.Reflection return attributes; } - internal static Object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType) + internal static object[] GetCustomAttributes(RuntimeEventInfo e, RuntimeType caType) { Debug.Assert(e != null); Debug.Assert(caType != null); @@ -1376,7 +1376,7 @@ namespace System.Reflection return attributes; } - internal static Object[] GetCustomAttributes(RuntimeFieldInfo field, RuntimeType caType) + internal static object[] GetCustomAttributes(RuntimeFieldInfo field, RuntimeType caType) { Debug.Assert(field != null); Debug.Assert(caType != null); @@ -1387,7 +1387,7 @@ namespace System.Reflection return attributes; } - internal static Object[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType) + internal static object[] GetCustomAttributes(RuntimeParameterInfo parameter, RuntimeType caType) { Debug.Assert(parameter != null); Debug.Assert(caType != null); @@ -1398,7 +1398,7 @@ namespace System.Reflection return attributes; } - internal static Object[] GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) + internal static object[] GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) { Debug.Assert(assembly != null); Debug.Assert(caType != null); @@ -1410,7 +1410,7 @@ namespace System.Reflection return attributes; } - internal static Object[] GetCustomAttributes(RuntimeModule module, RuntimeType caType) + internal static object[] GetCustomAttributes(RuntimeModule module, RuntimeType caType) { Debug.Assert(module != null); Debug.Assert(caType != null); @@ -1826,8 +1826,8 @@ namespace System.Reflection } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern unsafe Object _CreateCaObject(RuntimeModule pModule, RuntimeType type, IRuntimeMethodInfo pCtor, byte** ppBlob, byte* pEndBlob, int* pcNamedArgs); - private static unsafe Object CreateCaObject(RuntimeModule module, RuntimeType type, IRuntimeMethodInfo ctor, ref IntPtr blob, IntPtr blobEnd, out int namedArgs) + private static extern unsafe object _CreateCaObject(RuntimeModule pModule, RuntimeType type, IRuntimeMethodInfo pCtor, byte** ppBlob, byte* pEndBlob, int* pcNamedArgs); + private static unsafe object CreateCaObject(RuntimeModule module, RuntimeType type, IRuntimeMethodInfo ctor, ref IntPtr blob, IntPtr blobEnd, out int namedArgs) { byte* pBlob = (byte*)blob; byte* pBlobEnd = (byte*)blobEnd; diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs index 2c446f7ecb..59d906a340 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs @@ -76,12 +76,12 @@ namespace System.Reflection.Emit // Assembly methods that are overridden by AssemblyBuilder should be overridden by InternalAssemblyBuilder too #region Methods inherited from Assembly - public override String[] GetManifestResourceNames() + public override string[] GetManifestResourceNames() { throw new NotSupportedException(SR.NotSupported_DynamicAssembly); } - public override FileStream GetFile(String name) + public override FileStream GetFile(string name) { throw new NotSupportedException(SR.NotSupported_DynamicAssembly); } @@ -91,22 +91,22 @@ namespace System.Reflection.Emit throw new NotSupportedException(SR.NotSupported_DynamicAssembly); } - public override Stream GetManifestResourceStream(Type type, String name) + public override Stream GetManifestResourceStream(Type type, string name) { throw new NotSupportedException(SR.NotSupported_DynamicAssembly); } - public override Stream GetManifestResourceStream(String name) + public override Stream GetManifestResourceStream(string name) { throw new NotSupportedException(SR.NotSupported_DynamicAssembly); } - public override ManifestResourceInfo GetManifestResourceInfo(String resourceName) + public override ManifestResourceInfo GetManifestResourceInfo(string resourceName) { throw new NotSupportedException(SR.NotSupported_DynamicAssembly); } - public override String Location + public override string Location { get { @@ -114,7 +114,7 @@ namespace System.Reflection.Emit } } - public override String CodeBase + public override string CodeBase { get { @@ -127,7 +127,7 @@ namespace System.Reflection.Emit throw new NotSupportedException(SR.NotSupported_DynamicAssembly); } - public override String ImageRuntimeVersion + public override string ImageRuntimeVersion { get { @@ -337,7 +337,7 @@ namespace System.Reflection.Emit **********************************************/ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod public ModuleBuilder DefineDynamicModule( - String name) + string name) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; return DefineDynamicModuleInternal(name, false, ref stackMark); @@ -345,7 +345,7 @@ namespace System.Reflection.Emit [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod public ModuleBuilder DefineDynamicModule( - String name, + string name, bool emitSymbolInfo) // specify if emit symbol info or not { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; @@ -353,7 +353,7 @@ namespace System.Reflection.Emit } private ModuleBuilder DefineDynamicModuleInternal( - String name, + string name, bool emitSymbolInfo, // specify if emit symbol info or not ref StackCrawlMark stackMark) { @@ -364,7 +364,7 @@ namespace System.Reflection.Emit } private ModuleBuilder DefineDynamicModuleInternalNoLock( - String name, + string name, bool emitSymbolInfo, // specify if emit symbol info or not ref StackCrawlMark stackMark) { @@ -393,7 +393,7 @@ namespace System.Reflection.Emit { writer = SymWrapperCore.SymWriter.CreateSymWriter(); - String fileName = "Unused"; // this symfile is never written to disk so filename does not matter. + string fileName = "Unused"; // this symfile is never written to disk so filename does not matter. // Pass the "real" module to the VM pInternalSymWriter = ModuleBuilder.nCreateISymWriterForDynamicModule(dynModule.InternalModule, fileName); @@ -460,12 +460,12 @@ namespace System.Reflection.Emit #endregion #region ICustomAttributeProvider Members - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { return InternalAssembly.GetCustomAttributes(inherit); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return InternalAssembly.GetCustomAttributes(attributeType, inherit); } @@ -483,12 +483,12 @@ namespace System.Reflection.Emit #region Assembly overrides // Returns the names of all the resources - public override String[] GetManifestResourceNames() + public override string[] GetManifestResourceNames() { return InternalAssembly.GetManifestResourceNames(); } - public override FileStream GetFile(String name) + public override FileStream GetFile(string name) { return InternalAssembly.GetFile(name); } @@ -498,22 +498,22 @@ namespace System.Reflection.Emit return InternalAssembly.GetFiles(getResourceModules); } - public override Stream GetManifestResourceStream(Type type, String name) + public override Stream GetManifestResourceStream(Type type, string name) { return InternalAssembly.GetManifestResourceStream(type, name); } - public override Stream GetManifestResourceStream(String name) + public override Stream GetManifestResourceStream(string name) { return InternalAssembly.GetManifestResourceStream(name); } - public override ManifestResourceInfo GetManifestResourceInfo(String resourceName) + public override ManifestResourceInfo GetManifestResourceInfo(string resourceName) { return InternalAssembly.GetManifestResourceInfo(resourceName); } - public override String Location + public override string Location { get { @@ -521,7 +521,7 @@ namespace System.Reflection.Emit } } - public override String ImageRuntimeVersion + public override string ImageRuntimeVersion { get { @@ -529,7 +529,7 @@ namespace System.Reflection.Emit } } - public override String CodeBase + public override string CodeBase { get { @@ -558,7 +558,7 @@ namespace System.Reflection.Emit return InternalAssembly.GetName(copiedName); } - public override String FullName + public override string FullName { get { @@ -566,7 +566,7 @@ namespace System.Reflection.Emit } } - public override Type GetType(String name, bool throwOnError, bool ignoreCase) + public override Type GetType(string name, bool throwOnError, bool ignoreCase) { return InternalAssembly.GetType(name, throwOnError, ignoreCase); } @@ -587,7 +587,7 @@ namespace System.Reflection.Emit } } - public override Module GetModule(String name) + public override Module GetModule(string name) { return InternalAssembly.GetModule(name); } @@ -605,7 +605,7 @@ namespace System.Reflection.Emit } } - public override Int64 HostContext + public override long HostContext { get { @@ -654,7 +654,7 @@ namespace System.Reflection.Emit * **********************************************/ public ModuleBuilder GetDynamicModule( - String name) // the name of module for the look up + string name) // the name of module for the look up { lock (SyncRoot) { @@ -663,7 +663,7 @@ namespace System.Reflection.Emit } private ModuleBuilder GetDynamicModuleNoLock( - String name) // the name of module for the look up + string name) // the name of module for the look up { if (name == null) throw new ArgumentNullException(nameof(name)); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilderData.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilderData.cs index ea1f6994e9..bbee037f55 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilderData.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilderData.cs @@ -26,7 +26,7 @@ namespace System.Reflection.Emit { internal AssemblyBuilderData( InternalAssemblyBuilder assembly, - String strAssemblyName, + string strAssemblyName, AssemblyBuilderAccess access) { m_assembly = assembly; @@ -95,7 +95,7 @@ namespace System.Reflection.Emit } // Helper to ensure the type name is unique underneath assemblyBuilder - internal void CheckTypeNameConflict(String strTypeName, TypeBuilder enclosingType) + internal void CheckTypeNameConflict(string strTypeName, TypeBuilder enclosingType) { for (int i = 0; i < m_moduleBuilderList.Count; i++) { @@ -116,7 +116,7 @@ namespace System.Reflection.Emit internal List<ModuleBuilder> m_moduleBuilderList; internal List<ResWriterData> m_resWriterList; - internal String m_strAssemblyName; + internal string m_strAssemblyName; internal AssemblyBuilderAccess m_access; private InternalAssemblyBuilder m_assembly; @@ -140,7 +140,7 @@ namespace System.Reflection.Emit internal Assembly m_ISymWrapperAssembly; // For unmanaged resources - internal String m_strResourceFileName; + internal string m_strResourceFileName; internal byte[] m_resourceBytes; internal NativeVersionInfo m_nativeVersion; internal bool m_hasUnmanagedVersionInfo; @@ -156,9 +156,9 @@ namespace System.Reflection.Emit **********************************************/ internal class ResWriterData { - internal String m_strName; - internal String m_strFileName; - internal String m_strFullFileName; + internal string m_strName; + internal string m_strFileName; + internal string m_strFullFileName; internal Stream m_memoryStream; internal ResWriterData m_nextResWriter; internal ResourceAttributes m_attribute; @@ -179,14 +179,14 @@ namespace System.Reflection.Emit m_lcid = -1; } - internal String m_strDescription; - internal String m_strCompany; - internal String m_strTitle; - internal String m_strCopyright; - internal String m_strTrademark; - internal String m_strProduct; - internal String m_strProductVersion; - internal String m_strFileVersion; + internal string m_strDescription; + internal string m_strCompany; + internal string m_strTitle; + internal string m_strCopyright; + internal string m_strTrademark; + internal string m_strProduct; + internal string m_strProductVersion; + internal string m_strFileVersion; internal int m_lcid; } } diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs index b333dc3922..91e64e4f6b 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/ConstructorBuilder.cs @@ -21,7 +21,7 @@ namespace System.Reflection.Emit #region Constructor - internal ConstructorBuilder(String name, MethodAttributes attributes, CallingConventions callingConvention, + internal ConstructorBuilder(string name, MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers, ModuleBuilder mod, TypeBuilder type) { int sigLength; @@ -38,7 +38,7 @@ namespace System.Reflection.Emit token = m_methodBuilder.GetToken(); } - internal ConstructorBuilder(String name, MethodAttributes attributes, CallingConventions callingConvention, + internal ConstructorBuilder(string name, MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes, ModuleBuilder mod, TypeBuilder type) : this(name, attributes, callingConvention, parameterTypes, null, null, mod, type) { @@ -59,7 +59,7 @@ namespace System.Reflection.Emit #endregion #region Object Overrides - public override String ToString() + public override string ToString() { return m_methodBuilder.ToString(); } @@ -87,7 +87,7 @@ namespace System.Reflection.Emit get { return m_methodBuilder.DeclaringType; } } - public override String Name + public override string Name { get { return m_methodBuilder.Name; } } @@ -95,7 +95,7 @@ namespace System.Reflection.Emit #endregion #region MethodBase Overrides - public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } @@ -124,7 +124,7 @@ namespace System.Reflection.Emit #endregion #region ConstructorInfo Overrides - public override Object Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } @@ -132,12 +132,12 @@ namespace System.Reflection.Emit #endregion #region ICustomAttributeProvider Implementation - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { return m_methodBuilder.GetCustomAttributes(inherit); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_methodBuilder.GetCustomAttributes(attributeType, inherit); } @@ -155,7 +155,7 @@ namespace System.Reflection.Emit return m_methodBuilder.GetToken(); } - public ParameterBuilder DefineParameter(int iSequence, ParameterAttributes attributes, String strParamName) + public ParameterBuilder DefineParameter(int iSequence, ParameterAttributes attributes, string strParamName) { // Theoretically we shouldn't allow iSequence to be 0 because in reflection ctors don't have // return parameters. But we'll allow it for backward compatibility with V2. The attributes @@ -204,7 +204,7 @@ namespace System.Reflection.Emit return m_methodBuilder.ReturnType; } - public String Signature + public string Signature { get { return m_methodBuilder.Signature; } } diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/CustomAttributeBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/CustomAttributeBuilder.cs index f48a07251a..1dd3a1ee5a 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/CustomAttributeBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/CustomAttributeBuilder.cs @@ -28,36 +28,36 @@ namespace System.Reflection.Emit { // public constructor to form the custom attribute with constructor and constructor // parameters. - public CustomAttributeBuilder(ConstructorInfo con, Object[] constructorArgs) + public CustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs) { InitCustomAttributeBuilder(con, constructorArgs, - new PropertyInfo[] { }, new Object[] { }, - new FieldInfo[] { }, new Object[] { }); + new PropertyInfo[] { }, new object[] { }, + new FieldInfo[] { }, new object[] { }); } // public constructor to form the custom attribute with constructor, constructor // parameters and named properties. - public CustomAttributeBuilder(ConstructorInfo con, Object[] constructorArgs, - PropertyInfo[] namedProperties, Object[] propertyValues) + public CustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs, + PropertyInfo[] namedProperties, object[] propertyValues) { InitCustomAttributeBuilder(con, constructorArgs, namedProperties, - propertyValues, new FieldInfo[] { }, new Object[] { }); + propertyValues, new FieldInfo[] { }, new object[] { }); } // public constructor to form the custom attribute with constructor and constructor // parameters. - public CustomAttributeBuilder(ConstructorInfo con, Object[] constructorArgs, - FieldInfo[] namedFields, Object[] fieldValues) + public CustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs, + FieldInfo[] namedFields, object[] fieldValues) { InitCustomAttributeBuilder(con, constructorArgs, new PropertyInfo[] { }, - new Object[] { }, namedFields, fieldValues); + new object[] { }, namedFields, fieldValues); } // public constructor to form the custom attribute with constructor and constructor // parameters. - public CustomAttributeBuilder(ConstructorInfo con, Object[] constructorArgs, - PropertyInfo[] namedProperties, Object[] propertyValues, - FieldInfo[] namedFields, Object[] fieldValues) + public CustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs, + PropertyInfo[] namedProperties, object[] propertyValues, + FieldInfo[] namedFields, object[] fieldValues) { InitCustomAttributeBuilder(con, constructorArgs, namedProperties, propertyValues, namedFields, fieldValues); @@ -70,7 +70,7 @@ namespace System.Reflection.Emit { return t != typeof(IntPtr) && t != typeof(UIntPtr); } - if (t == typeof(String) || t == typeof(Type)) + if (t == typeof(string) || t == typeof(Type)) { return true; } @@ -97,12 +97,12 @@ namespace System.Reflection.Emit return false; return ValidateType(t.GetElementType()); } - return t == typeof(Object); + return t == typeof(object); } - internal void InitCustomAttributeBuilder(ConstructorInfo con, Object[] constructorArgs, - PropertyInfo[] namedProperties, Object[] propertyValues, - FieldInfo[] namedFields, Object[] fieldValues) + internal void InitCustomAttributeBuilder(ConstructorInfo con, object[] constructorArgs, + PropertyInfo[] namedProperties, object[] propertyValues, + FieldInfo[] namedFields, object[] fieldValues) { if (con == null) throw new ArgumentNullException(nameof(con)); @@ -130,7 +130,7 @@ namespace System.Reflection.Emit // Cache information used elsewhere. m_con = con; - m_constructorArgs = new Object[constructorArgs.Length]; + m_constructorArgs = new object[constructorArgs.Length]; Array.Copy(constructorArgs, 0, m_constructorArgs, 0, constructorArgs.Length); Type[] paramTypes; @@ -357,7 +357,7 @@ namespace System.Reflection.Emit writer.Write((byte)CustomAttributeEncoding.Enum); EmitString(writer, type.AssemblyQualifiedName); } - else if (type == typeof(String)) + else if (type == typeof(string)) { writer.Write((byte)CustomAttributeEncoding.String); } @@ -377,7 +377,7 @@ namespace System.Reflection.Emit } } - private void EmitString(BinaryWriter writer, String str) + private void EmitString(BinaryWriter writer, string str) { // Strings are emitted with a length prefix in a compressed format (1, 2 or 4 bytes) as used internally by metadata. byte[] utf8Str = Encoding.UTF8.GetBytes(str); @@ -401,7 +401,7 @@ namespace System.Reflection.Emit writer.Write(utf8Str); } - private void EmitValue(BinaryWriter writer, Type type, Object value) + private void EmitValue(BinaryWriter writer, Type type, object value) { if (type.IsEnum) { @@ -436,12 +436,12 @@ namespace System.Reflection.Emit break; } } - else if (type == typeof(String)) + else if (type == typeof(string)) { if (value == null) writer.Write((byte)0xff); else - EmitString(writer, (String)value); + EmitString(writer, (string)value); } else if (type == typeof(Type)) { @@ -449,7 +449,7 @@ namespace System.Reflection.Emit writer.Write((byte)0xff); else { - String typeName = TypeNameBuilder.ToString((Type)value, TypeNameBuilder.Format.AssemblyQualifiedName); + string typeName = TypeNameBuilder.ToString((Type)value, TypeNameBuilder.Format.AssemblyQualifiedName); if (typeName == null) throw new ArgumentException(SR.Format(SR.Argument_InvalidTypeForCA, value.GetType())); EmitString(writer, typeName); @@ -519,7 +519,7 @@ namespace System.Reflection.Emit // TypeBuilder), so we need to canonicalize this case back to Type. If we have a null value we follow the convention // used by C# and emit a null typed as a string (it doesn't really matter what type we pick as long as it's a // reference type). - Type ot = value == null ? typeof(String) : value is Type ? typeof(Type) : value.GetType(); + Type ot = value == null ? typeof(string) : value is Type ? typeof(Type) : value.GetType(); // value cannot be a "System.Object" object. // If we allow this we will get into an infinite recursion @@ -559,7 +559,7 @@ namespace System.Reflection.Emit } internal ConstructorInfo m_con; - internal Object[] m_constructorArgs; + internal object[] m_constructorArgs; internal byte[] m_blob; } } diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs index 5f265787f7..48ad93dbda 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs @@ -794,7 +794,7 @@ namespace System.Reflection.Emit methodHandle = new IntPtr(); fieldHandle = new IntPtr(); - Object handle = m_scope[token]; + object handle = m_scope[token]; if (handle == null) throw new InvalidProgramException(); @@ -914,13 +914,13 @@ namespace System.Reflection.Emit internal class DynamicScope { #region Private Data Members - internal List<Object> m_tokens; + internal List<object> m_tokens; #endregion #region Constructor internal unsafe DynamicScope() { - m_tokens = new List<Object>(); + m_tokens = new List<object>(); m_tokens.Add(null); } #endregion diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs index 00ee65d9f0..99af8441e1 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs @@ -241,7 +241,7 @@ namespace System.Reflection.Emit return s_anonymouslyHostedDynamicMethodsModule; ConstructorInfo transparencyCtor = typeof(SecurityTransparentAttribute).GetConstructor(Type.EmptyTypes); - CustomAttributeBuilder transparencyAttribute = new CustomAttributeBuilder(transparencyCtor, Array.Empty<Object>()); + CustomAttributeBuilder transparencyAttribute = new CustomAttributeBuilder(transparencyCtor, Array.Empty<object>()); List<CustomAttributeBuilder> assemblyAttributes = new List<CustomAttributeBuilder>(); assemblyAttributes.Add(transparencyAttribute); @@ -263,7 +263,7 @@ namespace System.Reflection.Emit return s_anonymouslyHostedDynamicMethodsModule; } - private unsafe void Init(String name, + private unsafe void Init(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, @@ -365,7 +365,7 @@ namespace System.Reflection.Emit return d; } - public sealed override Delegate CreateDelegate(Type delegateType, Object target) + public sealed override Delegate CreateDelegate(Type delegateType, object target) { if (m_restrictedSkipVisibility) { @@ -408,9 +408,9 @@ namespace System.Reflection.Emit // MethodInfo api. They mostly forward to RTDynamicMethod // - public override String ToString() { return m_dynMethod.ToString(); } + public override string ToString() { return m_dynMethod.ToString(); } - public override String Name { get { return m_dynMethod.Name; } } + public override string Name { get { return m_dynMethod.Name; } } public override Type DeclaringType { get { return m_dynMethod.DeclaringType; } } @@ -455,7 +455,7 @@ namespace System.Reflection.Emit get { return false; } } - public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { if ((CallingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs) throw new NotSupportedException(SR.NotSupported_CallToVarArg); @@ -482,10 +482,10 @@ namespace System.Reflection.Emit // if we are here we passed all the previous checks. Time to look at the arguments bool wrapExceptions = (invokeAttr & BindingFlags.DoNotWrapExceptions) == 0; - Object retValue = null; + object retValue = null; if (actualCount > 0) { - Object[] arguments = CheckArguments(parameters, binder, invokeAttr, culture, sig); + object[] arguments = CheckArguments(parameters, binder, invokeAttr, culture, sig); retValue = RuntimeMethodHandle.InvokeMethod(null, arguments, sig, false, wrapExceptions); // copy out. This should be made only if ByRef are present. for (int index = 0; index < arguments.Length; index++) @@ -500,12 +500,12 @@ namespace System.Reflection.Emit return retValue; } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_dynMethod.GetCustomAttributes(attributeType, inherit); } - public override Object[] GetCustomAttributes(bool inherit) { return m_dynMethod.GetCustomAttributes(inherit); } + public override object[] GetCustomAttributes(bool inherit) { return m_dynMethod.GetCustomAttributes(inherit); } public override bool IsDefined(Type attributeType, bool inherit) { return m_dynMethod.IsDefined(attributeType, inherit); } @@ -519,7 +519,7 @@ namespace System.Reflection.Emit // DynamicMethod specific methods // - public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, String parameterName) + public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, string parameterName) { if (position < 0 || position > m_parameterTypes.Length) throw new ArgumentOutOfRangeException(SR.ArgumentOutOfRange_ParamSequence); @@ -577,11 +577,11 @@ namespace System.Reflection.Emit { internal DynamicMethod m_owner; private RuntimeParameterInfo[] m_parameters; - private String m_name; + private string m_name; private MethodAttributes m_attributes; private CallingConventions m_callingConvention; - internal RTDynamicMethod(DynamicMethod owner, String name, MethodAttributes attributes, CallingConventions callingConvention) + internal RTDynamicMethod(DynamicMethod owner, string name, MethodAttributes attributes, CallingConventions callingConvention) { m_owner = owner; m_name = name; @@ -592,12 +592,12 @@ namespace System.Reflection.Emit // // MethodInfo api // - public override String ToString() + public override string ToString() { return ReturnType.FormatTypeName() + " " + FormatNameAndSig(); } - public override String Name + public override string Name { get { return m_name; } } @@ -650,7 +650,7 @@ namespace System.Reflection.Emit return MethodImplAttributes.IL | MethodImplAttributes.NoInlining; } - public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { // We want the creator of the DynamicMethod to control who has access to the // DynamicMethod (just like we do for delegates). However, a user can get to @@ -661,21 +661,21 @@ namespace System.Reflection.Emit throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, "this"); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException(nameof(attributeType)); if (attributeType.IsAssignableFrom(typeof(MethodImplAttribute))) - return new Object[] { new MethodImplAttribute((MethodImplOptions)GetMethodImplementationFlags()) }; + return new object[] { new MethodImplAttribute((MethodImplOptions)GetMethodImplementationFlags()) }; else - return Array.Empty<Object>(); + return Array.Empty<object>(); } - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { // support for MethodImplAttribute PCA - return new Object[] { new MethodImplAttribute((MethodImplOptions)GetMethodImplementationFlags()) }; + return new object[] { new MethodImplAttribute((MethodImplOptions)GetMethodImplementationFlags()) }; } public override bool IsDefined(Type attributeType, bool inherit) @@ -753,14 +753,14 @@ namespace System.Reflection.Emit { internal EmptyCAHolder() { } - Object[] ICustomAttributeProvider.GetCustomAttributes(Type attributeType, bool inherit) + object[] ICustomAttributeProvider.GetCustomAttributes(Type attributeType, bool inherit) { - return Array.Empty<Object>(); + return Array.Empty<object>(); } - Object[] ICustomAttributeProvider.GetCustomAttributes(bool inherit) + object[] ICustomAttributeProvider.GetCustomAttributes(bool inherit) { - return Array.Empty<Object>(); + return Array.Empty<object>(); } bool ICustomAttributeProvider.IsDefined(Type attributeType, bool inherit) diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.cs index 1e4d30849c..a77d5b058e 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/EnumBuilder.cs @@ -31,7 +31,7 @@ namespace System.Reflection.Emit // Define literal for enum - public FieldBuilder DefineLiteral(string literalName, Object literalValue) + public FieldBuilder DefineLiteral(string literalName, object literalValue) { // Define the underlying field for the enum. It will be a non-static, private field with special name bit set. FieldBuilder fieldBuilder = m_typeBuilder.DefineField( @@ -84,12 +84,12 @@ namespace System.Reflection.Emit } } - public override Object InvokeMember( + public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, - Object target, - Object[] args, + object target, + object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) @@ -303,13 +303,13 @@ namespace System.Reflection.Emit } //ICustomAttributeProvider - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { return m_typeBuilder.GetCustomAttributes(inherit); } // Return a custom attribute identified by Type - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_typeBuilder.GetCustomAttributes(attributeType, inherit); } diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/EventBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/EventBuilder.cs index c67d5559fd..eee969914b 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/EventBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/EventBuilder.cs @@ -29,7 +29,7 @@ namespace System.Reflection.Emit // internal EventBuilder( ModuleBuilder mod, // the module containing this EventBuilder - String name, // Event name + string name, // Event name EventAttributes attr, // event attribute such as Public, Private, and Protected defined above //int eventType, // event type TypeBuilder type, // containing type @@ -114,7 +114,7 @@ namespace System.Reflection.Emit } // These are package private so that TypeBuilder can access them. - private String m_name; // The name of the event + private string m_name; // The name of the event private EventToken m_evToken; // The token of this event private ModuleBuilder m_module; private EventAttributes m_attributes; diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/EventToken.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/EventToken.cs index e44dc3d0ce..53dfa9a603 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/EventToken.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/EventToken.cs @@ -39,7 +39,7 @@ namespace System.Reflection.Emit return m_event; } - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (obj is EventToken) return Equals((EventToken)obj); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.cs index 78a1ed5bb5..56d49d0ebe 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/FieldBuilder.cs @@ -17,13 +17,13 @@ namespace System.Reflection.Emit private int m_fieldTok; private FieldToken m_tkField; private TypeBuilder m_typeBuilder; - private String m_fieldName; + private string m_fieldName; private FieldAttributes m_Attributes; private Type m_fieldType; #endregion #region Constructor - internal FieldBuilder(TypeBuilder typeBuilder, String fieldName, Type type, + internal FieldBuilder(TypeBuilder typeBuilder, string fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes) { if (fieldName == null) @@ -78,7 +78,7 @@ namespace System.Reflection.Emit get { return m_typeBuilder.Module; } } - public override String Name + public override string Name { get { return m_fieldName; } } @@ -113,7 +113,7 @@ namespace System.Reflection.Emit get { return m_fieldType; } } - public override Object GetValue(Object obj) + public override object GetValue(object obj) { // NOTE!! If this is implemented, make sure that this throws // a NotSupportedException for Save-only dynamic assemblies. @@ -122,7 +122,7 @@ namespace System.Reflection.Emit throw new NotSupportedException(SR.NotSupported_DynamicModule); } - public override void SetValue(Object obj, Object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture) + public override void SetValue(object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture) { // NOTE!! If this is implemented, make sure that this throws // a NotSupportedException for Save-only dynamic assemblies. @@ -144,12 +144,12 @@ namespace System.Reflection.Emit #endregion #region ICustomAttributeProvider Implementation - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } @@ -174,7 +174,7 @@ namespace System.Reflection.Emit TypeBuilder.SetFieldLayoutOffset(m_typeBuilder.GetModuleBuilder().GetNativeHandle(), GetToken().Token, iOffset); } - public void SetConstant(Object defaultValue) + public void SetConstant(object defaultValue) { m_typeBuilder.ThrowIfCreated(); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/FieldToken.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/FieldToken.cs index c7450ca301..b6441bf4f2 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/FieldToken.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/FieldToken.cs @@ -27,7 +27,7 @@ namespace System.Reflection.Emit public static readonly FieldToken Empty = new FieldToken(); internal int m_fieldTok; - internal Object m_class; + internal object m_class; // Creates an empty FieldToken. A publicly visible constructor so that // it can be created on the stack. @@ -59,7 +59,7 @@ namespace System.Reflection.Emit // Returns true if obj is an instance of FieldToken and is // equal to this instance. - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (obj is FieldToken) return Equals((FieldToken)obj); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs index a79e8841ad..7232600485 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs @@ -100,7 +100,7 @@ namespace System.Reflection.Emit public override Guid GUID { get { throw new NotSupportedException(); } } - public override Object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) { throw new NotSupportedException(); } + public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) { throw new NotSupportedException(); } public override Assembly Assembly { get { return m_type.Assembly; } } @@ -202,9 +202,9 @@ namespace System.Reflection.Emit #endregion #region ICustomAttributeProvider Implementation - public override Object[] GetCustomAttributes(bool inherit) { throw new NotSupportedException(); } + public override object[] GetCustomAttributes(bool inherit) { throw new NotSupportedException(); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(); } + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(); } public override bool IsDefined(Type attributeType, bool inherit) { throw new NotSupportedException(); } #endregion diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs index 69ac49f096..d01c9cb6d2 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs @@ -255,7 +255,7 @@ namespace System.Reflection.Emit if (m_fixupData[i].m_fixupInstSize == 1) { //Verify that our one-byte arg will fit into a Signed Byte. - if (updateAddr < SByte.MinValue || updateAddr > SByte.MaxValue) + if (updateAddr < sbyte.MinValue || updateAddr > sbyte.MaxValue) { throw new NotSupportedException(SR.Format(SR.NotSupported_IllegalOneByteBranch, m_fixupData[i].m_fixupPos, updateAddr)); } @@ -815,7 +815,7 @@ namespace System.Reflection.Emit PutInteger4(tempVal); } - public virtual void Emit(OpCode opcode, String str) + public virtual void Emit(OpCode opcode, string str) { // Puts the opcode onto the IL stream followed by the metadata token // represented by str. The location of str is recorded for future @@ -905,7 +905,7 @@ namespace System.Reflection.Emit else { //Handle stloc_1, ldloc_1 - if (tempVal > Byte.MaxValue) + if (tempVal > byte.MaxValue) { throw new InvalidOperationException(SR.InvalidOperation_BadInstructionOrIndexOutOfBound); } @@ -1173,13 +1173,13 @@ namespace System.Reflection.Emit return Type.GetType("System.Console, System.Console", throwOnError: true); } - public virtual void EmitWriteLine(String value) + public virtual void EmitWriteLine(string value) { // Emits the IL to call Console.WriteLine with a string. Emit(OpCodes.Ldstr, value); Type[] parameterTypes = new Type[1]; - parameterTypes[0] = typeof(String); + parameterTypes[0] = typeof(string); MethodInfo mi = GetConsoleType().GetMethod("WriteLine", parameterTypes); Emit(OpCodes.Call, mi); } @@ -1191,7 +1191,7 @@ namespace System.Reflection.Emit // one of the types for which Console.WriteLine implements overloads. (e.g. // we do *not* call ToString on the locals. - Object cls; + object cls; if (m_methodBuilder == null) { throw new ArgumentException(SR.InvalidOperation_BadILGeneratorUsage); @@ -1223,7 +1223,7 @@ namespace System.Reflection.Emit // one of the types for which Console.WriteLine implements overloads. (e.g. // we do *not* call ToString on the fields. - Object cls; + object cls; if (fld == null) { @@ -1300,7 +1300,7 @@ namespace System.Reflection.Emit return localBuilder; } - public virtual void UsingNamespace(String usingNamespace) + public virtual void UsingNamespace(string usingNamespace) { // Specifying the namespace to be used in evaluating locals and watches // for the current active lexical scope. @@ -1663,7 +1663,7 @@ namespace System.Reflection.Emit } internal void AddLocalSymInfoToCurrentScope( - String strName, + string strName, byte[] signature, int slot, int startOffset, @@ -1678,7 +1678,7 @@ namespace System.Reflection.Emit } internal void AddUsingNamespaceToCurrentScope( - String strNamespace) + string strNamespace) { int i = GetCurrentActiveScopeIndex(); if (m_localSymInfos[i] == null) diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/ISymWrapperCore.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/ISymWrapperCore.cs index cda651c9ce..0301329185 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/ISymWrapperCore.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/ISymWrapperCore.cs @@ -165,7 +165,7 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // DefineDocument() wrapper //------------------------------------------------------------------------------ - ISymbolDocumentWriter ISymbolWriter.DefineDocument(String url, + ISymbolDocumentWriter ISymbolWriter.DefineDocument(string url, Guid language, Guid languageVendor, Guid documentType) @@ -295,7 +295,7 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // DefineLocalVariable() wrapper //------------------------------------------------------------------------------ - void ISymbolWriter.DefineLocalVariable(String name, + void ISymbolWriter.DefineLocalVariable(string name, FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, @@ -325,7 +325,7 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // SetSymAttribute() wrapper //------------------------------------------------------------------------------ - void ISymbolWriter.SetSymAttribute(SymbolToken parent, String name, byte[] data) + void ISymbolWriter.SetSymAttribute(SymbolToken parent, string name, byte[] data) { int hr = m_vtable.SetSymAttribute(m_pWriter, parent.GetToken(), name, data.Length, data); if (hr < 0) @@ -337,7 +337,7 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ // UsingNamespace() wrapper //------------------------------------------------------------------------------ - void ISymbolWriter.UsingNamespace(String name) + void ISymbolWriter.UsingNamespace(string name) { int hr = m_vtable.UsingNamespace(m_pWriter, name); if (hr < 0) @@ -366,13 +366,13 @@ namespace System.Reflection.Emit //------------------------------------------------------------------------------ private delegate int DInitialize(ISymUnmanagedWriter* pthis, IntPtr emitter, //IUnknown* - [MarshalAs(UnmanagedType.LPWStr)] String filename, //WCHAR* + [MarshalAs(UnmanagedType.LPWStr)] string filename, //WCHAR* IntPtr pIStream, //IStream* [MarshalAs(UnmanagedType.Bool)] bool fFullBuild ); private delegate int DDefineDocument(ISymUnmanagedWriter* pthis, - [MarshalAs(UnmanagedType.LPWStr)] String url, + [MarshalAs(UnmanagedType.LPWStr)] string url, [In] ref Guid language, [In] ref Guid languageVender, [In] ref Guid documentType, @@ -398,7 +398,7 @@ namespace System.Reflection.Emit private delegate int DSetScopeRange(ISymUnmanagedWriter* pthis, int scopeID, int startOffset, int endOffset); private delegate int DDefineLocalVariable(ISymUnmanagedWriter* pthis, - [MarshalAs(UnmanagedType.LPWStr)] String name, + [MarshalAs(UnmanagedType.LPWStr)] string name, int attributes, int cSig, [In] byte[] signature, @@ -414,15 +414,15 @@ namespace System.Reflection.Emit private delegate int DSetSymAttribute(ISymUnmanagedWriter* pthis, int parent, - [MarshalAs(UnmanagedType.LPWStr)] String name, + [MarshalAs(UnmanagedType.LPWStr)] string name, int cData, [In] byte[] data ); - private delegate int DOpenNamespace(ISymUnmanagedWriter* pthis, [MarshalAs(UnmanagedType.LPWStr)] String name); + private delegate int DOpenNamespace(ISymUnmanagedWriter* pthis, [MarshalAs(UnmanagedType.LPWStr)] string name); private delegate int DCloseNamespace(ISymUnmanagedWriter* pthis); - private delegate int DUsingNamespace(ISymUnmanagedWriter* pthis, [MarshalAs(UnmanagedType.LPWStr)] String name); + private delegate int DUsingNamespace(ISymUnmanagedWriter* pthis, [MarshalAs(UnmanagedType.LPWStr)] string name); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/LocalBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/LocalBuilder.cs index 1e07f3a4e0..0e0db23b68 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/LocalBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/LocalBuilder.cs @@ -53,12 +53,12 @@ namespace System.Reflection.Emit #endregion #region Public Members - public void SetLocalSymInfo(String name) + public void SetLocalSymInfo(string name) { SetLocalSymInfo(name, 0, 0); } - public void SetLocalSymInfo(String name, int startOffset, int endOffset) + public void SetLocalSymInfo(string name, int startOffset, int endOffset) { ModuleBuilder dynMod; SignatureHelper sigHelp; diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs index 70b5b66d65..5dd14ce1b0 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs @@ -21,7 +21,7 @@ namespace System.Reflection.Emit { #region Private Data Members // Identity - internal String m_strName; // The name of the method + internal string m_strName; // The name of the method private MethodToken m_tkMethod; // The token of this method private ModuleBuilder m_module; internal TypeBuilder m_containingType; @@ -62,7 +62,7 @@ namespace System.Reflection.Emit #region Constructor - internal MethodBuilder(String name, MethodAttributes attributes, CallingConventions callingConvention, + internal MethodBuilder(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers, ModuleBuilder mod, TypeBuilder type, bool bIsGlobalMethod) @@ -73,7 +73,7 @@ namespace System.Reflection.Emit mod, type, bIsGlobalMethod); } - private void Init(String name, MethodAttributes attributes, CallingConventions callingConvention, + private void Init(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers, ModuleBuilder mod, TypeBuilder type, bool bIsGlobalMethod) @@ -460,7 +460,7 @@ namespace System.Reflection.Emit #endregion #region Object Overrides - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (!(obj is MethodBuilder)) { @@ -489,7 +489,7 @@ namespace System.Reflection.Emit return this.m_strName.GetHashCode(); } - public override String ToString() + public override string ToString() { StringBuilder sb = new StringBuilder(1000); sb.Append("Name: " + m_strName + " " + Environment.NewLine); @@ -502,7 +502,7 @@ namespace System.Reflection.Emit #endregion #region MemberInfo Overrides - public override String Name + public override string Name { get { @@ -555,7 +555,7 @@ namespace System.Reflection.Emit #endregion #region MethodBase Overrides - public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } @@ -635,12 +635,12 @@ namespace System.Reflection.Emit #endregion #region ICustomAttributeProvider Implementation - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } @@ -817,7 +817,7 @@ namespace System.Reflection.Emit } - public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, String strParamName) + public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, string strParamName) { if (position < 0) throw new ArgumentOutOfRangeException(SR.ArgumentOutOfRange_ParamSequence); @@ -835,7 +835,7 @@ namespace System.Reflection.Emit private List<SymCustomAttr> m_symCustomAttrs; private struct SymCustomAttr { - public String m_name; + public string m_name; public byte[] m_data; } @@ -898,7 +898,7 @@ namespace System.Reflection.Emit return GetModuleBuilder(); } - public String Signature + public string Signature { get { @@ -979,13 +979,13 @@ namespace System.Reflection.Emit // and namespace information with a given active lexical scope. #region Internal Data Members - internal String[] m_strName; + internal string[] m_strName; internal byte[][] m_ubSignature; internal int[] m_iLocalSlot; internal int[] m_iStartOffset; internal int[] m_iEndOffset; internal int m_iLocalSymCount; // how many entries in the arrays are occupied - internal String[] m_namespace; + internal string[] m_namespace; internal int m_iNameSpaceCount; internal const int InitialSize = 16; #endregion @@ -1004,11 +1004,11 @@ namespace System.Reflection.Emit { if (m_iNameSpaceCount == 0) { - m_namespace = new String[InitialSize]; + m_namespace = new string[InitialSize]; } else if (m_iNameSpaceCount == m_namespace.Length) { - String[] strTemp = new String[checked(m_iNameSpaceCount * 2)]; + string[] strTemp = new string[checked(m_iNameSpaceCount * 2)]; Array.Copy(m_namespace, 0, strTemp, 0, m_iNameSpaceCount); m_namespace = strTemp; } @@ -1019,7 +1019,7 @@ namespace System.Reflection.Emit if (m_iLocalSymCount == 0) { // First time. Allocate the arrays. - m_strName = new String[InitialSize]; + m_strName = new string[InitialSize]; m_ubSignature = new byte[InitialSize][]; m_iLocalSlot = new int[InitialSize]; m_iStartOffset = new int[InitialSize]; @@ -1042,7 +1042,7 @@ namespace System.Reflection.Emit Array.Copy(m_iEndOffset, 0, temp, 0, m_iLocalSymCount); m_iEndOffset = temp; - String[] strTemp = new String[newSize]; + string[] strTemp = new string[newSize]; Array.Copy(m_strName, 0, strTemp, 0, m_iLocalSymCount); m_strName = strTemp; @@ -1055,7 +1055,7 @@ namespace System.Reflection.Emit #endregion #region Internal Members - internal void AddLocalSymInfo(String strName, byte[] signature, int slot, int startOffset, int endOffset) + internal void AddLocalSymInfo(string strName, byte[] signature, int slot, int startOffset, int endOffset) { // make sure that arrays are large enough to hold addition info EnsureCapacity(); @@ -1067,7 +1067,7 @@ namespace System.Reflection.Emit checked { m_iLocalSymCount++; } } - internal void AddUsingNamespace(String strNamespace) + internal void AddUsingNamespace(string strNamespace) { EnsureCapacityNamespace(); m_namespace[m_iNameSpaceCount] = strNamespace; @@ -1161,7 +1161,7 @@ namespace System.Reflection.Emit return m_exceptionClass ^ m_tryStartOffset ^ m_tryEndOffset ^ m_filterOffset ^ m_handlerStartOffset ^ m_handlerEndOffset ^ (int)m_kind; } - public override bool Equals(Object obj) + public override bool Equals(object obj) { return obj is ExceptionHandler && Equals((ExceptionHandler)obj); } diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs index 63f299a511..bbb7c11563 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs @@ -44,11 +44,11 @@ namespace System.Reflection.Emit #region MemberBase public override MemberTypes MemberType { get { return m_method.MemberType; } } - public override String Name { get { return m_method.Name; } } + public override string Name { get { return m_method.Name; } } public override Type DeclaringType { get { return m_method.DeclaringType; } } public override Type ReflectedType { get { return m_method.ReflectedType; } } - public override Object[] GetCustomAttributes(bool inherit) { return m_method.GetCustomAttributes(inherit); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_method.GetCustomAttributes(attributeType, inherit); } + public override object[] GetCustomAttributes(bool inherit) { return m_method.GetCustomAttributes(inherit); } + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_method.GetCustomAttributes(attributeType, inherit); } public override bool IsDefined(Type attributeType, bool inherit) { return m_method.IsDefined(attributeType, inherit); } public override Module Module { get { return m_method.Module; } } #endregion @@ -58,7 +58,7 @@ namespace System.Reflection.Emit public override MethodImplAttributes GetMethodImplementationFlags() { return m_method.GetMethodImplementationFlags(); } public override RuntimeMethodHandle MethodHandle { get { throw new NotSupportedException(SR.NotSupported_DynamicModule); } } public override MethodAttributes Attributes { get { return m_method.Attributes; } } - public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotSupportedException(); } diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodToken.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodToken.cs index 9698b07333..2c0a91872e 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodToken.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodToken.cs @@ -38,7 +38,7 @@ namespace System.Reflection.Emit return m_method; } - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (obj is MethodToken) return Equals((MethodToken)obj); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs index bb61fe09a6..5bdd623dcc 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs @@ -527,12 +527,12 @@ namespace System.Reflection.Emit #endregion #region ICustomAttributeProvider Members - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { return InternalModule.GetCustomAttributes(inherit); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return InternalModule.GetCustomAttributes(attributeType, inherit); } diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/ParameterBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/ParameterBuilder.cs index a875e3b943..2b0e18f4f8 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/ParameterBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/ParameterBuilder.cs @@ -22,7 +22,7 @@ namespace System.Reflection.Emit public class ParameterBuilder { // Set the default value of the parameter - public virtual void SetConstant(Object defaultValue) + public virtual void SetConstant(object defaultValue) { TypeBuilder.SetConstantValue( m_methodBuilder.GetModuleBuilder(), @@ -62,7 +62,7 @@ namespace System.Reflection.Emit MethodBuilder methodBuilder, int sequence, ParameterAttributes attributes, - String strParamName) // can be NULL string + string strParamName) // can be NULL string { m_iPosition = sequence; m_strParamName = strParamName; @@ -82,7 +82,7 @@ namespace System.Reflection.Emit return m_pdToken; } - public virtual String Name + public virtual string Name { get { return m_strParamName; } } @@ -110,7 +110,7 @@ namespace System.Reflection.Emit get { return ((m_attributes & ParameterAttributes.Optional) != 0); } } - private String m_strParamName; + private string m_strParamName; private int m_iPosition; private ParameterAttributes m_attributes; private MethodBuilder m_methodBuilder; diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/ParameterToken.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/ParameterToken.cs index 067bc2d010..edb3514609 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/ParameterToken.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/ParameterToken.cs @@ -41,7 +41,7 @@ namespace System.Reflection.Emit return m_tkParameter; } - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (obj is ParameterToken) return Equals((ParameterToken)obj); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.cs index 0fbdd8371b..3ebfbe9d09 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/PropertyBuilder.cs @@ -30,7 +30,7 @@ namespace System.Reflection.Emit // internal PropertyBuilder( ModuleBuilder mod, // the module containing this PropertyBuilder - String name, // property name + string name, // property name SignatureHelper sig, // property signature descriptor info PropertyAttributes attr, // property attribute such as DefaultProperty, Bindable, DisplayBind, etc Type returnType, // return type of the property. @@ -57,7 +57,7 @@ namespace System.Reflection.Emit //************************************************ // Set the default value of the Property //************************************************ - public void SetConstant(Object defaultValue) + public void SetConstant(object defaultValue) { m_containingType.ThrowIfCreated(); @@ -146,22 +146,22 @@ namespace System.Reflection.Emit } // Not supported functions in dynamic module. - public override Object GetValue(Object obj, Object[] index) + public override object GetValue(object obj, object[] index) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } - public override Object GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) + public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } - public override void SetValue(Object obj, Object value, Object[] index) + public override void SetValue(object obj, object value, object[] index) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } - public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) + public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } @@ -216,12 +216,12 @@ namespace System.Reflection.Emit get { if (m_setMethod != null) return true; else return false; } } - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(SR.NotSupported_DynamicModule); } @@ -231,7 +231,7 @@ namespace System.Reflection.Emit throw new NotSupportedException(SR.NotSupported_DynamicModule); } - public override String Name + public override string Name { get { return m_name; } } @@ -247,7 +247,7 @@ namespace System.Reflection.Emit } // These are package private so that TypeBuilder can access them. - private String m_name; // The name of the property + private string m_name; // The name of the property private PropertyToken m_prToken; // The token of this property private int m_tkProperty; private ModuleBuilder m_moduleBuilder; diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/PropertyToken.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/PropertyToken.cs index 02f34881f4..25b92244cc 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/PropertyToken.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/PropertyToken.cs @@ -41,7 +41,7 @@ namespace System.Reflection.Emit } // Satisfy value class requirements - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (obj is PropertyToken) return Equals((PropertyToken)obj); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs index d9490838aa..cad49cb1bc 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs @@ -820,7 +820,7 @@ namespace System.Reflection.Emit AddElementType(CorElementType.Sentinel); } - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (!(obj is SignatureHelper)) { @@ -888,7 +888,7 @@ namespace System.Reflection.Emit return m_signature; } - public override String ToString() + public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("Length: " + m_currSig + Environment.NewLine); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureToken.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureToken.cs index e17e0c955e..780c61e314 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureToken.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureToken.cs @@ -42,7 +42,7 @@ namespace System.Reflection.Emit return m_signature; } - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (obj is SignatureToken) return Equals((SignatureToken)obj); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/StringToken.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/StringToken.cs index cc5b734ae8..936d56953c 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/StringToken.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/StringToken.cs @@ -44,7 +44,7 @@ namespace System.Reflection.Emit return m_string; } - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (obj is StringToken) return Equals((StringToken)obj); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/SymbolMethod.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/SymbolMethod.cs index 5e5668ac7b..5c644b648e 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/SymbolMethod.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/SymbolMethod.cs @@ -16,7 +16,7 @@ namespace System.Reflection.Emit #region Private Data Members private ModuleBuilder m_module; private Type m_containingType; - private String m_name; + private string m_name; private CallingConventions m_callingConvention; private Type m_returnType; private MethodToken m_mdMethod; @@ -25,7 +25,7 @@ namespace System.Reflection.Emit #endregion #region Constructor - internal SymbolMethod(ModuleBuilder mod, MethodToken token, Type arrayClass, String methodName, + internal SymbolMethod(ModuleBuilder mod, MethodToken token, Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) { // This is a kind of MethodInfo to represent methods for array type of unbaked type @@ -83,7 +83,7 @@ namespace System.Reflection.Emit get { return m_containingType as Type; } } - public override String Name + public override string Name { get { return m_name; } } @@ -136,7 +136,7 @@ namespace System.Reflection.Emit get { return null; } } - public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotSupportedException(SR.NotSupported_SymbolMethod); } @@ -148,12 +148,12 @@ namespace System.Reflection.Emit #endregion #region ICustomAttributeProvider Implementation - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { throw new NotSupportedException(SR.NotSupported_SymbolMethod); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(SR.NotSupported_SymbolMethod); } diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/SymbolType.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/SymbolType.cs index 07fd6d922d..d550dbbd4e 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/SymbolType.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/SymbolType.cs @@ -322,8 +322,8 @@ namespace System.Reflection.Emit get { throw new NotSupportedException(SR.NotSupported_NonReflectedType); } } - public override Object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, Object target, - Object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) + public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, + object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) { throw new NotSupportedException(SR.NotSupported_NonReflectedType); } @@ -555,12 +555,12 @@ namespace System.Reflection.Emit get { return this; } } - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { throw new NotSupportedException(SR.NotSupported_NonReflectedType); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(SR.NotSupported_NonReflectedType); } diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs index ee7efbbf6b..5f662fa25f 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs @@ -264,7 +264,7 @@ namespace System.Reflection.Emit } // If the type builder view is eqaul then it is equal - if (tb1 != null && tb2 != null && Object.ReferenceEquals(tb1, tb2)) + if (tb1 != null && tb2 != null && object.ReferenceEquals(tb1, tb2)) return true; // if the runtimetype view is eqaul than it is equal @@ -274,7 +274,7 @@ namespace System.Reflection.Emit return false; } - internal static unsafe void SetConstantValue(ModuleBuilder module, int tk, Type destType, Object value) + internal static unsafe void SetConstantValue(ModuleBuilder module, int tk, Type destType, object value) { // This is a helper function that is used by ParameterBuilder, PropertyBuilder, // and FieldBuilder to validate a default value and save it in the meta-data. @@ -787,8 +787,8 @@ namespace System.Reflection.Emit } } - public override Object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, Object target, - Object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) + public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, + object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) { if (!IsCreated()) throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated); @@ -1178,7 +1178,7 @@ namespace System.Reflection.Emit #endregion #region ICustomAttributeProvider Implementation - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { if (!IsCreated()) throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated); @@ -1186,7 +1186,7 @@ namespace System.Reflection.Emit return CustomAttribute.GetCustomAttributes(m_bakedRuntimeType, typeof(object) as RuntimeType, inherit); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (!IsCreated()) throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated); @@ -2049,7 +2049,7 @@ namespace System.Reflection.Emit { if ((m_iAttr & TypeAttributes.Interface) != TypeAttributes.Interface) { - m_typeParent = typeof(Object); + m_typeParent = typeof(object); } else { diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs index 677f51c610..0b3d75cca3 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs @@ -102,7 +102,7 @@ namespace System.Reflection.Emit return SymbolType.FormCompoundType(s, this, 0); } public override Guid GUID { get { throw new NotSupportedException(); } } - public override Object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) { throw new NotSupportedException(); } + public override object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) { throw new NotSupportedException(); } public override Assembly Assembly { get { return m_type.Assembly; } } public override RuntimeTypeHandle TypeHandle { get { throw new NotSupportedException(); } } public override string FullName @@ -230,9 +230,9 @@ namespace System.Reflection.Emit #endregion #region ICustomAttributeProvider Implementation - public override Object[] GetCustomAttributes(bool inherit) { throw new NotSupportedException(); } + public override object[] GetCustomAttributes(bool inherit) { throw new NotSupportedException(); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(); } + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(); } public override bool IsDefined(Type attributeType, bool inherit) { throw new NotSupportedException(); } #endregion diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeToken.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeToken.cs index 15a0816a50..4825a04f24 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeToken.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeToken.cs @@ -41,7 +41,7 @@ namespace System.Reflection.Emit return m_class; } - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (obj is TypeToken) return Equals((TypeToken)obj); diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs index 715fe01f54..633811232f 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs @@ -44,11 +44,11 @@ namespace System.Reflection.Emit #region MemberInfo Overrides public override MemberTypes MemberType { get { return m_method.MemberType; } } - public override String Name { get { return m_method.Name; } } + public override string Name { get { return m_method.Name; } } public override Type DeclaringType { get { return m_type; } } public override Type ReflectedType { get { return m_type; } } - public override Object[] GetCustomAttributes(bool inherit) { return m_method.GetCustomAttributes(inherit); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_method.GetCustomAttributes(attributeType, inherit); } + public override object[] GetCustomAttributes(bool inherit) { return m_method.GetCustomAttributes(inherit); } + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_method.GetCustomAttributes(attributeType, inherit); } public override bool IsDefined(Type attributeType, bool inherit) { return m_method.IsDefined(attributeType, inherit); } public override Module Module { get { return m_method.Module; } } #endregion @@ -58,7 +58,7 @@ namespace System.Reflection.Emit public override MethodImplAttributes GetMethodImplementationFlags() { return m_method.GetMethodImplementationFlags(); } public override RuntimeMethodHandle MethodHandle { get { return m_method.MethodHandle; } } public override MethodAttributes Attributes { get { return m_method.Attributes; } } - public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotSupportedException(); } @@ -123,11 +123,11 @@ namespace System.Reflection.Emit #region MemberInfo Overrides public override MemberTypes MemberType { get { return m_ctor.MemberType; } } - public override String Name { get { return m_ctor.Name; } } + public override string Name { get { return m_ctor.Name; } } public override Type DeclaringType { get { return m_type; } } public override Type ReflectedType { get { return m_type; } } - public override Object[] GetCustomAttributes(bool inherit) { return m_ctor.GetCustomAttributes(inherit); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_ctor.GetCustomAttributes(attributeType, inherit); } + public override object[] GetCustomAttributes(bool inherit) { return m_ctor.GetCustomAttributes(inherit); } + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_ctor.GetCustomAttributes(attributeType, inherit); } public override bool IsDefined(Type attributeType, bool inherit) { return m_ctor.IsDefined(attributeType, inherit); } internal int MetadataTokenInternal { @@ -152,7 +152,7 @@ namespace System.Reflection.Emit public override MethodImplAttributes GetMethodImplementationFlags() { return m_ctor.GetMethodImplementationFlags(); } public override RuntimeMethodHandle MethodHandle { get { return m_ctor.MethodHandle; } } public override MethodAttributes Attributes { get { return m_ctor.Attributes; } } - public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new NotSupportedException(); } @@ -165,7 +165,7 @@ namespace System.Reflection.Emit #endregion #region ConstructorInfo Members - public override Object Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { throw new InvalidOperationException(); } @@ -224,11 +224,11 @@ namespace System.Reflection.Emit #region MemberInfo Overrides public override MemberTypes MemberType { get { return System.Reflection.MemberTypes.Field; } } - public override String Name { get { return m_field.Name; } } + public override string Name { get { return m_field.Name; } } public override Type DeclaringType { get { return m_type; } } public override Type ReflectedType { get { return m_type; } } - public override Object[] GetCustomAttributes(bool inherit) { return m_field.GetCustomAttributes(inherit); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_field.GetCustomAttributes(attributeType, inherit); } + public override object[] GetCustomAttributes(bool inherit) { return m_field.GetCustomAttributes(inherit); } + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return m_field.GetCustomAttributes(attributeType, inherit); } public override bool IsDefined(Type attributeType, bool inherit) { return m_field.IsDefined(attributeType, inherit); } internal int MetadataTokenInternal { @@ -251,11 +251,11 @@ namespace System.Reflection.Emit #region Public Abstract\Virtual Members public override Type[] GetRequiredCustomModifiers() { return m_field.GetRequiredCustomModifiers(); } public override Type[] GetOptionalCustomModifiers() { return m_field.GetOptionalCustomModifiers(); } - public override void SetValueDirect(TypedReference obj, Object value) + public override void SetValueDirect(TypedReference obj, object value) { throw new NotImplementedException(); } - public override Object GetValueDirect(TypedReference obj) + public override object GetValueDirect(TypedReference obj) { throw new NotImplementedException(); } @@ -264,8 +264,8 @@ namespace System.Reflection.Emit get { throw new NotImplementedException(); } } public override Type FieldType { get { throw new NotImplementedException(); } } - public override Object GetValue(Object obj) { throw new InvalidOperationException(); } - public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) { throw new InvalidOperationException(); } + public override object GetValue(object obj) { throw new InvalidOperationException(); } + public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) { throw new InvalidOperationException(); } public override FieldAttributes Attributes { get { return m_field.Attributes; } } #endregion } diff --git a/src/System.Private.CoreLib/src/System/Reflection/MdConstant.cs b/src/System.Private.CoreLib/src/System/Reflection/MdConstant.cs index b959b2ccf1..a2fd72ecc3 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/MdConstant.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/MdConstant.cs @@ -10,7 +10,7 @@ namespace System.Reflection { internal static class MdConstant { - public static unsafe Object GetValue(MetadataImport scope, int token, RuntimeTypeHandle fieldTypeHandle, bool raw) + public static unsafe object GetValue(MetadataImport scope, int token, RuntimeTypeHandle fieldTypeHandle, bool raw) { CorElementType corElementType = 0; long buffer = 0; diff --git a/src/System.Private.CoreLib/src/System/Reflection/MdFieldInfo.cs b/src/System.Private.CoreLib/src/System/Reflection/MdFieldInfo.cs index 94416d7aa3..517b2285c5 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/MdFieldInfo.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/MdFieldInfo.cs @@ -43,7 +43,7 @@ namespace System.Reflection #endregion #region MemberInfo Overrides - public override String Name + public override string Name { get { @@ -68,32 +68,32 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override Object GetValueDirect(TypedReference obj) + public override object GetValueDirect(TypedReference obj) { return GetValue(null); } [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override void SetValueDirect(TypedReference obj, Object value) + public override void SetValueDirect(TypedReference obj, object value) { throw new FieldAccessException(SR.Acc_ReadOnly); } [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public unsafe override Object GetValue(Object obj) + public unsafe override object GetValue(object obj) { return GetValue(false); } - public unsafe override Object GetRawConstantValue() { return GetValue(true); } + public unsafe override object GetRawConstantValue() { return GetValue(true); } - private unsafe Object GetValue(bool raw) + private unsafe object GetValue(bool raw) { // Cannot cache these because they could be user defined non-agile enumerations - Object value = MdConstant.GetValue(GetRuntimeModule().MetadataImport, m_tkField, FieldType.GetTypeHandleInternal(), raw); + object value = MdConstant.GetValue(GetRuntimeModule().MetadataImport, m_tkField, FieldType.GetTypeHandleInternal(), raw); if (value == DBNull.Value) throw new NotSupportedException(SR.Arg_EnumLitValueNotFound); @@ -103,7 +103,7 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) + public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) { throw new FieldAccessException(SR.Acc_ReadOnly); } diff --git a/src/System.Private.CoreLib/src/System/Reflection/MethodBase.CoreCLR.cs b/src/System.Private.CoreLib/src/System/Reflection/MethodBase.CoreCLR.cs index 09d3520120..c6f01c67f6 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/MethodBase.CoreCLR.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/MethodBase.CoreCLR.cs @@ -127,16 +127,16 @@ namespace System.Reflection return parameterTypes; } - internal Object[] CheckArguments(Object[] parameters, Binder binder, + internal object[] CheckArguments(object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig) { // copy the arguments in a different array so we detach from any user changes - Object[] copyOfParameters = new Object[parameters.Length]; + object[] copyOfParameters = new object[parameters.Length]; ParameterInfo[] p = null; for (int i = 0; i < parameters.Length; i++) { - Object arg = parameters[i]; + object arg = parameters[i]; RuntimeType argRT = sig.Arguments[i]; if (arg == Type.Missing) diff --git a/src/System.Private.CoreLib/src/System/Reflection/RtFieldInfo.cs b/src/System.Private.CoreLib/src/System/Reflection/RtFieldInfo.cs index e5032bedc5..6172ec469a 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/RtFieldInfo.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/RtFieldInfo.cs @@ -89,7 +89,7 @@ namespace System.Reflection #endregion #region Internal Members - internal void CheckConsistency(Object target) + internal void CheckConsistency(object target) { // only test instance fields if ((m_fieldAttributes & FieldAttributes.Static) != FieldAttributes.Static) @@ -122,7 +122,7 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - internal void InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, ref StackCrawlMark stackMark) + internal void InternalSetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, ref StackCrawlMark stackMark) { INVOCATION_FLAGS invocationFlags = InvocationFlags; RuntimeType declaringType = DeclaringType as RuntimeType; @@ -164,7 +164,7 @@ namespace System.Reflection // calling this method. [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - internal void UnsafeSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) + internal void UnsafeSetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) { RuntimeType declaringType = DeclaringType as RuntimeType; RuntimeType fieldType = (RuntimeType)FieldType; @@ -185,7 +185,7 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - internal Object InternalGetValue(Object obj, ref StackCrawlMark stackMark) + internal object InternalGetValue(object obj, ref StackCrawlMark stackMark) { INVOCATION_FLAGS invocationFlags = InvocationFlags; RuntimeType declaringType = DeclaringType as RuntimeType; @@ -214,7 +214,7 @@ namespace System.Reflection // calling this method. [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - internal Object UnsafeGetValue(Object obj) + internal object UnsafeGetValue(object obj) { RuntimeType declaringType = DeclaringType as RuntimeType; @@ -269,7 +269,7 @@ namespace System.Reflection #endregion #region FieldInfo Overrides - public override Object GetValue(Object obj) + public override object GetValue(object obj) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; return InternalGetValue(obj, ref stackMark); @@ -279,7 +279,7 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override Object GetValueDirect(TypedReference obj) + public override object GetValueDirect(TypedReference obj) { if (obj.IsNull) throw new ArgumentException(SR.Arg_TypedReference_Null); @@ -293,7 +293,7 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) + public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; InternalSetValue(obj, value, invokeAttr, binder, culture, ref stackMark); @@ -301,7 +301,7 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override void SetValueDirect(TypedReference obj, Object value) + public override void SetValueDirect(TypedReference obj, object value) { if (obj.IsNull) throw new ArgumentException(SR.Arg_TypedReference_Null); diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs index f7fc0848d0..ae2e79f844 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs @@ -167,7 +167,7 @@ namespace System.Reflection throw new ArgumentNullException(nameof(name)); RuntimeType type = null; - Object keepAlive = null; + object keepAlive = null; GetType(GetNativeHandle(), name, throwOnError, ignoreCase, JitHelpers.GetObjectHandleOnStack(ref type), JitHelpers.GetObjectHandleOnStack(ref keepAlive)); GC.KeepAlive(keepAlive); @@ -232,12 +232,12 @@ namespace System.Reflection } } - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException(nameof(attributeType)); @@ -502,7 +502,7 @@ namespace System.Reflection } } - public override Int64 HostContext + public override long HostContext { get { @@ -583,7 +583,7 @@ namespace System.Reflection if (pbInMemoryResource != null) { //Console.WriteLine("Creating an unmanaged memory stream of length "+length); - if (length > Int64.MaxValue) + if (length > long.MaxValue) throw new NotImplementedException(SR.NotImplemented_ResourcesLongerThanInt64Max); return new UnmanagedMemoryStream(pbInMemoryResource, (long)length, (long)length, FileAccess.Read); diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs index 59f3b5093c..5e9d5e33a8 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs @@ -120,7 +120,7 @@ namespace System.Reflection } } - private void CheckConsistency(Object target) + private void CheckConsistency(object target) { if (target == null && IsStatic) return; @@ -149,12 +149,12 @@ namespace System.Reflection #endregion #region ICustomAttributeProvider - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException(nameof(attributeType)); @@ -335,8 +335,8 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override Object Invoke( - Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke( + object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { INVOCATION_FLAGS invocationFlags = InvocationFlags; @@ -358,8 +358,8 @@ namespace System.Reflection bool wrapExceptions = (invokeAttr & BindingFlags.DoNotWrapExceptions) == 0; if (actualCount > 0) { - Object[] arguments = CheckArguments(parameters, binder, invokeAttr, culture, sig); - Object retValue = RuntimeMethodHandle.InvokeMethod(obj, arguments, sig, false, wrapExceptions); + object[] arguments = CheckArguments(parameters, binder, invokeAttr, culture, sig); + object retValue = RuntimeMethodHandle.InvokeMethod(obj, arguments, sig, false, wrapExceptions); // copy out. This should be made only if ByRef are present. for (int index = 0; index < arguments.Length; index++) parameters[index] = arguments[index]; @@ -403,7 +403,7 @@ namespace System.Reflection #region ConstructorInfo Overrides [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override Object Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { INVOCATION_FLAGS invocationFlags = InvocationFlags; @@ -428,8 +428,8 @@ namespace System.Reflection bool wrapExceptions = (invokeAttr & BindingFlags.DoNotWrapExceptions) == 0; if (actualCount > 0) { - Object[] arguments = CheckArguments(parameters, binder, invokeAttr, culture, sig); - Object retValue = RuntimeMethodHandle.InvokeMethod(null, arguments, sig, true, wrapExceptions); + object[] arguments = CheckArguments(parameters, binder, invokeAttr, culture, sig); + object retValue = RuntimeMethodHandle.InvokeMethod(null, arguments, sig, true, wrapExceptions); // copy out. This should be made only if ByRef are present. for (int index = 0; index < arguments.Length; index++) parameters[index] = arguments[index]; diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimeEventInfo.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimeEventInfo.cs index 4152f2bdd6..ef287b4b5f 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/RuntimeEventInfo.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/RuntimeEventInfo.cs @@ -70,7 +70,7 @@ namespace System.Reflection #endregion #region Object Overrides - public override String ToString() + public override string ToString() { if (m_addMethod == null || m_addMethod.GetParametersNoCopy().Length == 0) throw new InvalidOperationException(SR.InvalidOperation_NoPublicAddMethod); @@ -80,12 +80,12 @@ namespace System.Reflection #endregion #region ICustomAttributeProvider - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException(nameof(attributeType)); @@ -119,7 +119,7 @@ namespace System.Reflection #region MemberInfo Overrides public override MemberTypes MemberType { get { return MemberTypes.Event; } } - public override String Name + public override string Name { get { diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs index 56f89e618f..7b35cd701e 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs @@ -71,19 +71,19 @@ namespace System.Reflection #endregion #region Object Overrides - public unsafe override String ToString() + public unsafe override string ToString() { return FieldType.FormatTypeName() + " " + Name; } #endregion #region ICustomAttributeProvider - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException(nameof(attributeType)); diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs index 8bebfb3e70..b58f95645a 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs @@ -194,7 +194,7 @@ namespace System.Reflection #endregion #region Object Overrides - public override String ToString() + public override string ToString() { if (m_toString == null) m_toString = ReturnType.FormatTypeName() + " " + FormatNameAndSig(); @@ -255,12 +255,12 @@ namespace System.Reflection #endregion #region ICustomAttributeProvider - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType as RuntimeType, inherit); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException(nameof(attributeType)); @@ -293,7 +293,7 @@ namespace System.Reflection #endregion #region MemberInfo Overrides - public override String Name + public override string Name { get { @@ -410,7 +410,7 @@ namespace System.Reflection #endregion #region Invocation Logic(On MemberBase) - private void CheckConsistency(Object target) + private void CheckConsistency(object target) { // only test instance methods if ((m_methodAttributes & MethodAttributes.Static) != MethodAttributes.Static) @@ -467,7 +467,7 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { object[] arguments = InvokeArgumentsCheck(obj, invokeAttr, binder, parameters, culture); @@ -476,7 +476,7 @@ namespace System.Reflection return RuntimeMethodHandle.InvokeMethod(obj, null, Signature, false, wrapExceptions); else { - Object retValue = RuntimeMethodHandle.InvokeMethod(obj, arguments, Signature, false, wrapExceptions); + object retValue = RuntimeMethodHandle.InvokeMethod(obj, arguments, Signature, false, wrapExceptions); // copy out. This should be made only if ByRef are present. for (int index = 0; index < arguments.Length; index++) @@ -488,7 +488,7 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - private object[] InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) + private object[] InvokeArgumentsCheck(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { Signature sig = Signature; @@ -580,7 +580,7 @@ namespace System.Reflection DelegateBindingFlags.OpenDelegateOnly | DelegateBindingFlags.RelaxedSignature); } - public override Delegate CreateDelegate(Type delegateType, Object target) + public override Delegate CreateDelegate(Type delegateType, object target) { // This API is new in Whidbey and allows the full range of delegate // flexability (open or closed delegates binding to static or @@ -593,7 +593,7 @@ namespace System.Reflection DelegateBindingFlags.RelaxedSignature); } - private Delegate CreateDelegateInternal(Type delegateType, Object firstArgument, DelegateBindingFlags bindingFlags) + private Delegate CreateDelegateInternal(Type delegateType, object firstArgument, DelegateBindingFlags bindingFlags) { // Validate the parameters. if (delegateType == null) diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs index 600147c77d..b33f004198 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs @@ -400,12 +400,12 @@ namespace System.Reflection #endregion #region ICustomAttributeProvider Members - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException(nameof(attributeType)); @@ -450,7 +450,7 @@ namespace System.Reflection throw new ArgumentNullException(nameof(className)); RuntimeType retType = null; - Object keepAlive = null; + object keepAlive = null; GetType(GetNativeHandle(), className, throwOnError, ignoreCase, JitHelpers.GetObjectHandleOnStack(ref retType), JitHelpers.GetObjectHandleOnStack(ref keepAlive)); GC.KeepAlive(keepAlive); return retType; diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs index 1bd053ee82..2762ecf02a 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs @@ -201,7 +201,7 @@ namespace System.Reflection } // ctor for no metadata MethodInfo in the DynamicMethod and RuntimeMethodInfo cases - internal RuntimeParameterInfo(MethodInfo owner, String name, Type parameterType, int position) + internal RuntimeParameterInfo(MethodInfo owner, string name, Type parameterType, int position) { MemberImpl = owner; NameImpl = name; @@ -238,7 +238,7 @@ namespace System.Reflection } } - public override String Name + public override string Name { get { @@ -274,10 +274,10 @@ namespace System.Reflection } } - public override Object DefaultValue { get { return GetDefaultValue(false); } } - public override Object RawDefaultValue { get { return GetDefaultValue(true); } } + public override object DefaultValue { get { return GetDefaultValue(false); } } + public override object RawDefaultValue { get { return GetDefaultValue(true); } } - private Object GetDefaultValue(bool raw) + private object GetDefaultValue(bool raw) { // OLD COMMENT (Is this even true?) // Cannot cache because default value could be non-agile user defined enumeration. @@ -303,7 +303,7 @@ namespace System.Reflection } // returns DBNull.Value if the parameter doesn't have a default value - private Object GetDefaultValueInternal(bool raw) + private object GetDefaultValueInternal(bool raw) { Debug.Assert(!m_noMetadata); @@ -371,7 +371,7 @@ namespace System.Reflection } else { - Object[] CustomAttrs = GetCustomAttributes(s_CustomConstantAttributeType, false); + object[] CustomAttrs = GetCustomAttributes(s_CustomConstantAttributeType, false); if (CustomAttrs.Length != 0) { defaultValue = ((CustomConstantAttribute)CustomAttrs[0]).Value; @@ -394,7 +394,7 @@ namespace System.Reflection return defaultValue; } - private static Decimal GetRawDecimalConstant(CustomAttributeData attr) + private static decimal GetRawDecimalConstant(CustomAttributeData attr) { Debug.Assert(attr.Constructor.DeclaringType == typeof(DecimalConstantAttribute)); @@ -404,7 +404,7 @@ namespace System.Reflection { // This is not possible because Decimal cannot be represented directly in the metadata. Debug.Fail("Decimal cannot be represented directly in the metadata."); - return (Decimal)namedArgument.TypedValue.Value; + return (decimal)namedArgument.TypedValue.Value; } } @@ -417,9 +417,9 @@ namespace System.Reflection if (parameters[2].ParameterType == typeof(uint)) { // DecimalConstantAttribute(byte scale, byte sign, uint hi, uint mid, uint low) - int low = (int)(UInt32)args[4].Value; - int mid = (int)(UInt32)args[3].Value; - int hi = (int)(UInt32)args[2].Value; + int low = (int)(uint)args[4].Value; + int mid = (int)(uint)args[3].Value; + int hi = (int)(uint)args[2].Value; byte sign = (byte)args[1].Value; byte scale = (byte)args[0].Value; @@ -505,21 +505,21 @@ namespace System.Reflection #endregion #region ICustomAttributeProvider - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { if (MdToken.IsNullToken(m_tkParamDef)) - return Array.Empty<Object>(); + return Array.Empty<object>(); return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException(nameof(attributeType)); if (MdToken.IsNullToken(m_tkParamDef)) - return Array.Empty<Object>(); + return Array.Empty<object>(); RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType; diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs index 1e64da2123..880e826bbc 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/RuntimePropertyInfo.cs @@ -120,7 +120,7 @@ namespace System.Reflection #endregion #region Object Overrides - public override String ToString() + public override string ToString() { return FormatNameAndSig(false); } @@ -145,12 +145,12 @@ namespace System.Reflection #endregion #region ICustomAttributeProvider - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException(nameof(attributeType)); @@ -184,7 +184,7 @@ namespace System.Reflection #region MemberInfo Overrides public override MemberTypes MemberType { get { return MemberTypes.Property; } } - public override String Name + public override string Name { get { @@ -242,7 +242,7 @@ namespace System.Reflection internal object GetConstantValue(bool raw) { - Object defaultValue = MdConstant.GetValue(GetRuntimeModule().MetadataImport, m_token, PropertyType.GetTypeHandleInternal(), raw); + object defaultValue = MdConstant.GetValue(GetRuntimeModule().MetadataImport, m_token, PropertyType.GetTypeHandleInternal(), raw); if (defaultValue == DBNull.Value) // Arg_EnumLitValueNotFound -> "Literal value was not found." @@ -385,7 +385,7 @@ namespace System.Reflection #region Dynamic [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override Object GetValue(Object obj, Object[] index) + public override object GetValue(object obj, object[] index) { return GetValue(obj, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static, null, index, null); @@ -393,7 +393,7 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override Object GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) + public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { MethodInfo m = GetGetMethod(true); if (m == null) @@ -403,7 +403,7 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override void SetValue(Object obj, Object value, Object[] index) + public override void SetValue(object obj, object value, object[] index) { SetValue(obj, value, @@ -415,18 +415,18 @@ namespace System.Reflection [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) + public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { MethodInfo m = GetSetMethod(true); if (m == null) throw new ArgumentException(System.SR.Arg_SetMethNotFnd); - Object[] args = null; + object[] args = null; if (index != null) { - args = new Object[index.Length + 1]; + args = new object[index.Length + 1]; for (int i = 0; i < index.Length; i++) args[i] = index[i]; @@ -435,7 +435,7 @@ namespace System.Reflection } else { - args = new Object[1]; + args = new object[1]; args[0] = value; } diff --git a/src/System.Private.CoreLib/src/System/Resources/FileBasedResourceGroveler.cs b/src/System.Private.CoreLib/src/System/Resources/FileBasedResourceGroveler.cs index 12e0832f61..eafffd34cf 100644 --- a/src/System.Private.CoreLib/src/System/Resources/FileBasedResourceGroveler.cs +++ b/src/System.Private.CoreLib/src/System/Resources/FileBasedResourceGroveler.cs @@ -34,16 +34,16 @@ namespace System.Resources // Consider modifying IResourceGroveler interface (hence this method signature) when we figure out // serialization compat story for moving ResourceManager members to either file-based or // manifest-based classes. Want to continue tightening the design to get rid of unused params. - public ResourceSet GrovelForResourceSet(CultureInfo culture, Dictionary<String, ResourceSet> localResourceSets, bool tryParents, bool createIfNotExists, ref StackCrawlMark stackMark) + public ResourceSet GrovelForResourceSet(CultureInfo culture, Dictionary<string, ResourceSet> localResourceSets, bool tryParents, bool createIfNotExists, ref StackCrawlMark stackMark) { Debug.Assert(culture != null, "culture shouldn't be null; check caller"); - String fileName = null; + string fileName = null; ResourceSet rs = null; // Don't use Assembly manifest, but grovel on disk for a file. // Create new ResourceSet, if a file exists on disk for it. - String tempFileName = _mediator.GetResourceFileName(culture); + string tempFileName = _mediator.GetResourceFileName(culture); fileName = FindResourceFile(culture, tempFileName); if (fileName == null) { @@ -73,7 +73,7 @@ namespace System.Resources // diretory or the module dir wasn't provided, look in the current // directory. - private String FindResourceFile(CultureInfo culture, String fileName) + private string FindResourceFile(CultureInfo culture, string fileName) { Debug.Assert(culture != null, "culture shouldn't be null; check caller"); Debug.Assert(fileName != null, "fileName shouldn't be null; check caller"); @@ -82,7 +82,7 @@ namespace System.Resources // qualified name, append path to that. if (_mediator.ModuleDir != null) { - String path = Path.Combine(_mediator.ModuleDir, fileName); + string path = Path.Combine(_mediator.ModuleDir, fileName); if (File.Exists(path)) { return path; @@ -97,7 +97,7 @@ namespace System.Resources } // Constructs a new ResourceSet for a given file name. - private ResourceSet CreateResourceSet(String file) + private ResourceSet CreateResourceSet(string file) { Debug.Assert(file != null, "file shouldn't be null; check caller"); @@ -107,7 +107,7 @@ namespace System.Resources } else { - Object[] args = new Object[1]; + object[] args = new object[1]; args[0] = file; try { diff --git a/src/System.Private.CoreLib/src/System/Resources/IResourceGroveler.cs b/src/System.Private.CoreLib/src/System/Resources/IResourceGroveler.cs index bdd8826c77..8151a7a675 100644 --- a/src/System.Private.CoreLib/src/System/Resources/IResourceGroveler.cs +++ b/src/System.Private.CoreLib/src/System/Resources/IResourceGroveler.cs @@ -23,7 +23,7 @@ namespace System.Resources { internal interface IResourceGroveler { - ResourceSet GrovelForResourceSet(CultureInfo culture, Dictionary<String, ResourceSet> localResourceSets, bool tryParents, + ResourceSet GrovelForResourceSet(CultureInfo culture, Dictionary<string, ResourceSet> localResourceSets, bool tryParents, bool createIfNotExists, ref StackCrawlMark stackMark); } } diff --git a/src/System.Private.CoreLib/src/System/Resources/ManifestBasedResourceGroveler.cs b/src/System.Private.CoreLib/src/System/Resources/ManifestBasedResourceGroveler.cs index 024889252e..22d5445a92 100644 --- a/src/System.Private.CoreLib/src/System/Resources/ManifestBasedResourceGroveler.cs +++ b/src/System.Private.CoreLib/src/System/Resources/ManifestBasedResourceGroveler.cs @@ -178,7 +178,7 @@ namespace System.Resources // Note we could go into infinite loops if mscorlib's // NeutralResourcesLanguageAttribute is mangled. If this assert // fires, please fix the build process for the BCL directory. - if (a == typeof(Object).Assembly) + if (a == typeof(object).Assembly) { Debug.Fail(System.CoreLib.Name + "'s NeutralResourcesLanguageAttribute is a malformed culture name! name: \"" + cultureName + "\" Exception: " + e); return CultureInfo.InvariantCulture; @@ -204,7 +204,7 @@ namespace System.Resources // not disposing because we want to leave stream open BinaryReader br = new BinaryReader(store); - // Look for our magic number as a little endian Int32. + // Look for our magic number as a little endian int. int bytes = br.ReadInt32(); if (bytes == ResourceManager.MagicNumber) { @@ -251,11 +251,11 @@ namespace System.Resources { // we do not want to use partial binding here. Type readerType = Type.GetType(readerTypeName, true); - Object[] args = new Object[1]; + object[] args = new object[1]; args[0] = store; IResourceReader reader = (IResourceReader)Activator.CreateInstance(readerType, args); - Object[] resourceSetArgs = new Object[1]; + object[] resourceSetArgs = new object[1]; resourceSetArgs[0] = reader; Type resSetType; @@ -287,7 +287,7 @@ namespace System.Resources } else { - Object[] args = new Object[2]; + object[] args = new object[2]; args[0] = store; args[1] = assembly; try @@ -301,7 +301,7 @@ namespace System.Resources } catch (MissingMethodException) { } - args = new Object[1]; + args = new object[1]; args[0] = store; rs = (ResourceSet)Activator.CreateInstance(_mediator.UserResourceSet, args); @@ -501,7 +501,7 @@ namespace System.Resources private void HandleResourceStreamMissing(string fileName) { // Keep people from bothering me about resources problems - if (_mediator.MainAssembly == typeof(Object).Assembly && _mediator.BaseName.Equals(System.CoreLib.Name)) + if (_mediator.MainAssembly == typeof(object).Assembly && _mediator.BaseName.Equals(System.CoreLib.Name)) { // This would break CultureInfo & all our exceptions. Debug.Fail("Couldn't get " + System.CoreLib.Name + ResourceManager.ResFileExtension + " from " + System.CoreLib.Name + "'s assembly" + Environment.NewLine + Environment.NewLine + "Are you building the runtime on your machine? Chances are the BCL directory didn't build correctly. Type 'build -c' in the BCL directory. If you get build errors, look at buildd.log. If you then can't figure out what's wrong (and you aren't changing the assembly-related metadata code), ask a BCL dev.\n\nIf you did NOT build the runtime, you shouldn't be seeing this and you've found a bug."); diff --git a/src/System.Private.CoreLib/src/System/Resources/ResourceManager.cs b/src/System.Private.CoreLib/src/System/Resources/ResourceManager.cs index 6294f0988b..49b01734a7 100644 --- a/src/System.Private.CoreLib/src/System/Resources/ResourceManager.cs +++ b/src/System.Private.CoreLib/src/System/Resources/ResourceManager.cs @@ -263,7 +263,7 @@ namespace System.Resources // This isn't for security reasons, but to ensure we can make // breaking changes to mscorlib's internal resources without // assuming users may have taken a dependency on them. - if (assembly == typeof(Object).Assembly && _callingAssembly != assembly) + if (assembly == typeof(object).Assembly && _callingAssembly != assembly) { _callingAssembly = null; } @@ -293,7 +293,7 @@ namespace System.Resources // This isn't for security reasons, but to ensure we can make // breaking changes to mscorlib's internal resources without // assuming users may have taken a dependency on them. - if (assembly == typeof(Object).Assembly && _callingAssembly != assembly) + if (assembly == typeof(object).Assembly && _callingAssembly != assembly) _callingAssembly = null; } @@ -316,7 +316,7 @@ namespace System.Resources _callingAssembly = (RuntimeAssembly)Assembly.GetCallingAssembly(); // Special case for mscorlib - protect mscorlib's private resources. - if (MainAssembly == typeof(Object).Assembly && _callingAssembly != MainAssembly) + if (MainAssembly == typeof(object).Assembly && _callingAssembly != MainAssembly) { _callingAssembly = null; } @@ -616,7 +616,7 @@ namespace System.Resources ResourceSet lostRace; if (localResourceSets.TryGetValue(cultureName, out lostRace)) { - if (!Object.ReferenceEquals(lostRace, rs)) + if (!object.ReferenceEquals(lostRace, rs)) { // Note: In certain cases, we can be trying to add a ResourceSet for multiple // cultures on one thread, while a second thread added another ResourceSet for one @@ -676,7 +676,7 @@ namespace System.Resources // Now, compare assembly display names (IGNORES VERSION AND PROCESSORARCHITECTURE) // also, for mscorlib ignores everything, since that's what the binder is going to do - while (Char.IsWhiteSpace(asmTypeName1[++comma])) ; + while (char.IsWhiteSpace(asmTypeName1[++comma])) ; // case insensitive AssemblyName an1 = new AssemblyName(asmTypeName1.Substring(comma)); @@ -768,7 +768,7 @@ namespace System.Resources // contains the PRI resources. private bool ShouldUseSatelliteAssemblyResourceLookupUnderAppX(RuntimeAssembly resourcesAssembly) { - bool fUseSatelliteAssemblyResourceLookupUnderAppX = typeof(Object).Assembly == resourcesAssembly; + bool fUseSatelliteAssemblyResourceLookupUnderAppX = typeof(object).Assembly == resourcesAssembly; if (!fUseSatelliteAssemblyResourceLookupUnderAppX) { @@ -815,7 +815,7 @@ namespace System.Resources if (resourcesAssembly != null) { - if (resourcesAssembly != typeof(Object).Assembly) // We are not loading resources for mscorlib + if (resourcesAssembly != typeof(object).Assembly) // We are not loading resources for mscorlib { // Cannot load the WindowsRuntimeResourceManager when in a compilation process, since it // lives in System.Runtime.WindowsRuntime and only mscorlib may be loaded for execution. @@ -974,7 +974,7 @@ namespace System.Resources // match, since CultureInfo objects can't represent all the different languages the AppX resource model supports. // For classic resources, this causes us to ignore the languages list and instead use the older Win32 behavior, // which is the design choice we've made. (See the call a little later to GetCurrentUICultureNoAppX()). - if (Object.ReferenceEquals(culture, CultureInfo.CurrentUICulture)) + if (object.ReferenceEquals(culture, CultureInfo.CurrentUICulture)) { culture = null; } @@ -1057,7 +1057,7 @@ namespace System.Resources // current thread's CultureInfo, and if not found, all parent CultureInfos. // Returns null if the resource wasn't found. // - public virtual Object GetObject(string name) + public virtual object GetObject(string name) { return GetObject(name, (CultureInfo)null, true); } @@ -1065,12 +1065,12 @@ namespace System.Resources // Looks up a resource value for a particular name. Looks in the // specified CultureInfo, and if not found, all parent CultureInfos. // Returns null if the resource wasn't found. - public virtual Object GetObject(string name, CultureInfo culture) + public virtual object GetObject(string name, CultureInfo culture) { return GetObject(name, culture, true); } - private Object GetObject(string name, CultureInfo culture, bool wrapUnmanagedMemStream) + private object GetObject(string name, CultureInfo culture, bool wrapUnmanagedMemStream) { if (null == name) throw new ArgumentNullException(nameof(name)); @@ -1081,7 +1081,7 @@ namespace System.Resources // If the caller explictily passed in a culture that was obtained by calling CultureInfo.CurrentUICulture, // null it out, so that we re-compute it based on the Win32 value and not the AppX language list value. // (See the call a little later to GetCurrentUICultureNoAppX()). - if (Object.ReferenceEquals(culture, CultureInfo.CurrentUICulture)) + if (object.ReferenceEquals(culture, CultureInfo.CurrentUICulture)) { culture = null; } @@ -1098,7 +1098,7 @@ namespace System.Resources ResourceSet last = GetFirstResourceSet(culture); if (last != null) { - Object value = last.GetObject(name, _ignoreCase); + object value = last.GetObject(name, _ignoreCase); if (value != null) { @@ -1128,7 +1128,7 @@ namespace System.Resources if (rs != last) { - Object value = rs.GetObject(name, _ignoreCase); + object value = rs.GetObject(name, _ignoreCase); if (value != null) { // update the last used ResourceSet @@ -1162,7 +1162,7 @@ namespace System.Resources public UnmanagedMemoryStream GetStream(string name, CultureInfo culture) { - Object obj = GetObject(name, culture, false); + object obj = GetObject(name, culture, false); UnmanagedMemoryStream ums = obj as UnmanagedMemoryStream; if (ums == null && obj != null) throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResourceNotStream_Name, name)); diff --git a/src/System.Private.CoreLib/src/System/Resources/ResourceReader.cs b/src/System.Private.CoreLib/src/System/Resources/ResourceReader.cs index f22d3b82d9..70e655f2a7 100644 --- a/src/System.Private.CoreLib/src/System/Resources/ResourceReader.cs +++ b/src/System.Private.CoreLib/src/System/Resources/ResourceReader.cs @@ -40,10 +40,10 @@ namespace System.Resources internal struct ResourceLocator { - internal Object _value; // Can be null. Consider WeakReference instead? + internal object _value; // Can be null. Consider WeakReference instead? internal int _dataPos; - internal ResourceLocator(int dataPos, Object value) + internal ResourceLocator(int dataPos, object value) { _dataPos = dataPos; _value = value; @@ -57,7 +57,7 @@ namespace System.Resources // Allows adding in profiling data in a future version, or a special // resource profiling build. We could also use WeakReference. - internal Object Value + internal object Value { get { return _value; } set { _value = value; } @@ -438,7 +438,7 @@ namespace System.Resources // This is used in the enumerator. The enumerator iterates from 0 to n // of our resources and this returns the resource value for a particular // index. The parameter is NOT a virtual offset. - private Object GetValueForNameIndex(int index) + private object GetValueForNameIndex(int index) { Debug.Assert(_store != null, "ResourceReader is closed!"); long nameVA = GetNamePosition(index); @@ -497,7 +497,7 @@ namespace System.Resources } // Called from RuntimeResourceSet - internal Object LoadObject(int pos) + internal object LoadObject(int pos) { if (_version == 1) return LoadObjectV1(pos); @@ -505,11 +505,11 @@ namespace System.Resources return LoadObjectV2(pos, out typeCode); } - internal Object LoadObject(int pos, out ResourceTypeCode typeCode) + internal object LoadObject(int pos, out ResourceTypeCode typeCode) { if (_version == 1) { - Object o = LoadObjectV1(pos); + object o = LoadObjectV1(pos); typeCode = (o is string) ? ResourceTypeCode.String : ResourceTypeCode.StartOfUserTypes; return o; } @@ -520,7 +520,7 @@ namespace System.Resources // from that location. // Anyone who calls LoadObject should make sure they take a lock so // no one can cause us to do a seek in here. - internal Object LoadObjectV1(int pos) + internal object LoadObjectV1(int pos) { Debug.Assert(_store != null, "ResourceReader is closed!"); Debug.Assert(_version == 1, ".resources file was not a V1 .resources file!"); @@ -541,7 +541,7 @@ namespace System.Resources } } - private Object _LoadObjectV1(int pos) + private object _LoadObjectV1(int pos) { _store.BaseStream.Seek(_dataSectionOffset + pos, SeekOrigin.Begin); int typeIndex = _store.Read7BitEncodedInt(); @@ -554,25 +554,25 @@ namespace System.Resources if (type == typeof(string)) return _store.ReadString(); - else if (type == typeof(Int32)) + else if (type == typeof(int)) return _store.ReadInt32(); - else if (type == typeof(Byte)) + else if (type == typeof(byte)) return _store.ReadByte(); - else if (type == typeof(SByte)) + else if (type == typeof(sbyte)) return _store.ReadSByte(); - else if (type == typeof(Int16)) + else if (type == typeof(short)) return _store.ReadInt16(); - else if (type == typeof(Int64)) + else if (type == typeof(long)) return _store.ReadInt64(); - else if (type == typeof(UInt16)) + else if (type == typeof(ushort)) return _store.ReadUInt16(); - else if (type == typeof(UInt32)) + else if (type == typeof(uint)) return _store.ReadUInt32(); - else if (type == typeof(UInt64)) + else if (type == typeof(ulong)) return _store.ReadUInt64(); - else if (type == typeof(Single)) + else if (type == typeof(float)) return _store.ReadSingle(); - else if (type == typeof(Double)) + else if (type == typeof(double)) return _store.ReadDouble(); else if (type == typeof(DateTime)) { @@ -582,12 +582,12 @@ namespace System.Resources } else if (type == typeof(TimeSpan)) return new TimeSpan(_store.ReadInt64()); - else if (type == typeof(Decimal)) + else if (type == typeof(decimal)) { int[] bits = new int[4]; for (int i = 0; i < bits.Length; i++) bits[i] = _store.ReadInt32(); - return new Decimal(bits); + return new decimal(bits); } else { @@ -595,7 +595,7 @@ namespace System.Resources } } - internal Object LoadObjectV2(int pos, out ResourceTypeCode typeCode) + internal object LoadObjectV2(int pos, out ResourceTypeCode typeCode) { Debug.Assert(_store != null, "ResourceReader is closed!"); Debug.Assert(_version >= 2, ".resources file was not a V2 (or higher) .resources file!"); @@ -616,7 +616,7 @@ namespace System.Resources } } - private Object _LoadObjectV2(int pos, out ResourceTypeCode typeCode) + private object _LoadObjectV2(int pos, out ResourceTypeCode typeCode) { _store.BaseStream.Seek(_dataSectionOffset + pos, SeekOrigin.Begin); typeCode = (ResourceTypeCode)_store.Read7BitEncodedInt(); @@ -670,11 +670,11 @@ namespace System.Resources case ResourceTypeCode.DateTime: // Use DateTime's ToBinary & FromBinary. - Int64 data = _store.ReadInt64(); + long data = _store.ReadInt64(); return DateTime.FromBinary(data); case ResourceTypeCode.TimeSpan: - Int64 ticks = _store.ReadInt64(); + long ticks = _store.ReadInt64(); return new TimeSpan(ticks); // Special types @@ -1062,7 +1062,7 @@ namespace System.Resources internal sealed class ResourceEnumerator : IDictionaryEnumerator { - private const int ENUM_DONE = Int32.MinValue; + private const int ENUM_DONE = int.MinValue; private const int ENUM_NOT_STARTED = -1; private ResourceReader _reader; @@ -1090,7 +1090,7 @@ namespace System.Resources return true; } - public Object Key + public object Key { get { @@ -1102,7 +1102,7 @@ namespace System.Resources } } - public Object Current + public object Current { get { @@ -1128,7 +1128,7 @@ namespace System.Resources if (_reader._resCache == null) throw new InvalidOperationException(SR.ResourceReaderIsClosed); string key; - Object value = null; + object value = null; lock (_reader) { // locks should be taken in the same order as in RuntimeResourceSet.GetObject to avoid deadlock lock (_reader._resCache) @@ -1157,7 +1157,7 @@ namespace System.Resources } } - public Object Value + public object Value { get { diff --git a/src/System.Private.CoreLib/src/System/Resources/ResourceSet.cs b/src/System.Private.CoreLib/src/System/Resources/ResourceSet.cs index 9e5a72c431..2d33f3a8b0 100644 --- a/src/System.Private.CoreLib/src/System/Resources/ResourceSet.cs +++ b/src/System.Private.CoreLib/src/System/Resources/ResourceSet.cs @@ -49,7 +49,7 @@ namespace System.Resources // implementation. Use this constructor to open & read from a file // on disk. // - public ResourceSet(String fileName) + public ResourceSet(string fileName) { Reader = new ResourceReader(fileName); CommonInit(); @@ -147,12 +147,12 @@ namespace System.Resources // Look up a string value for a resource given its name. // - public virtual String GetString(String name) + public virtual string GetString(string name) { - Object obj = GetObjectInternal(name); + object obj = GetObjectInternal(name); try { - return (String)obj; + return (string)obj; } catch (InvalidCastException) { @@ -160,16 +160,16 @@ namespace System.Resources } } - public virtual String GetString(String name, bool ignoreCase) + public virtual string GetString(string name, bool ignoreCase) { - Object obj; - String s; + object obj; + string s; // Case-sensitive lookup obj = GetObjectInternal(name); try { - s = (String)obj; + s = (string)obj; } catch (InvalidCastException) { @@ -186,7 +186,7 @@ namespace System.Resources obj = GetCaseInsensitiveObjectInternal(name); try { - return (String)obj; + return (string)obj; } catch (InvalidCastException) { @@ -196,14 +196,14 @@ namespace System.Resources // Look up an object value for a resource given its name. // - public virtual Object GetObject(String name) + public virtual object GetObject(string name) { return GetObjectInternal(name); } - public virtual Object GetObject(String name, bool ignoreCase) + public virtual object GetObject(string name, bool ignoreCase) { - Object obj = GetObjectInternal(name); + object obj = GetObjectInternal(name); if (obj != null || !ignoreCase) return obj; @@ -216,14 +216,14 @@ namespace System.Resources IDictionaryEnumerator en = Reader.GetEnumerator(); while (en.MoveNext()) { - Object value = en.Value; + object value = en.Value; Table.Add(en.Key, value); } // While technically possible to close the Reader here, don't close it // to help with some WinRes lifetime issues. } - private Object GetObjectInternal(String name) + private object GetObjectInternal(string name) { if (name == null) throw new ArgumentNullException(nameof(name)); @@ -236,7 +236,7 @@ namespace System.Resources return copyOfTable[name]; } - private Object GetCaseInsensitiveObjectInternal(String name) + private object GetCaseInsensitiveObjectInternal(string name) { Hashtable copyOfTable = Table; // Avoid a race with Dispose diff --git a/src/System.Private.CoreLib/src/System/RtType.cs b/src/System.Private.CoreLib/src/System/RtType.cs index c910bf52e4..62e0b2b80c 100644 --- a/src/System.Private.CoreLib/src/System/RtType.cs +++ b/src/System.Private.CoreLib/src/System/RtType.cs @@ -35,7 +35,7 @@ namespace System // see how it compares to the current implementation. // This delegate will disappear at some point in favor of calli - internal delegate void CtorDelegate(Object instance); + internal delegate void CtorDelegate(object instance); // Keep this in sync with FormatFlags defined in typestring.h internal enum TypeNameFormatFlags @@ -119,7 +119,7 @@ namespace System return _items; } - public void CopyTo(Object[] array, int index) + public void CopyTo(object[] array, int index) { if (_count == 0) return; @@ -363,7 +363,7 @@ namespace System Encoding.UTF8.GetBytes(pName, cNameLen, pUtf8Name, cUtf8Name); Filter filter = new Filter(pUtf8Name, cUtf8Name, listType); - Object list = null; + object list = null; switch (cacheType) { @@ -1459,9 +1459,9 @@ namespace System private MemberInfoCache<RuntimePropertyInfo> m_propertyInfoCache; private MemberInfoCache<RuntimeEventInfo> m_eventInfoCache; private static CerHashtable<RuntimeMethodInfo, RuntimeMethodInfo> s_methodInstantiations; - private static Object s_methodInstantiationsLock; + private static object s_methodInstantiationsLock; private string m_defaultMemberName; - private Object m_genericCache; // Generic cache for rare scenario specific data. It is used to cache Enum names and values. + private object m_genericCache; // Generic cache for rare scenario specific data. It is used to cache Enum names and values. #endregion #region Constructor @@ -1509,7 +1509,7 @@ namespace System #region Internal Members - internal Object GenericCache + internal object GenericCache { get { return m_genericCache; } set { m_genericCache = value; } @@ -1619,7 +1619,7 @@ namespace System IList<CustomAttributeData> attrs = CustomAttributeData.GetCustomAttributes(t); for (int i = 0; i < attrs.Count; i++) { - if (Object.ReferenceEquals(attrs[i].Constructor.DeclaringType, DefaultMemberAttrType)) + if (object.ReferenceEquals(attrs[i].Constructor.DeclaringType, DefaultMemberAttrType)) { attr = attrs[i]; break; @@ -1660,7 +1660,7 @@ namespace System return crmi; if (s_methodInstantiationsLock == null) - Interlocked.CompareExchange(ref s_methodInstantiationsLock, new Object(), null); + Interlocked.CompareExchange(ref s_methodInstantiationsLock, new object(), null); bool lockTaken = false; RuntimeHelpers.PrepareConstrainedRegions(); @@ -1911,7 +1911,7 @@ namespace System return retval; } - internal Object GenericCache + internal object GenericCache { get { return Cache.GenericCache; } set { Cache.GenericCache = value; } @@ -2190,7 +2190,7 @@ namespace System } #endregion - bool isInherited = !Object.ReferenceEquals(memberInfo.DeclaringType, memberInfo.ReflectedType); + bool isInherited = !object.ReferenceEquals(memberInfo.DeclaringType, memberInfo.ReflectedType); #region Filter by DeclaredOnly if ((bindingFlags & BindingFlags.DeclaredOnly) != 0 && isInherited) @@ -2941,7 +2941,7 @@ namespace System { if (match != null) { - if (Object.ReferenceEquals(fieldInfo.DeclaringType, match.DeclaringType)) + if (object.ReferenceEquals(fieldInfo.DeclaringType, match.DeclaringType)) throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException); if ((match.DeclaringType.IsInterface == true) && (fieldInfo.DeclaringType.IsInterface == true)) @@ -3228,7 +3228,7 @@ namespace System #endregion #region Hierarchy - public override bool IsInstanceOfType(Object o) + public override bool IsInstanceOfType(object o) { return RuntimeTypeHandle.IsInstanceOfType(this, o); } @@ -3271,7 +3271,7 @@ namespace System if ((object)c == null) return false; - if (Object.ReferenceEquals(c, this)) + if (object.ReferenceEquals(c, this)) return true; RuntimeType fromType = c.UnderlyingSystemType as RuntimeType; @@ -3580,7 +3580,7 @@ namespace System for (int i = 0; i < values.Length; i++) { - Object val = Enum.ToObject(this, values[i]); + object val = Enum.ToObject(this, values[i]); ret.SetValue(val, i); } @@ -3838,9 +3838,9 @@ namespace System private static extern bool CanValueSpecialCast(RuntimeType valueType, RuntimeType targetType); [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern Object AllocateValueType(RuntimeType type, object value, bool fForceTypeChange); + private static extern object AllocateValueType(RuntimeType type, object value, bool fForceTypeChange); - internal unsafe Object CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr) + internal unsafe object CheckValue(object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr) { // this method is used by invocation in reflection to check whether a value can be assigned to type. if (IsInstanceOfType(value)) @@ -3851,7 +3851,7 @@ namespace System Type type = value.GetType(); - if (!Object.ReferenceEquals(type, this) && RuntimeTypeHandle.IsValueType(this)) + if (!object.ReferenceEquals(type, this) && RuntimeTypeHandle.IsValueType(this)) { // must be an equivalent type, re-box to the target type return AllocateValueType(this, value, true); @@ -3909,7 +3909,7 @@ namespace System } // Factored out of CheckValue to reduce code complexity. - private Object TryChangeType(Object value, Binder binder, CultureInfo culture, bool needsSpecialCast) + private object TryChangeType(object value, Binder binder, CultureInfo culture, bool needsSpecialCast) { if (binder != null && binder != Type.DefaultBinder) { @@ -3970,9 +3970,9 @@ namespace System #endif [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - public override Object InvokeMember( - string name, BindingFlags bindingFlags, Binder binder, Object target, - Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParams) + public override object InvokeMember( + string name, BindingFlags bindingFlags, Binder binder, object target, + object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParams) { if (IsGenericParameter) throw new InvalidOperationException(SR.Arg_GenericParameter); @@ -4149,7 +4149,7 @@ namespace System if (selFld != null) { #region Invocation on a field - if (selFld.FieldType.IsArray || Object.ReferenceEquals(selFld.FieldType, typeof(System.Array))) + if (selFld.FieldType.IsArray || object.ReferenceEquals(selFld.FieldType, typeof(System.Array))) { #region Invocation of an array Field int idxCnt; @@ -4391,9 +4391,9 @@ namespace System finalists = new MethodInfo[] { finalist }; if (providedArgs == null) - providedArgs = Array.Empty<Object>(); + providedArgs = Array.Empty<object>(); - Object state = null; + object state = null; MethodBase invokeMethod = null; @@ -4407,7 +4407,7 @@ namespace System //if (useCache && argCnt == invokeMethod.GetParameters().Length) // AddMethodToCache(name, bindingFlags, argCnt, providedArgs, invokeMethod); - Object result = ((MethodInfo)invokeMethod).Invoke(target, bindingFlags, binder, providedArgs, culture); + object result = ((MethodInfo)invokeMethod).Invoke(target, bindingFlags, binder, providedArgs, culture); if (state != null) binder.ReorderArgumentArray(ref providedArgs, state); @@ -4441,19 +4441,19 @@ namespace System #endregion #region ICloneable - public Object Clone() + public object Clone() { return this; } #endregion #region ICustomAttributeProvider - public override Object[] GetCustomAttributes(bool inherit) + public override object[] GetCustomAttributes(bool inherit) { return CustomAttribute.GetCustomAttributes(this, RuntimeType.ObjectType, inherit); } - public override Object[] GetCustomAttributes(Type attributeType, bool inherit) + public override object[] GetCustomAttributes(Type attributeType, bool inherit) { if ((object)attributeType == null) throw new ArgumentNullException(nameof(attributeType)); @@ -4585,22 +4585,22 @@ namespace System Type elementType = this.GetRootElementType(); - if (Object.ReferenceEquals(elementType, typeof(ArgIterator))) + if (object.ReferenceEquals(elementType, typeof(ArgIterator))) throw new NotSupportedException(SR.Acc_CreateArgIterator); - if (Object.ReferenceEquals(elementType, typeof(void))) + if (object.ReferenceEquals(elementType, typeof(void))) throw new NotSupportedException(SR.Acc_CreateVoid); } - internal Object CreateInstanceImpl( - BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) + internal object CreateInstanceImpl( + BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes) { CreateInstanceCheckThis(); - Object server = null; + object server = null; if (args == null) - args = Array.Empty<Object>(); + args = Array.Empty<object>(); int argCnt = args.Length; @@ -4649,7 +4649,7 @@ namespace System } MethodBase invokeMethod; - Object state = null; + object state = null; try { @@ -4718,7 +4718,7 @@ namespace System private void InitializeDelegateCreator() { - ConstructorInfo ctorInfo = typeof(CtorDelegate).GetConstructor(new Type[] { typeof(Object), typeof(IntPtr) }); + ConstructorInfo ctorInfo = typeof(CtorDelegate).GetConstructor(new Type[] { typeof(object), typeof(IntPtr) }); delegateCtorInfo = ctorInfo; // this assignment should be last } @@ -4732,7 +4732,7 @@ namespace System InitializeDelegateCreator(); // No synchronization needed here. In the worst case we create extra garbage - CtorDelegate ctor = (CtorDelegate)delegateCtorInfo.Invoke(new Object[] { null, RuntimeMethodHandle.GetFunctionPointer(ace.m_hCtorMethodHandle) }); + CtorDelegate ctor = (CtorDelegate)delegateCtorInfo.Invoke(new object[] { null, RuntimeMethodHandle.GetFunctionPointer(ace.m_hCtorMethodHandle) }); ace.m_ctor = ctor; } ace.m_bFullyInitialized = true; @@ -4767,7 +4767,7 @@ namespace System private static volatile ActivatorCache s_ActivatorCache; // the slow path of CreateInstanceDefaultCtor - internal Object CreateInstanceSlow(bool publicOnly, bool wrapExceptions, bool skipCheckThis, bool fillCache) + internal object CreateInstanceSlow(bool publicOnly, bool wrapExceptions, bool skipCheckThis, bool fillCache) { RuntimeMethodHandleInternal runtime_ctor = default; bool bCanBeCached = false; @@ -4775,7 +4775,7 @@ namespace System if (!skipCheckThis) CreateInstanceCheckThis(); - Object instance = RuntimeTypeHandle.CreateInstance(this, publicOnly, wrapExceptions, ref bCanBeCached, ref runtime_ctor); + object instance = RuntimeTypeHandle.CreateInstance(this, publicOnly, wrapExceptions, ref bCanBeCached, ref runtime_ctor); if (bCanBeCached && fillCache) { @@ -4799,7 +4799,7 @@ namespace System // fillCache is set in the SL2/3 compat mode or when called from Marshal.PtrToStructure. [DebuggerStepThroughAttribute] [Diagnostics.DebuggerHidden] - internal Object CreateInstanceDefaultCtor(bool publicOnly, bool skipCheckThis, bool fillCache, bool wrapExceptions) + internal object CreateInstanceDefaultCtor(bool publicOnly, bool skipCheckThis, bool fillCache, bool wrapExceptions) { if (GetType() == typeof(ReflectionOnlyType)) throw new InvalidOperationException(SR.InvalidOperation_NotAllowedInReflectionOnly); @@ -4820,7 +4820,7 @@ namespace System } // Allocate empty object - Object instance = RuntimeTypeHandle.Allocate(this); + object instance = RuntimeTypeHandle.Allocate(this); // if m_ctor is null, this type doesn't have a default ctor Debug.Assert(ace.m_ctor != null || this.IsValueType); @@ -4856,16 +4856,16 @@ namespace System #region Legacy internal static [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern Object _CreateEnum(RuntimeType enumType, long value); - internal static Object CreateEnum(RuntimeType enumType, long value) + private static extern object _CreateEnum(RuntimeType enumType, long value); + internal static object CreateEnum(RuntimeType enumType, long value) { return _CreateEnum(enumType, value); } #if FEATURE_COMINTEROP [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern Object InvokeDispMethod( - string name, BindingFlags invokeAttr, Object target, Object[] args, + private extern object InvokeDispMethod( + string name, BindingFlags invokeAttr, object target, object[] args, bool[] byrefModifiers, int culture, string[] namedParameters); #endif // FEATURE_COMINTEROP diff --git a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs index ec8af8c086..201389d40a 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs @@ -799,36 +799,36 @@ namespace System.Runtime.CompilerServices // is recognized and optimized by both 32-bit and 64-bit JITs. // For Boolean, we cache all possible values. - if (typeof(TResult) == typeof(Boolean)) // only the relevant branches are kept for each value-type generic instantiation + if (typeof(TResult) == typeof(bool)) // only the relevant branches are kept for each value-type generic instantiation { - Boolean value = (Boolean)(object)result; - Task<Boolean> task = value ? AsyncTaskCache.TrueTask : AsyncTaskCache.FalseTask; + bool value = (bool)(object)result; + Task<bool> task = value ? AsyncTaskCache.TrueTask : AsyncTaskCache.FalseTask; return Unsafe.As<Task<TResult>>(task); // UnsafeCast avoids type check we know will succeed } // For Int32, we cache a range of common values, e.g. [-1,4). - else if (typeof(TResult) == typeof(Int32)) + else if (typeof(TResult) == typeof(int)) { // Compare to constants to avoid static field access if outside of cached range. // We compare to the upper bound first, as we're more likely to cache miss on the upper side than on the // lower side, due to positive values being more common than negative as return values. - Int32 value = (Int32)(object)result; + int value = (int)(object)result; if (value < AsyncTaskCache.EXCLUSIVE_INT32_MAX && value >= AsyncTaskCache.INCLUSIVE_INT32_MIN) { - Task<Int32> task = AsyncTaskCache.Int32Tasks[value - AsyncTaskCache.INCLUSIVE_INT32_MIN]; + Task<int> task = AsyncTaskCache.Int32Tasks[value - AsyncTaskCache.INCLUSIVE_INT32_MIN]; return Unsafe.As<Task<TResult>>(task); // UnsafeCast avoids a type check we know will succeed } } // For other known value types, we only special-case 0 / default(TResult). else if ( - (typeof(TResult) == typeof(UInt32) && default == (UInt32)(object)result) || - (typeof(TResult) == typeof(Byte) && default(Byte) == (Byte)(object)result) || - (typeof(TResult) == typeof(SByte) && default(SByte) == (SByte)(object)result) || - (typeof(TResult) == typeof(Char) && default(Char) == (Char)(object)result) || - (typeof(TResult) == typeof(Int64) && default == (Int64)(object)result) || - (typeof(TResult) == typeof(UInt64) && default == (UInt64)(object)result) || - (typeof(TResult) == typeof(Int16) && default(Int16) == (Int16)(object)result) || - (typeof(TResult) == typeof(UInt16) && default(UInt16) == (UInt16)(object)result) || + (typeof(TResult) == typeof(uint) && default == (uint)(object)result) || + (typeof(TResult) == typeof(byte) && default(byte) == (byte)(object)result) || + (typeof(TResult) == typeof(sbyte) && default(sbyte) == (sbyte)(object)result) || + (typeof(TResult) == typeof(char) && default(char) == (char)(object)result) || + (typeof(TResult) == typeof(long) && default == (long)(object)result) || + (typeof(TResult) == typeof(ulong) && default == (ulong)(object)result) || + (typeof(TResult) == typeof(short) && default(short) == (short)(object)result) || + (typeof(TResult) == typeof(ushort) && default(ushort) == (ushort)(object)result) || (typeof(TResult) == typeof(IntPtr) && default == (IntPtr)(object)result) || (typeof(TResult) == typeof(UIntPtr) && default == (UIntPtr)(object)result)) { @@ -851,21 +851,21 @@ namespace System.Runtime.CompilerServices // All static members are initialized inline to ensure type is beforefieldinit /// <summary>A cached Task{Boolean}.Result == true.</summary> - internal readonly static Task<Boolean> TrueTask = CreateCacheableTask(true); + internal readonly static Task<bool> TrueTask = CreateCacheableTask(true); /// <summary>A cached Task{Boolean}.Result == false.</summary> - internal readonly static Task<Boolean> FalseTask = CreateCacheableTask(false); + internal readonly static Task<bool> FalseTask = CreateCacheableTask(false); /// <summary>The cache of Task{Int32}.</summary> - internal readonly static Task<Int32>[] Int32Tasks = CreateInt32Tasks(); + internal readonly static Task<int>[] Int32Tasks = CreateInt32Tasks(); /// <summary>The minimum value, inclusive, for which we want a cached task.</summary> - internal const Int32 INCLUSIVE_INT32_MIN = -1; + internal const int INCLUSIVE_INT32_MIN = -1; /// <summary>The maximum value, exclusive, for which we want a cached task.</summary> - internal const Int32 EXCLUSIVE_INT32_MAX = 9; + internal const int EXCLUSIVE_INT32_MAX = 9; /// <summary>Creates an array of cached tasks for the values in the range [INCLUSIVE_MIN,EXCLUSIVE_MAX).</summary> - private static Task<Int32>[] CreateInt32Tasks() + private static Task<int>[] CreateInt32Tasks() { Debug.Assert(EXCLUSIVE_INT32_MAX >= INCLUSIVE_INT32_MIN, "Expected max to be at least min"); - var tasks = new Task<Int32>[EXCLUSIVE_INT32_MAX - INCLUSIVE_INT32_MIN]; + var tasks = new Task<int>[EXCLUSIVE_INT32_MAX - INCLUSIVE_INT32_MIN]; for (int i = 0; i < tasks.Length; i++) { tasks[i] = CreateCacheableTask(i + INCLUSIVE_INT32_MIN); diff --git a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs index 2f0cca9c88..f4e502adc5 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs @@ -466,7 +466,7 @@ namespace System.Runtime.CompilerServices // // - Used with live key (linked into a bucket list where _buckets[hashCode & (_buckets.Length - 1)] points to first entry) // depHnd.IsAllocated == true, depHnd.GetPrimary() != null - // hashCode == RuntimeHelpers.GetHashCode(depHnd.GetPrimary()) & Int32.MaxValue + // hashCode == RuntimeHelpers.GetHashCode(depHnd.GetPrimary()) & int.MaxValue // next links to next Entry in bucket. // // - Used with dead key (linked into a bucket list where _buckets[hashCode & (_buckets.Length - 1)] points to first entry) diff --git a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs index 8f06008bb4..53b2848084 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs @@ -26,7 +26,7 @@ namespace System.Runtime.CompilerServices { // Exposed here as a more appropriate place than on FormatterServices itself, // which is a high level reflection heavy type. - public static Object GetUninitializedObject(Type type) + public static object GetUninitializedObject(Type type) { return FormatterServices.GetUninitializedObject(type); } @@ -48,7 +48,7 @@ namespace System.Runtime.CompilerServices // Of course, reference types are not cloned. // [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern Object GetObjectValue(Object obj); + public static extern object GetObjectValue(object obj); // RunClassConstructor causes the class constructor for the given type to be triggered // in the current domain. After this call returns, the class constructor is guaranteed to @@ -117,10 +117,10 @@ namespace System.Runtime.CompilerServices public static extern void PrepareDelegate(Delegate d); [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern int GetHashCode(Object o); + public static extern int GetHashCode(object o); [MethodImplAttribute(MethodImplOptions.InternalCall)] - public new static extern bool Equals(Object o1, Object o2); + public new static extern bool Equals(object o1, object o2); public static int OffsetToStringData { @@ -175,14 +175,14 @@ namespace System.Runtime.CompilerServices { } - public delegate void TryCode(Object userData); + public delegate void TryCode(object userData); - public delegate void CleanupCode(Object userData, bool exceptionThrown); + public delegate void CleanupCode(object userData, bool exceptionThrown); [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern void ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData); + public static extern void ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, object userData); - internal static void ExecuteBackoutCodeHelper(Object backoutCode, Object userData, bool exceptionThrown) + internal static void ExecuteBackoutCodeHelper(object backoutCode, object userData, bool exceptionThrown) { ((CleanupCode)backoutCode)(userData, exceptionThrown); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/jithelpers.cs b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/jithelpers.cs index 42fe79d83b..dd491dc1e5 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/jithelpers.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/jithelpers.cs @@ -171,10 +171,10 @@ namespace System.Runtime.CompilerServices // Set the given element in the array without any type or range checks [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern void UnsafeSetArrayElement(Object[] target, int index, Object element); + internal static extern void UnsafeSetArrayElement(object[] target, int index, object element); // Used for unsafe pinning of arbitrary objects. - internal static PinningHelper GetPinningHelper(Object o) + internal static PinningHelper GetPinningHelper(object o) { return Unsafe.As<PinningHelper>(o); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs b/src/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs index 0a379667d7..ad8e47b319 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs @@ -35,7 +35,7 @@ namespace System.Runtime.ExceptionServices private object m_stackTrace; private object m_dynamicMethods; private UIntPtr m_IPForWatsonBuckets; - private Object m_WatsonBuckets; + private object m_WatsonBuckets; private ExceptionDispatchInfo(Exception exception) { diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ArrayWithOffset.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ArrayWithOffset.cs index e009db277f..a9fbc8bf1d 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ArrayWithOffset.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ArrayWithOffset.cs @@ -16,7 +16,7 @@ namespace System.Runtime.InteropServices // throw new Exception(); //} - public ArrayWithOffset(Object array, int offset) + public ArrayWithOffset(object array, int offset) { m_array = array; m_offset = offset; @@ -24,7 +24,7 @@ namespace System.Runtime.InteropServices m_count = CalculateCount(); } - public Object GetArray() + public object GetArray() { return m_array; } @@ -39,7 +39,7 @@ namespace System.Runtime.InteropServices return m_count + m_offset; } - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (obj is ArrayWithOffset) return Equals((ArrayWithOffset)obj); @@ -65,7 +65,7 @@ namespace System.Runtime.InteropServices [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern int CalculateCount(); - private Object m_array; + private object m_array; private int m_offset; private int m_count; } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Attributes.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Attributes.cs index 4141202129..b99cefc76e 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Attributes.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Attributes.cs @@ -17,11 +17,11 @@ namespace System.Runtime.InteropServices public TypeIdentifierAttribute() { } public TypeIdentifierAttribute(string scope, string identifier) { Scope_ = scope; Identifier_ = identifier; } - public String Scope { get { return Scope_; } } - public String Identifier { get { return Identifier_; } } + public string Scope { get { return Scope_; } } + public string Identifier { get { return Identifier_; } } - internal String Scope_; - internal String Identifier_; + internal string Scope_; + internal string Identifier_; } // To be used on methods that sink reverse P/Invoke calls. @@ -118,19 +118,19 @@ namespace System.Runtime.InteropServices [AttributeUsage(AttributeTargets.Class, Inherited = false)] public sealed class ProgIdAttribute : Attribute { - internal String _val; - public ProgIdAttribute(String progId) + internal string _val; + public ProgIdAttribute(string progId) { _val = progId; } - public String Value { get { return _val; } } + public string Value { get { return _val; } } } [AttributeUsage(AttributeTargets.Class, Inherited = true)] public sealed class ComSourceInterfacesAttribute : Attribute { - internal String _val; - public ComSourceInterfacesAttribute(String sourceInterfaces) + internal string _val; + public ComSourceInterfacesAttribute(string sourceInterfaces) { _val = sourceInterfaces; } @@ -150,7 +150,7 @@ namespace System.Runtime.InteropServices { _val = sourceInterface1.FullName + "\0" + sourceInterface2.FullName + "\0" + sourceInterface3.FullName + "\0" + sourceInterface4.FullName; } - public String Value { get { return _val; } } + public string Value { get { return _val; } } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false)] diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/BStrWrapper.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/BStrWrapper.cs index 586b03b366..14a91c9e90 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/BStrWrapper.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/BStrWrapper.cs @@ -19,17 +19,17 @@ namespace System.Runtime.InteropServices { public sealed class BStrWrapper { - public BStrWrapper(String value) + public BStrWrapper(string value) { m_WrappedObject = value; } - public BStrWrapper(Object value) + public BStrWrapper(object value) { - m_WrappedObject = (String)value; + m_WrappedObject = (string)value; } - public String WrappedObject + public string WrappedObject { get { @@ -37,6 +37,6 @@ namespace System.Runtime.InteropServices } } - private String m_WrappedObject; + private string m_WrappedObject; } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/COMException.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/COMException.cs index c31a1576c4..9f2e055282 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/COMException.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/COMException.cs @@ -31,19 +31,19 @@ namespace System.Runtime.InteropServices HResult = HResults.E_FAIL; } - public COMException(String message) + public COMException(string message) : base(message) { HResult = HResults.E_FAIL; } - public COMException(String message, Exception inner) + public COMException(string message, Exception inner) : base(message, inner) { HResult = HResults.E_FAIL; } - public COMException(String message, int errorCode) + public COMException(string message, int errorCode) : base(message) { HResult = errorCode; @@ -53,11 +53,11 @@ namespace System.Runtime.InteropServices { } - public override String ToString() + public override string ToString() { - String message = Message; - String s; - String _className = GetType().ToString(); + string message = Message; + string s; + string _className = GetType().ToString(); s = _className + " (0x" + HResult.ToString("X8", CultureInfo.InvariantCulture) + ")"; if (!(message == null || message.Length <= 0)) diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IBindCtx.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IBindCtx.cs index 152f1cd655..c32d66e12b 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IBindCtx.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IBindCtx.cs @@ -30,16 +30,16 @@ namespace System.Runtime.InteropServices.ComTypes [ComImport] public interface IBindCtx { - void RegisterObjectBound([MarshalAs(UnmanagedType.Interface)] Object punk); - void RevokeObjectBound([MarshalAs(UnmanagedType.Interface)] Object punk); + void RegisterObjectBound([MarshalAs(UnmanagedType.Interface)] object punk); + void RevokeObjectBound([MarshalAs(UnmanagedType.Interface)] object punk); void ReleaseBoundObjects(); void SetBindOptions([In()] ref BIND_OPTS pbindopts); void GetBindOptions(ref BIND_OPTS pbindopts); void GetRunningObjectTable(out IRunningObjectTable pprot); - void RegisterObjectParam([MarshalAs(UnmanagedType.LPWStr)] String pszKey, [MarshalAs(UnmanagedType.Interface)] Object punk); - void GetObjectParam([MarshalAs(UnmanagedType.LPWStr)] String pszKey, [MarshalAs(UnmanagedType.Interface)] out Object ppunk); + void RegisterObjectParam([MarshalAs(UnmanagedType.LPWStr)] string pszKey, [MarshalAs(UnmanagedType.Interface)] object punk); + void GetObjectParam([MarshalAs(UnmanagedType.LPWStr)] string pszKey, [MarshalAs(UnmanagedType.Interface)] out object ppunk); void EnumObjectParam(out IEnumString ppenum); [PreserveSig] - int RevokeObjectParam([MarshalAs(UnmanagedType.LPWStr)] String pszKey); + int RevokeObjectParam([MarshalAs(UnmanagedType.LPWStr)] string pszKey); } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IConnectionPoint.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IConnectionPoint.cs index 3933d528a9..8e0222601b 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IConnectionPoint.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IConnectionPoint.cs @@ -22,7 +22,7 @@ namespace System.Runtime.InteropServices.ComTypes { void GetConnectionInterface(out Guid pIID); void GetConnectionPointContainer(out IConnectionPointContainer ppCPC); - void Advise([MarshalAs(UnmanagedType.Interface)] Object pUnkSink, out int pdwCookie); + void Advise([MarshalAs(UnmanagedType.Interface)] object pUnkSink, out int pdwCookie); void Unadvise(int dwCookie); void EnumConnections(out IEnumConnections ppEnum); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IEnumConnections.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IEnumConnections.cs index 1acfe54657..418c911ff3 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IEnumConnections.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IEnumConnections.cs @@ -20,7 +20,7 @@ namespace System.Runtime.InteropServices.ComTypes public struct CONNECTDATA { [MarshalAs(UnmanagedType.Interface)] - public Object pUnk; + public object pUnk; public int dwCookie; } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IEnumString.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IEnumString.cs index 5738a42751..0a76e1c912 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IEnumString.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IEnumString.cs @@ -21,7 +21,7 @@ namespace System.Runtime.InteropServices.ComTypes public interface IEnumString { [PreserveSig] - int Next(int celt, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 0), Out] String[] rgelt, IntPtr pceltFetched); + int Next(int celt, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 0), Out] string[] rgelt, IntPtr pceltFetched); [PreserveSig] int Skip(int celt); void Reset(); diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IMoniker.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IMoniker.cs index ea45149b29..8072cd24a8 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IMoniker.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IMoniker.cs @@ -36,11 +36,11 @@ namespace System.Runtime.InteropServices.ComTypes int IsDirty(); void Load(IStream pStm); void Save(IStream pStm, [MarshalAs(UnmanagedType.Bool)] bool fClearDirty); - void GetSizeMax(out Int64 pcbSize); + void GetSizeMax(out long pcbSize); // IMoniker portion - void BindToObject(IBindCtx pbc, IMoniker pmkToLeft, [In()] ref Guid riidResult, [MarshalAs(UnmanagedType.Interface)] out Object ppvResult); - void BindToStorage(IBindCtx pbc, IMoniker pmkToLeft, [In()] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out Object ppvObj); + void BindToObject(IBindCtx pbc, IMoniker pmkToLeft, [In()] ref Guid riidResult, [MarshalAs(UnmanagedType.Interface)] out object ppvResult); + void BindToStorage(IBindCtx pbc, IMoniker pmkToLeft, [In()] ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppvObj); void Reduce(IBindCtx pbc, int dwReduceHowFar, ref IMoniker ppmkToLeft, out IMoniker ppmkReduced); void ComposeWith(IMoniker pmkRight, [MarshalAs(UnmanagedType.Bool)] bool fOnlyIfNotGeneric, out IMoniker ppmkComposite); void Enum([MarshalAs(UnmanagedType.Bool)] bool fForward, out IEnumMoniker ppenumMoniker); @@ -53,8 +53,8 @@ namespace System.Runtime.InteropServices.ComTypes void Inverse(out IMoniker ppmk); void CommonPrefixWith(IMoniker pmkOther, out IMoniker ppmkPrefix); void RelativePathTo(IMoniker pmkOther, out IMoniker ppmkRelPath); - void GetDisplayName(IBindCtx pbc, IMoniker pmkToLeft, [MarshalAs(UnmanagedType.LPWStr)] out String ppszDisplayName); - void ParseDisplayName(IBindCtx pbc, IMoniker pmkToLeft, [MarshalAs(UnmanagedType.LPWStr)] String pszDisplayName, out int pchEaten, out IMoniker ppmkOut); + void GetDisplayName(IBindCtx pbc, IMoniker pmkToLeft, [MarshalAs(UnmanagedType.LPWStr)] out string ppszDisplayName); + void ParseDisplayName(IBindCtx pbc, IMoniker pmkToLeft, [MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, out int pchEaten, out IMoniker ppmkOut); [PreserveSig] int IsSystemMoniker(out int pdwMksys); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IPersistFile.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IPersistFile.cs index 467a9e3a6a..ef748f52e4 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IPersistFile.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IPersistFile.cs @@ -26,9 +26,9 @@ namespace System.Runtime.InteropServices.ComTypes // IPersistFile portion [PreserveSig] int IsDirty(); - void Load([MarshalAs(UnmanagedType.LPWStr)] String pszFileName, int dwMode); - void Save([MarshalAs(UnmanagedType.LPWStr)] String pszFileName, [MarshalAs(UnmanagedType.Bool)] bool fRemember); - void SaveCompleted([MarshalAs(UnmanagedType.LPWStr)] String pszFileName); - void GetCurFile([MarshalAs(UnmanagedType.LPWStr)] out String ppszFileName); + void Load([MarshalAs(UnmanagedType.LPWStr)] string pszFileName, int dwMode); + void Save([MarshalAs(UnmanagedType.LPWStr)] string pszFileName, [MarshalAs(UnmanagedType.Bool)] bool fRemember); + void SaveCompleted([MarshalAs(UnmanagedType.LPWStr)] string pszFileName); + void GetCurFile([MarshalAs(UnmanagedType.LPWStr)] out string ppszFileName); } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IRunningObjectTable.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IRunningObjectTable.cs index ffca35ae83..bb806e81bf 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IRunningObjectTable.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IRunningObjectTable.cs @@ -20,12 +20,12 @@ namespace System.Runtime.InteropServices.ComTypes [ComImport] public interface IRunningObjectTable { - int Register(int grfFlags, [MarshalAs(UnmanagedType.Interface)] Object punkObject, IMoniker pmkObjectName); + int Register(int grfFlags, [MarshalAs(UnmanagedType.Interface)] object punkObject, IMoniker pmkObjectName); void Revoke(int dwRegister); [PreserveSig] int IsRunning(IMoniker pmkObjectName); [PreserveSig] - int GetObject(IMoniker pmkObjectName, [MarshalAs(UnmanagedType.Interface)] out Object ppunkObject); + int GetObject(IMoniker pmkObjectName, [MarshalAs(UnmanagedType.Interface)] out object ppunkObject); void NoteChangeTime(int dwRegister, ref FILETIME pfiletime); [PreserveSig] int GetTimeOfLastChange(IMoniker pmkObjectName, out FILETIME pfiletime); diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IStream.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IStream.cs index 1a2d81f7ea..7746458c92 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IStream.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/IStream.cs @@ -19,9 +19,9 @@ namespace System.Runtime.InteropServices.ComTypes public struct STATSTG { - public String pwcsName; + public string pwcsName; public int type; - public Int64 cbSize; + public long cbSize; public FILETIME mtime; public FILETIME ctime; public FILETIME atime; @@ -38,17 +38,17 @@ namespace System.Runtime.InteropServices.ComTypes public interface IStream { // ISequentialStream portion - void Read([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), Out] Byte[] pv, int cb, IntPtr pcbRead); - void Write([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] Byte[] pv, int cb, IntPtr pcbWritten); + void Read([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), Out] byte[] pv, int cb, IntPtr pcbRead); + void Write([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] pv, int cb, IntPtr pcbWritten); // IStream portion - void Seek(Int64 dlibMove, int dwOrigin, IntPtr plibNewPosition); - void SetSize(Int64 libNewSize); - void CopyTo(IStream pstm, Int64 cb, IntPtr pcbRead, IntPtr pcbWritten); + void Seek(long dlibMove, int dwOrigin, IntPtr plibNewPosition); + void SetSize(long libNewSize); + void CopyTo(IStream pstm, long cb, IntPtr pcbRead, IntPtr pcbWritten); void Commit(int grfCommitFlags); void Revert(); - void LockRegion(Int64 libOffset, Int64 cb, int dwLockType); - void UnlockRegion(Int64 libOffset, Int64 cb, int dwLockType); + void LockRegion(long libOffset, long cb, int dwLockType); + void UnlockRegion(long libOffset, long cb, int dwLockType); void Stat(out STATSTG pstatstg, int grfStatFlag); void Clone(out IStream ppstm); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeComp.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeComp.cs index ae403d138c..a05d7af1eb 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeComp.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeComp.cs @@ -42,7 +42,7 @@ namespace System.Runtime.InteropServices.ComTypes [ComImport] public interface ITypeComp { - void Bind([MarshalAs(UnmanagedType.LPWStr)] String szName, int lHashVal, Int16 wFlags, out ITypeInfo ppTInfo, out DESCKIND pDescKind, out BINDPTR pBindPtr); - void BindType([MarshalAs(UnmanagedType.LPWStr)] String szName, int lHashVal, out ITypeInfo ppTInfo, out ITypeComp ppTComp); + void Bind([MarshalAs(UnmanagedType.LPWStr)] string szName, int lHashVal, short wFlags, out ITypeInfo ppTInfo, out DESCKIND pDescKind, out BINDPTR pBindPtr); + void BindType([MarshalAs(UnmanagedType.LPWStr)] string szName, int lHashVal, out ITypeInfo ppTInfo, out ITypeComp ppTComp); } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeInfo.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeInfo.cs index 4cd102f76e..47faab5c63 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeInfo.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeInfo.cs @@ -66,21 +66,21 @@ namespace System.Runtime.InteropServices.ComTypes // Actual fields of the TypeAttr struct. public Guid guid; - public Int32 lcid; - public Int32 dwReserved; - public Int32 memidConstructor; - public Int32 memidDestructor; + public int lcid; + public int dwReserved; + public int memidConstructor; + public int memidDestructor; public IntPtr lpstrSchema; - public Int32 cbSizeInstance; + public int cbSizeInstance; public TYPEKIND typekind; - public Int16 cFuncs; - public Int16 cVars; - public Int16 cImplTypes; - public Int16 cbSizeVft; - public Int16 cbAlignment; + public short cFuncs; + public short cVars; + public short cImplTypes; + public short cbSizeVft; + public short cbAlignment; public TYPEFLAGS wTypeFlags; - public Int16 wMajorVerNum; - public Int16 wMinorVerNum; + public short wMajorVerNum; + public short wMinorVerNum; public TYPEDESC tdescAlias; public IDLDESC idldescType; } @@ -95,12 +95,12 @@ namespace System.Runtime.InteropServices.ComTypes public FUNCKIND funckind; //FUNCKIND funckind; public INVOKEKIND invkind; //INVOKEKIND invkind; public CALLCONV callconv; //CALLCONV callconv; - public Int16 cParams; //short cParams; - public Int16 cParamsOpt; //short cParamsOpt; - public Int16 oVft; //short oVft; - public Int16 cScodes; //short cScodes; + public short cParams; //short cParams; + public short cParamsOpt; //short cParamsOpt; + public short oVft; //short oVft; + public short cScodes; //short cScodes; public ELEMDESC elemdescFunc; //ELEMDESC elemdescFunc; - public Int16 wFuncFlags; //WORD wFuncFlags; + public short wFuncFlags; //WORD wFuncFlags; } [Flags()] @@ -147,7 +147,7 @@ namespace System.Runtime.InteropServices.ComTypes public struct TYPEDESC { public IntPtr lpValue; - public Int16 vt; + public short vt; } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] @@ -181,7 +181,7 @@ namespace System.Runtime.InteropServices.ComTypes public struct VARDESC { public int memid; - public String lpstrSchema; + public string lpstrSchema; [System.Runtime.InteropServices.StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)] @@ -214,15 +214,15 @@ namespace System.Runtime.InteropServices.ComTypes public struct EXCEPINFO { - public Int16 wCode; - public Int16 wReserved; - [MarshalAs(UnmanagedType.BStr)] public String bstrSource; - [MarshalAs(UnmanagedType.BStr)] public String bstrDescription; - [MarshalAs(UnmanagedType.BStr)] public String bstrHelpFile; + public short wCode; + public short wReserved; + [MarshalAs(UnmanagedType.BStr)] public string bstrSource; + [MarshalAs(UnmanagedType.BStr)] public string bstrDescription; + [MarshalAs(UnmanagedType.BStr)] public string bstrHelpFile; public int dwHelpContext; public IntPtr pvReserved; public IntPtr pfnDeferredFillIn; - public Int32 scode; + public int scode; } public enum FUNCKIND : int @@ -302,17 +302,17 @@ namespace System.Runtime.InteropServices.ComTypes void GetTypeComp(out ITypeComp ppTComp); void GetFuncDesc(int index, out IntPtr ppFuncDesc); void GetVarDesc(int index, out IntPtr ppVarDesc); - void GetNames(int memid, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2), Out] String[] rgBstrNames, int cMaxNames, out int pcNames); + void GetNames(int memid, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2), Out] string[] rgBstrNames, int cMaxNames, out int pcNames); void GetRefTypeOfImplType(int index, out int href); void GetImplTypeFlags(int index, out IMPLTYPEFLAGS pImplTypeFlags); - void GetIDsOfNames([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1), In] String[] rgszNames, int cNames, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), Out] int[] pMemId); - void Invoke([MarshalAs(UnmanagedType.IUnknown)] Object pvInstance, int memid, Int16 wFlags, ref DISPPARAMS pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, out int puArgErr); - void GetDocumentation(int index, out String strName, out String strDocString, out int dwHelpContext, out String strHelpFile); + void GetIDsOfNames([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1), In] string[] rgszNames, int cNames, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), Out] int[] pMemId); + void Invoke([MarshalAs(UnmanagedType.IUnknown)] object pvInstance, int memid, short wFlags, ref DISPPARAMS pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, out int puArgErr); + void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile); void GetDllEntry(int memid, INVOKEKIND invKind, IntPtr pBstrDllName, IntPtr pBstrName, IntPtr pwOrdinal); void GetRefTypeInfo(int hRef, out ITypeInfo ppTI); void AddressOfMember(int memid, INVOKEKIND invKind, out IntPtr ppv); - void CreateInstance([MarshalAs(UnmanagedType.IUnknown)] Object pUnkOuter, [In] ref Guid riid, [MarshalAs(UnmanagedType.IUnknown), Out] out Object ppvObj); - void GetMops(int memid, out String pBstrMops); + void CreateInstance([MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, [In] ref Guid riid, [MarshalAs(UnmanagedType.IUnknown), Out] out object ppvObj); + void GetMops(int memid, out string pBstrMops); void GetContainingTypeLib(out ITypeLib ppTLB, out int pIndex); [PreserveSig] void ReleaseTypeAttr(IntPtr pTypeAttr); diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeInfo2.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeInfo2.cs index 7bb7138c46..728533c8c9 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeInfo2.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeInfo2.cs @@ -24,17 +24,17 @@ namespace System.Runtime.InteropServices.ComTypes new void GetTypeComp(out ITypeComp ppTComp); new void GetFuncDesc(int index, out IntPtr ppFuncDesc); new void GetVarDesc(int index, out IntPtr ppVarDesc); - new void GetNames(int memid, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2), Out] String[] rgBstrNames, int cMaxNames, out int pcNames); + new void GetNames(int memid, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2), Out] string[] rgBstrNames, int cMaxNames, out int pcNames); new void GetRefTypeOfImplType(int index, out int href); new void GetImplTypeFlags(int index, out IMPLTYPEFLAGS pImplTypeFlags); - new void GetIDsOfNames([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1), In] String[] rgszNames, int cNames, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), Out] int[] pMemId); - new void Invoke([MarshalAs(UnmanagedType.IUnknown)] Object pvInstance, int memid, Int16 wFlags, ref DISPPARAMS pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, out int puArgErr); - new void GetDocumentation(int index, out String strName, out String strDocString, out int dwHelpContext, out String strHelpFile); + new void GetIDsOfNames([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1), In] string[] rgszNames, int cNames, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), Out] int[] pMemId); + new void Invoke([MarshalAs(UnmanagedType.IUnknown)] object pvInstance, int memid, short wFlags, ref DISPPARAMS pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, out int puArgErr); + new void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile); new void GetDllEntry(int memid, INVOKEKIND invKind, IntPtr pBstrDllName, IntPtr pBstrName, IntPtr pwOrdinal); new void GetRefTypeInfo(int hRef, out ITypeInfo ppTI); new void AddressOfMember(int memid, INVOKEKIND invKind, out IntPtr ppv); - new void CreateInstance([MarshalAs(UnmanagedType.IUnknown)] Object pUnkOuter, [In] ref Guid riid, [MarshalAs(UnmanagedType.IUnknown), Out] out Object ppvObj); - new void GetMops(int memid, out String pBstrMops); + new void CreateInstance([MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, [In] ref Guid riid, [MarshalAs(UnmanagedType.IUnknown), Out] out object ppvObj); + new void GetMops(int memid, out string pBstrMops); new void GetContainingTypeLib(out ITypeLib ppTLB, out int pIndex); [PreserveSig] new void ReleaseTypeAttr(IntPtr pTypeAttr); @@ -46,13 +46,13 @@ namespace System.Runtime.InteropServices.ComTypes void GetTypeFlags(out int pTypeFlags); void GetFuncIndexOfMemId(int memid, INVOKEKIND invKind, out int pFuncIndex); void GetVarIndexOfMemId(int memid, out int pVarIndex); - void GetCustData(ref Guid guid, out Object pVarVal); - void GetFuncCustData(int index, ref Guid guid, out Object pVarVal); - void GetParamCustData(int indexFunc, int indexParam, ref Guid guid, out Object pVarVal); - void GetVarCustData(int index, ref Guid guid, out Object pVarVal); - void GetImplTypeCustData(int index, ref Guid guid, out Object pVarVal); + void GetCustData(ref Guid guid, out object pVarVal); + void GetFuncCustData(int index, ref Guid guid, out object pVarVal); + void GetParamCustData(int indexFunc, int indexParam, ref Guid guid, out object pVarVal); + void GetVarCustData(int index, ref Guid guid, out object pVarVal); + void GetImplTypeCustData(int index, ref Guid guid, out object pVarVal); [LCIDConversionAttribute(1)] - void GetDocumentation2(int memid, out String pbstrHelpString, out int pdwHelpStringContext, out String pbstrHelpStringDll); + void GetDocumentation2(int memid, out string pbstrHelpString, out int pdwHelpStringContext, out string pbstrHelpStringDll); void GetAllCustData(IntPtr pCustData); void GetAllFuncCustData(int index, IntPtr pCustData); void GetAllParamCustData(int indexFunc, int indexParam, IntPtr pCustData); diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeLib.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeLib.cs index 05a9e3f176..aa4b2d5260 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeLib.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeLib.cs @@ -38,8 +38,8 @@ namespace System.Runtime.InteropServices.ComTypes public Guid guid; public int lcid; public SYSKIND syskind; - public Int16 wMajorVerNum; - public Int16 wMinorVerNum; + public short wMajorVerNum; + public short wMinorVerNum; public LIBFLAGS wLibFlags; } @@ -55,10 +55,10 @@ namespace System.Runtime.InteropServices.ComTypes void GetTypeInfoOfGuid(ref Guid guid, out ITypeInfo ppTInfo); void GetLibAttr(out IntPtr ppTLibAttr); void GetTypeComp(out ITypeComp ppTComp); - void GetDocumentation(int index, out String strName, out String strDocString, out int dwHelpContext, out String strHelpFile); + void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile); [return: MarshalAs(UnmanagedType.Bool)] - bool IsName([MarshalAs(UnmanagedType.LPWStr)] String szNameBuf, int lHashVal); - void FindName([MarshalAs(UnmanagedType.LPWStr)] String szNameBuf, int lHashVal, [MarshalAs(UnmanagedType.LPArray), Out] ITypeInfo[] ppTInfo, [MarshalAs(UnmanagedType.LPArray), Out] int[] rgMemId, ref Int16 pcFound); + bool IsName([MarshalAs(UnmanagedType.LPWStr)] string szNameBuf, int lHashVal); + void FindName([MarshalAs(UnmanagedType.LPWStr)] string szNameBuf, int lHashVal, [MarshalAs(UnmanagedType.LPArray), Out] ITypeInfo[] ppTInfo, [MarshalAs(UnmanagedType.LPArray), Out] int[] rgMemId, ref short pcFound); [PreserveSig] void ReleaseTLibAttr(IntPtr pTLibAttr); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeLib2.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeLib2.cs index 48f4fb3782..b8f7b83044 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeLib2.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComTypes/ITypeLib2.cs @@ -27,15 +27,15 @@ namespace System.Runtime.InteropServices.ComTypes new void GetTypeInfoOfGuid(ref Guid guid, out ITypeInfo ppTInfo); new void GetLibAttr(out IntPtr ppTLibAttr); new void GetTypeComp(out ITypeComp ppTComp); - new void GetDocumentation(int index, out String strName, out String strDocString, out int dwHelpContext, out String strHelpFile); + new void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile); [return: MarshalAs(UnmanagedType.Bool)] - new bool IsName([MarshalAs(UnmanagedType.LPWStr)] String szNameBuf, int lHashVal); - new void FindName([MarshalAs(UnmanagedType.LPWStr)] String szNameBuf, int lHashVal, [MarshalAs(UnmanagedType.LPArray), Out] ITypeInfo[] ppTInfo, [MarshalAs(UnmanagedType.LPArray), Out] int[] rgMemId, ref Int16 pcFound); + new bool IsName([MarshalAs(UnmanagedType.LPWStr)] string szNameBuf, int lHashVal); + new void FindName([MarshalAs(UnmanagedType.LPWStr)] string szNameBuf, int lHashVal, [MarshalAs(UnmanagedType.LPArray), Out] ITypeInfo[] ppTInfo, [MarshalAs(UnmanagedType.LPArray), Out] int[] rgMemId, ref short pcFound); [PreserveSig] new void ReleaseTLibAttr(IntPtr pTLibAttr); - void GetCustData(ref Guid guid, out Object pVarVal); + void GetCustData(ref Guid guid, out object pVarVal); [LCIDConversionAttribute(1)] - void GetDocumentation2(int index, out String pbstrHelpString, out int pdwHelpStringContext, out String pbstrHelpStringDll); + void GetDocumentation2(int index, out string pbstrHelpString, out int pdwHelpStringContext, out string pbstrHelpStringDll); void GetLibStatistics(IntPtr pcUniqueNames, out int pcchUniqueNames); void GetAllCustData(IntPtr pCustData); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/CurrencyWrapper.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/CurrencyWrapper.cs index 590925aafe..45d8de25f7 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/CurrencyWrapper.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/CurrencyWrapper.cs @@ -18,19 +18,19 @@ namespace System.Runtime.InteropServices { public sealed class CurrencyWrapper { - public CurrencyWrapper(Decimal obj) + public CurrencyWrapper(decimal obj) { m_WrappedObject = obj; } - public CurrencyWrapper(Object obj) + public CurrencyWrapper(object obj) { - if (!(obj is Decimal)) + if (!(obj is decimal)) throw new ArgumentException(SR.Arg_MustBeDecimal, nameof(obj)); - m_WrappedObject = (Decimal)obj; + m_WrappedObject = (decimal)obj; } - public Decimal WrappedObject + public decimal WrappedObject { get { @@ -38,6 +38,6 @@ namespace System.Runtime.InteropServices } } - private Decimal m_WrappedObject; + private decimal m_WrappedObject; } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/DispatchWrapper.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/DispatchWrapper.cs index 5fb78c56ad..100746242d 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/DispatchWrapper.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/DispatchWrapper.cs @@ -19,7 +19,7 @@ namespace System.Runtime.InteropServices { public sealed class DispatchWrapper { - public DispatchWrapper(Object obj) + public DispatchWrapper(object obj) { if (obj != null) { @@ -32,7 +32,7 @@ namespace System.Runtime.InteropServices m_WrappedObject = obj; } - public Object WrappedObject + public object WrappedObject { get { @@ -40,6 +40,6 @@ namespace System.Runtime.InteropServices } } - private Object m_WrappedObject; + private object m_WrappedObject; } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ErrorWrapper.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ErrorWrapper.cs index 34237d539a..de249f4777 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ErrorWrapper.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ErrorWrapper.cs @@ -23,7 +23,7 @@ namespace System.Runtime.InteropServices m_ErrorCode = errorCode; } - public ErrorWrapper(Object errorCode) + public ErrorWrapper(object errorCode) { if (!(errorCode is int)) throw new ArgumentException(SR.Arg_MustBeInt32, nameof(errorCode)); diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Expando/IExpando.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Expando/IExpando.cs index 2bd398b7a9..7cfbd94079 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Expando/IExpando.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Expando/IExpando.cs @@ -22,7 +22,7 @@ namespace System.Runtime.InteropServices.Expando { // Add a new Field to the reflection object. The field has // name as its name. - FieldInfo AddField(String name); + FieldInfo AddField(string name); // Removes the specified member. void RemoveMember(MemberInfo m); diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/GcHandle.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/GcHandle.cs index cec32bbd8c..85ed660176 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/GcHandle.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/GcHandle.cs @@ -55,7 +55,7 @@ namespace System.Runtime.InteropServices #endif // Allocate a handle storing the object and the type. - internal GCHandle(Object value, GCHandleType type) + internal GCHandle(object value, GCHandleType type) { // Make sure the type parameter is within the valid range for the enum. if ((uint)type > (uint)MaxHandleType) @@ -84,12 +84,12 @@ namespace System.Runtime.InteropServices // type - The type of GC handle to create. // // returns a new GC handle that protects the object. - public static GCHandle Alloc(Object value) + public static GCHandle Alloc(object value) { return new GCHandle(value, GCHandleType.Normal); } - public static GCHandle Alloc(Object value, GCHandleType type) + public static GCHandle Alloc(object value, GCHandleType type) { return new GCHandle(value, type); } @@ -112,7 +112,7 @@ namespace System.Runtime.InteropServices } // Target property - allows getting / updating of the handle's referent. - public Object Target + public object Target { get { @@ -201,7 +201,7 @@ namespace System.Runtime.InteropServices return m_handle.GetHashCode(); } - public override bool Equals(Object o) + public override bool Equals(object o) { GCHandle hnd; @@ -243,15 +243,15 @@ namespace System.Runtime.InteropServices // Internal native calls that this implementation uses. [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern IntPtr InternalAlloc(Object value, GCHandleType type); + internal static extern IntPtr InternalAlloc(object value, GCHandleType type); [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void InternalFree(IntPtr handle); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern Object InternalGet(IntPtr handle); + internal static extern object InternalGet(IntPtr handle); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern void InternalSet(IntPtr handle, Object value, bool isPinned); + internal static extern void InternalSet(IntPtr handle, object value, bool isPinned); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern Object InternalCompareExchange(IntPtr handle, Object value, Object oldValue, bool isPinned); + internal static extern object InternalCompareExchange(IntPtr handle, object value, object oldValue, bool isPinned); [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern IntPtr InternalAddrOfPinnedObject(IntPtr handle); diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ICustomAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ICustomAdapter.cs index f47d348699..934b9e2e84 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ICustomAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ICustomAdapter.cs @@ -18,6 +18,6 @@ namespace System.Runtime.InteropServices { public interface ICustomAdapter { - [return: MarshalAs(UnmanagedType.IUnknown)] Object GetUnderlyingObject(); + [return: MarshalAs(UnmanagedType.IUnknown)] object GetUnderlyingObject(); } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ICustomMarshaler.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ICustomMarshaler.cs index 571d78dfe3..c1cae83093 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ICustomMarshaler.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ICustomMarshaler.cs @@ -18,13 +18,13 @@ namespace System.Runtime.InteropServices { public interface ICustomMarshaler { - Object MarshalNativeToManaged(IntPtr pNativeData); + object MarshalNativeToManaged(IntPtr pNativeData); - IntPtr MarshalManagedToNative(Object ManagedObj); + IntPtr MarshalManagedToNative(object ManagedObj); void CleanUpNativeData(IntPtr pNativeData); - void CleanUpManagedData(Object ManagedObj); + void CleanUpManagedData(object ManagedObj); int GetNativeDataSize(); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/InvalidComObjectException.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/InvalidComObjectException.cs index d1ae2e2a91..f9bea3f693 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/InvalidComObjectException.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/InvalidComObjectException.cs @@ -27,13 +27,13 @@ namespace System.Runtime.InteropServices HResult = HResults.COR_E_INVALIDCOMOBJECT; } - public InvalidComObjectException(String message) + public InvalidComObjectException(string message) : base(message) { HResult = HResults.COR_E_INVALIDCOMOBJECT; } - public InvalidComObjectException(String message, Exception inner) + public InvalidComObjectException(string message, Exception inner) : base(message, inner) { HResult = HResults.COR_E_INVALIDCOMOBJECT; diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs index 74029081ad..1a4abbb954 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs @@ -26,13 +26,13 @@ namespace System.Runtime.InteropServices HResult = HResults.COR_E_INVALIDOLEVARIANTTYPE; } - public InvalidOleVariantTypeException(String message) + public InvalidOleVariantTypeException(string message) : base(message) { HResult = HResults.COR_E_INVALIDOLEVARIANTTYPE; } - public InvalidOleVariantTypeException(String message, Exception inner) + public InvalidOleVariantTypeException(string message, Exception inner) : base(message, inner) { HResult = HResults.COR_E_INVALIDOLEVARIANTTYPE; diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs index d4eb69e54e..3805c2f604 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs @@ -225,7 +225,7 @@ namespace System.Runtime.InteropServices //==================================================================== // SizeOf() //==================================================================== - public static int SizeOf(Object structure) + public static int SizeOf(object structure) { if (structure == null) throw new ArgumentNullException(nameof(structure)); @@ -336,7 +336,7 @@ namespace System.Runtime.InteropServices CopyToNative(source, startIndex, destination, length); } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void CopyToNative(Object source, int startIndex, IntPtr destination, int length); + private static extern void CopyToNative(object source, int startIndex, IntPtr destination, int length); //==================================================================== // Copy blocks from native memory to CLR arrays @@ -374,12 +374,12 @@ namespace System.Runtime.InteropServices CopyToManaged(source, destination, startIndex, length); } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void CopyToManaged(IntPtr source, Object destination, int startIndex, int length); + private static extern void CopyToManaged(IntPtr source, object destination, int startIndex, int length); //==================================================================== // Read from memory //==================================================================== - public static byte ReadByte(Object ptr, int ofs) + public static byte ReadByte(object ptr, int ofs) { return ReadValueSlow(ptr, ofs, (IntPtr nativeHome, int offset) => Marshal.ReadByte(nativeHome, offset)); } @@ -403,7 +403,7 @@ namespace System.Runtime.InteropServices return ReadByte(ptr, 0); } - public static short ReadInt16(Object ptr, int ofs) + public static short ReadInt16(object ptr, int ofs) { return ReadValueSlow(ptr, ofs, (IntPtr nativeHome, int offset) => Marshal.ReadInt16(nativeHome, offset)); } @@ -479,7 +479,7 @@ namespace System.Runtime.InteropServices return ReadInt32(ptr, 0); } - public static IntPtr ReadIntPtr(Object ptr, int ofs) + public static IntPtr ReadIntPtr(object ptr, int ofs) { #if BIT64 return (IntPtr)ReadInt64(ptr, ofs); @@ -506,7 +506,7 @@ namespace System.Runtime.InteropServices #endif } - public static long ReadInt64([MarshalAs(UnmanagedType.AsAny), In] Object ptr, int ofs) + public static long ReadInt64([MarshalAs(UnmanagedType.AsAny), In] object ptr, int ofs) { return ReadValueSlow(ptr, ofs, (IntPtr nativeHome, int offset) => Marshal.ReadInt64(nativeHome, offset)); } @@ -602,7 +602,7 @@ namespace System.Runtime.InteropServices } } - public static void WriteByte(Object ptr, int ofs, byte val) + public static void WriteByte(object ptr, int ofs, byte val) { WriteValueSlow(ptr, ofs, val, (IntPtr nativeHome, int offset, byte value) => Marshal.WriteByte(nativeHome, offset, value)); } @@ -637,7 +637,7 @@ namespace System.Runtime.InteropServices } } - public static void WriteInt16(Object ptr, int ofs, short val) + public static void WriteInt16(object ptr, int ofs, short val) { WriteValueSlow(ptr, ofs, val, (IntPtr nativeHome, int offset, short value) => Marshal.WriteInt16(nativeHome, offset, value)); } @@ -652,7 +652,7 @@ namespace System.Runtime.InteropServices WriteInt16(ptr, ofs, (short)val); } - public static void WriteInt16([In, Out]Object ptr, int ofs, char val) + public static void WriteInt16([In, Out]object ptr, int ofs, char val) { WriteInt16(ptr, ofs, (short)val); } @@ -689,7 +689,7 @@ namespace System.Runtime.InteropServices } } - public static void WriteInt32(Object ptr, int ofs, int val) + public static void WriteInt32(object ptr, int ofs, int val) { WriteValueSlow(ptr, ofs, val, (IntPtr nativeHome, int offset, int value) => Marshal.WriteInt32(nativeHome, offset, value)); } @@ -708,7 +708,7 @@ namespace System.Runtime.InteropServices #endif } - public static void WriteIntPtr(Object ptr, int ofs, IntPtr val) + public static void WriteIntPtr(object ptr, int ofs, IntPtr val) { #if BIT64 WriteInt64(ptr, ofs, (long)val); @@ -757,7 +757,7 @@ namespace System.Runtime.InteropServices } } - public static void WriteInt64(Object ptr, int ofs, long val) + public static void WriteInt64(object ptr, int ofs, long val) { WriteValueSlow(ptr, ofs, val, (IntPtr nativeHome, int offset, long value) => Marshal.WriteInt64(nativeHome, offset, value)); } @@ -877,7 +877,7 @@ namespace System.Runtime.InteropServices // "fDeleteOld" is true, this routine will call DestroyStructure() first. //==================================================================== [MethodImplAttribute(MethodImplOptions.InternalCall), ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - public static extern void StructureToPtr(Object structure, IntPtr ptr, bool fDeleteOld); + public static extern void StructureToPtr(object structure, IntPtr ptr, bool fDeleteOld); public static void StructureToPtr<T>(T structure, IntPtr ptr, bool fDeleteOld) { @@ -887,7 +887,7 @@ namespace System.Runtime.InteropServices //==================================================================== // Marshals data from a native memory block to a preallocated structure class. //==================================================================== - public static void PtrToStructure(IntPtr ptr, Object structure) + public static void PtrToStructure(IntPtr ptr, object structure) { PtrToStructureHelper(ptr, structure, false); } @@ -901,7 +901,7 @@ namespace System.Runtime.InteropServices // Creates a new instance of "structuretype" and marshals data from a // native memory block to it. //==================================================================== - public static Object PtrToStructure(IntPtr ptr, Type structureType) + public static object PtrToStructure(IntPtr ptr, Type structureType) { if (ptr == IntPtr.Zero) return null; @@ -916,7 +916,7 @@ namespace System.Runtime.InteropServices if (rt == null) throw new ArgumentException(SR.Arg_MustBeType, nameof(structureType)); - Object structure = rt.CreateInstanceDefaultCtor(false /*publicOnly*/, false /*skipCheckThis*/, false /*fillCache*/, true /*wrapExceptions*/); + object structure = rt.CreateInstanceDefaultCtor(false /*publicOnly*/, false /*skipCheckThis*/, false /*fillCache*/, true /*wrapExceptions*/); PtrToStructureHelper(ptr, structure, true); return structure; } @@ -930,7 +930,7 @@ namespace System.Runtime.InteropServices // Helper function to copy a pointer into a preallocated structure. //==================================================================== [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void PtrToStructureHelper(IntPtr ptr, Object structure, bool allowValueClasses); + private static extern void PtrToStructureHelper(IntPtr ptr, object structure, bool allowValueClasses); //==================================================================== @@ -1020,7 +1020,7 @@ namespace System.Runtime.InteropServices public static IntPtr AllocHGlobal(IntPtr cb) { // For backwards compatibility on 32 bit platforms, ensure we pass values between - // Int32.MaxValue and UInt32.MaxValue to Windows. If the binary has had the + // int.MaxValue and uint.MaxValue to Windows. If the binary has had the // LARGEADDRESSAWARE bit set in the PE header, it may get 3 or 4 GB of user mode // address space. It is remotely that those allocations could have succeeded, // though I couldn't reproduce that. In either case, that means we should continue @@ -1188,13 +1188,13 @@ namespace System.Runtime.InteropServices // is the one where the RCW was first seen. Will return null // otherwise. //==================================================================== - public static IntPtr /* IUnknown* */ GetIUnknownForObject(Object o) + public static IntPtr /* IUnknown* */ GetIUnknownForObject(object o) { return GetIUnknownForObjectNative(o, false); } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern IntPtr /* IUnknown* */ GetIUnknownForObjectNative(Object o, bool onlyInContext); + private static extern IntPtr /* IUnknown* */ GetIUnknownForObjectNative(object o, bool onlyInContext); //==================================================================== // return the raw IUnknown* for a COM Object not related to current @@ -1202,13 +1202,13 @@ namespace System.Runtime.InteropServices // Does not call AddRef //==================================================================== [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern IntPtr /* IUnknown* */ GetRawIUnknownForComObjectNoAddRef(Object o); + internal static extern IntPtr /* IUnknown* */ GetRawIUnknownForComObjectNoAddRef(object o); #endif // FEATURE_COMINTEROP //==================================================================== // return the IDispatch* for an Object //==================================================================== - public static IntPtr /* IDispatch */ GetIDispatchForObject(Object o) + public static IntPtr /* IDispatch */ GetIDispatchForObject(object o) { throw new PlatformNotSupportedException(); } @@ -1219,7 +1219,7 @@ namespace System.Runtime.InteropServices // return the IUnknown* representing the interface for the Object // Object o should support Type T //==================================================================== - public static IntPtr /* IUnknown* */ GetComInterfaceForObject(Object o, Type T) + public static IntPtr /* IUnknown* */ GetComInterfaceForObject(object o, Type T) { return GetComInterfaceForObjectNative(o, T, false, true); } @@ -1234,20 +1234,20 @@ namespace System.Runtime.InteropServices // Object o should support Type T, it refer the value of mode to // invoke customized QueryInterface or not //==================================================================== - public static IntPtr /* IUnknown* */ GetComInterfaceForObject(Object o, Type T, CustomQueryInterfaceMode mode) + public static IntPtr /* IUnknown* */ GetComInterfaceForObject(object o, Type T, CustomQueryInterfaceMode mode) { bool bEnableCustomizedQueryInterface = ((mode == CustomQueryInterfaceMode.Allow) ? true : false); return GetComInterfaceForObjectNative(o, T, false, bEnableCustomizedQueryInterface); } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern IntPtr /* IUnknown* */ GetComInterfaceForObjectNative(Object o, Type t, bool onlyInContext, bool fEnalbeCustomizedQueryInterface); + private static extern IntPtr /* IUnknown* */ GetComInterfaceForObjectNative(object o, Type t, bool onlyInContext, bool fEnalbeCustomizedQueryInterface); //==================================================================== // return an Object for IUnknown //==================================================================== [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern Object GetObjectForIUnknown(IntPtr /* IUnknown* */ pUnk); + public static extern object GetObjectForIUnknown(IntPtr /* IUnknown* */ pUnk); //==================================================================== // Return a unique Object given an IUnknown. This ensures that you @@ -1257,7 +1257,7 @@ namespace System.Runtime.InteropServices // and not worry about other active uses of said RCW. //==================================================================== [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern Object GetUniqueObjectForIUnknown(IntPtr unknown); + public static extern object GetUniqueObjectForIUnknown(IntPtr unknown); //==================================================================== // return an Object for IUnknown, using the Type T, @@ -1266,10 +1266,10 @@ namespace System.Runtime.InteropServices // imported Type //==================================================================== [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern Object GetTypedObjectForIUnknown(IntPtr /* IUnknown* */ pUnk, Type t); + public static extern object GetTypedObjectForIUnknown(IntPtr /* IUnknown* */ pUnk, Type t); [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern IntPtr CreateAggregatedObject(IntPtr pOuter, Object o); + public static extern IntPtr CreateAggregatedObject(IntPtr pOuter, object o); public static IntPtr CreateAggregatedObject<T>(IntPtr pOuter, T o) { @@ -1286,7 +1286,7 @@ namespace System.Runtime.InteropServices // check if the object is classic COM component //==================================================================== [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern bool IsComObject(Object o); + public static extern bool IsComObject(object o); #endif // FEATURE_COMINTEROP @@ -1449,7 +1449,7 @@ namespace System.Runtime.InteropServices // release the COM component and if the reference hits 0 zombie this object // further usage of this Object might throw an exception //==================================================================== - public static int ReleaseComObject(Object o) + public static int ReleaseComObject(object o) { __ComObject co = null; @@ -1467,14 +1467,14 @@ namespace System.Runtime.InteropServices } [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern int InternalReleaseComObject(Object o); + internal static extern int InternalReleaseComObject(object o); //==================================================================== // release the COM component and zombie this object // further usage of this Object might throw an exception //==================================================================== - public static Int32 FinalReleaseComObject(Object o) + public static int FinalReleaseComObject(object o) { if (o == null) throw new ArgumentNullException(nameof(o)); @@ -1497,13 +1497,13 @@ namespace System.Runtime.InteropServices } [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern void InternalFinalReleaseComObject(Object o); + internal static extern void InternalFinalReleaseComObject(object o); #endif // FEATURE_COMINTEROP //==================================================================== // This method retrieves data from the COM object. //==================================================================== - public static Object GetComObjectData(Object obj, Object key) + public static object GetComObjectData(object obj, object key) { throw new PlatformNotSupportedException(SR.Arg_PlatformNotSupported); } @@ -1514,7 +1514,7 @@ namespace System.Runtime.InteropServices // true if the data has been added, false if the data could not be // added because there already was data for the specified key. //==================================================================== - public static bool SetComObjectData(Object obj, Object key, Object data) + public static bool SetComObjectData(object obj, object key, object data) { throw new PlatformNotSupportedException(SR.Arg_PlatformNotSupported); } @@ -1524,7 +1524,7 @@ namespace System.Runtime.InteropServices // This method takes the given COM object and wraps it in an object // of the specified type. The type must be derived from __ComObject. //==================================================================== - public static Object CreateWrapperOfType(Object o, Type t) + public static object CreateWrapperOfType(object o, Type t) { // Validate the arguments. if (t == null) @@ -1552,7 +1552,7 @@ namespace System.Runtime.InteropServices return o; // Check to see if we already have a cached wrapper for this type. - Object Wrapper = GetComObjectData(o, t); + object Wrapper = GetComObjectData(o, t); if (Wrapper == null) { // Create the wrapper for the specified type. @@ -1578,7 +1578,7 @@ namespace System.Runtime.InteropServices // Helper method called from CreateWrapperOfType. //==================================================================== [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern Object InternalCreateWrapperOfType(Object o, Type t); + private static extern object InternalCreateWrapperOfType(object o, Type t); //==================================================================== // IUnknown Helpers @@ -1592,7 +1592,7 @@ namespace System.Runtime.InteropServices public static extern int /* ULONG */ Release(IntPtr /* IUnknown */ pUnk); [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern void GetNativeVariantForObject(Object obj, /* VARIANT * */ IntPtr pDstNativeVariant); + public static extern void GetNativeVariantForObject(object obj, /* VARIANT * */ IntPtr pDstNativeVariant); public static void GetNativeVariantForObject<T>(T obj, IntPtr pDstNativeVariant) { @@ -1600,7 +1600,7 @@ namespace System.Runtime.InteropServices } [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern Object GetObjectForNativeVariant(/* VARIANT * */ IntPtr pSrcNativeVariant); + public static extern object GetObjectForNativeVariant(/* VARIANT * */ IntPtr pSrcNativeVariant); public static T GetObjectForNativeVariant<T>(IntPtr pSrcNativeVariant) { @@ -1608,7 +1608,7 @@ namespace System.Runtime.InteropServices } [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern Object[] GetObjectsForNativeVariants(/* VARIANT * */ IntPtr aSrcNativeVariant, int cVars); + public static extern object[] GetObjectsForNativeVariants(/* VARIANT * */ IntPtr aSrcNativeVariant, int cVars); public static T[] GetObjectsForNativeVariants<T>(IntPtr aSrcNativeVariant, int cVars) { @@ -1688,13 +1688,13 @@ namespace System.Runtime.InteropServices //==================================================================== // This method binds to the specified moniker. //==================================================================== - public static Object BindToMoniker(string monikerName) + public static object BindToMoniker(string monikerName) { - Object obj = null; + object obj = null; IBindCtx bindctx = null; CreateBindCtx(0, out bindctx); - UInt32 cbEaten; + uint cbEaten; IMoniker pmoniker = null; MkParseDisplayName(bindctx, monikerName, out cbEaten, out pmoniker); @@ -1703,13 +1703,13 @@ namespace System.Runtime.InteropServices } [DllImport(Interop.Libraries.Ole32, PreserveSig = false)] - private static extern void CreateBindCtx(UInt32 reserved, out IBindCtx ppbc); + private static extern void CreateBindCtx(uint reserved, out IBindCtx ppbc); [DllImport(Interop.Libraries.Ole32, PreserveSig = false)] - private static extern void MkParseDisplayName(IBindCtx pbc, [MarshalAs(UnmanagedType.LPWStr)] string szUserName, out UInt32 pchEaten, out IMoniker ppmk); + private static extern void MkParseDisplayName(IBindCtx pbc, [MarshalAs(UnmanagedType.LPWStr)] string szUserName, out uint pchEaten, out IMoniker ppmk); [DllImport(Interop.Libraries.Ole32, PreserveSig = false)] - private static extern void BindMoniker(IMoniker pmk, UInt32 grfOpt, ref Guid iidResult, [MarshalAs(UnmanagedType.Interface)] out Object ppvResult); + private static extern void BindMoniker(IMoniker pmk, uint grfOpt, ref Guid iidResult, [MarshalAs(UnmanagedType.Interface)] out object ppvResult); //======================================================================== // Private method called from EE upon use of license/ICF2 marshaling. @@ -1721,7 +1721,7 @@ namespace System.Runtime.InteropServices } [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern void ChangeWrapperHandleStrength(Object otp, bool fIsWeak); + public static extern void ChangeWrapperHandleStrength(object otp, bool fIsWeak); [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void InitializeWrapperForWinRT(object o, ref IntPtr pUnk); diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs index d421636c4b..8afc470829 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs @@ -27,9 +27,9 @@ namespace System.Runtime.InteropServices internal static class RuntimeEnvironment { [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern String GetModuleFileName(); + internal static extern string GetModuleFileName(); - public static String GetSystemVersion() + public static string GetSystemVersion() { return Assembly.GetExecutingAssembly().ImageRuntimeVersion; } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/SEHException.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/SEHException.cs index 039059e7e8..e933baab43 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/SEHException.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/SEHException.cs @@ -28,13 +28,13 @@ namespace System.Runtime.InteropServices HResult = HResults.E_FAIL; } - public SEHException(String message) + public SEHException(string message) : base(message) { HResult = HResults.E_FAIL; } - public SEHException(String message, Exception inner) + public SEHException(string message, Exception inner) : base(message, inner) { HResult = HResults.E_FAIL; diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs index 7f6a24f593..28154e9dee 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs @@ -26,13 +26,13 @@ namespace System.Runtime.InteropServices HResult = HResults.COR_E_SAFEARRAYRANKMISMATCH; } - public SafeArrayRankMismatchException(String message) + public SafeArrayRankMismatchException(string message) : base(message) { HResult = HResults.COR_E_SAFEARRAYRANKMISMATCH; } - public SafeArrayRankMismatchException(String message, Exception inner) + public SafeArrayRankMismatchException(string message, Exception inner) : base(message, inner) { HResult = HResults.COR_E_SAFEARRAYRANKMISMATCH; diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs index e155dcf64d..4118628dc6 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs @@ -27,13 +27,13 @@ namespace System.Runtime.InteropServices HResult = HResults.COR_E_SAFEARRAYTYPEMISMATCH; } - public SafeArrayTypeMismatchException(String message) + public SafeArrayTypeMismatchException(string message) : base(message) { HResult = HResults.COR_E_SAFEARRAYTYPEMISMATCH; } - public SafeArrayTypeMismatchException(String message, Exception inner) + public SafeArrayTypeMismatchException(string message, Exception inner) : base(message, inner) { HResult = HResults.COR_E_SAFEARRAYTYPEMISMATCH; diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/UnknownWrapper.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/UnknownWrapper.cs index de06cbf1a8..dc57bb47e1 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/UnknownWrapper.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/UnknownWrapper.cs @@ -18,12 +18,12 @@ namespace System.Runtime.InteropServices { public sealed class UnknownWrapper { - public UnknownWrapper(Object obj) + public UnknownWrapper(object obj) { m_WrappedObject = obj; } - public Object WrappedObject + public object WrappedObject { get { @@ -31,6 +31,6 @@ namespace System.Runtime.InteropServices } } - private Object m_WrappedObject; + private object m_WrappedObject; } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/VariantWrapper.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/VariantWrapper.cs index 455f0759fe..3abf880772 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/VariantWrapper.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/VariantWrapper.cs @@ -18,12 +18,12 @@ namespace System.Runtime.InteropServices { public sealed class VariantWrapper { - public VariantWrapper(Object obj) + public VariantWrapper(object obj) { m_WrappedObject = obj; } - public Object WrappedObject + public object WrappedObject { get { @@ -31,6 +31,6 @@ namespace System.Runtime.InteropServices } } - private Object m_WrappedObject; + private object m_WrappedObject; } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs index e34e4f62fa..ce4be3415e 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs @@ -36,7 +36,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { IBindableVector _this = Unsafe.As<IBindableVector>(this); uint size = _this.Size; - if (((uint)Int32.MaxValue) < size) + if (((uint)int.MaxValue) < size) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs index eb9fbc4f1c..f14aaa60e5 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs @@ -58,7 +58,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime _this.Append(value); uint size = _this.Size; - if (((uint)Int32.MaxValue) < size) + if (((uint)int.MaxValue) < size) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge); } @@ -105,7 +105,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime if (!exists) return -1; - if (((uint)Int32.MaxValue) < index) + if (((uint)int.MaxValue) < index) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge); } @@ -133,7 +133,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime if (exists) { - if (((uint)Int32.MaxValue) < index) + if (((uint)int.MaxValue) < index) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs index 44b42e4ca3..17bb6f43d4 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs @@ -14,12 +14,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime internal class CLRIPropertyValueImpl : IPropertyValue { private PropertyType _type; - private Object _data; + private object _data; // Numeric scalar types which participate in coersion private static volatile Tuple<Type, PropertyType>[] s_numericScalarTypes; - internal CLRIPropertyValueImpl(PropertyType type, Object data) + internal CLRIPropertyValueImpl(PropertyType type, object data) { _type = type; _data = data; @@ -32,15 +32,15 @@ namespace System.Runtime.InteropServices.WindowsRuntime if (s_numericScalarTypes == null) { Tuple<Type, PropertyType>[] numericScalarTypes = new Tuple<Type, PropertyType>[] { - new Tuple<Type, PropertyType>(typeof(Byte), PropertyType.UInt8), - new Tuple<Type, PropertyType>(typeof(Int16), PropertyType.Int16), - new Tuple<Type, PropertyType>(typeof(UInt16), PropertyType.UInt16), - new Tuple<Type, PropertyType>(typeof(Int32), PropertyType.Int32), - new Tuple<Type, PropertyType>(typeof(UInt32), PropertyType.UInt32), - new Tuple<Type, PropertyType>(typeof(Int64), PropertyType.Int64), - new Tuple<Type, PropertyType>(typeof(UInt64), PropertyType.UInt64), - new Tuple<Type, PropertyType>(typeof(Single), PropertyType.Single), - new Tuple<Type, PropertyType>(typeof(Double), PropertyType.Double) + new Tuple<Type, PropertyType>(typeof(byte), PropertyType.UInt8), + new Tuple<Type, PropertyType>(typeof(short), PropertyType.Int16), + new Tuple<Type, PropertyType>(typeof(ushort), PropertyType.UInt16), + new Tuple<Type, PropertyType>(typeof(int), PropertyType.Int32), + new Tuple<Type, PropertyType>(typeof(uint), PropertyType.UInt32), + new Tuple<Type, PropertyType>(typeof(long), PropertyType.Int64), + new Tuple<Type, PropertyType>(typeof(ulong), PropertyType.UInt64), + new Tuple<Type, PropertyType>(typeof(float), PropertyType.Single), + new Tuple<Type, PropertyType>(typeof(double), PropertyType.Double) }; s_numericScalarTypes = numericScalarTypes; @@ -75,49 +75,49 @@ namespace System.Runtime.InteropServices.WindowsRuntime } } - public Byte GetUInt8() + public byte GetUInt8() { - return CoerceScalarValue<Byte>(PropertyType.UInt8); + return CoerceScalarValue<byte>(PropertyType.UInt8); } - public Int16 GetInt16() + public short GetInt16() { - return CoerceScalarValue<Int16>(PropertyType.Int16); + return CoerceScalarValue<short>(PropertyType.Int16); } - public UInt16 GetUInt16() + public ushort GetUInt16() { - return CoerceScalarValue<UInt16>(PropertyType.UInt16); + return CoerceScalarValue<ushort>(PropertyType.UInt16); } - public Int32 GetInt32() + public int GetInt32() { - return CoerceScalarValue<Int32>(PropertyType.Int32); + return CoerceScalarValue<int>(PropertyType.Int32); } - public UInt32 GetUInt32() + public uint GetUInt32() { - return CoerceScalarValue<UInt32>(PropertyType.UInt32); + return CoerceScalarValue<uint>(PropertyType.UInt32); } - public Int64 GetInt64() + public long GetInt64() { - return CoerceScalarValue<Int64>(PropertyType.Int64); + return CoerceScalarValue<long>(PropertyType.Int64); } - public UInt64 GetUInt64() + public ulong GetUInt64() { - return CoerceScalarValue<UInt64>(PropertyType.UInt64); + return CoerceScalarValue<ulong>(PropertyType.UInt64); } - public Single GetSingle() + public float GetSingle() { - return CoerceScalarValue<Single>(PropertyType.Single); + return CoerceScalarValue<float>(PropertyType.Single); } - public Double GetDouble() + public double GetDouble() { - return CoerceScalarValue<Double>(PropertyType.Double); + return CoerceScalarValue<double>(PropertyType.Double); } public char GetChar16() @@ -127,16 +127,16 @@ namespace System.Runtime.InteropServices.WindowsRuntime return (char)_data; } - public Boolean GetBoolean() + public bool GetBoolean() { if (this.Type != PropertyType.Boolean) throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Boolean"), HResults.TYPE_E_TYPEMISMATCH); return (bool)_data; } - public String GetString() + public string GetString() { - return CoerceScalarValue<String>(PropertyType.String); + return CoerceScalarValue<string>(PropertyType.String); } @@ -184,49 +184,49 @@ namespace System.Runtime.InteropServices.WindowsRuntime return Unbox<Rect>(IReferenceFactory.s_rectType); } - public Byte[] GetUInt8Array() + public byte[] GetUInt8Array() { - return CoerceArrayValue<Byte>(PropertyType.UInt8Array); + return CoerceArrayValue<byte>(PropertyType.UInt8Array); } - public Int16[] GetInt16Array() + public short[] GetInt16Array() { - return CoerceArrayValue<Int16>(PropertyType.Int16Array); + return CoerceArrayValue<short>(PropertyType.Int16Array); } - public UInt16[] GetUInt16Array() + public ushort[] GetUInt16Array() { - return CoerceArrayValue<UInt16>(PropertyType.UInt16Array); + return CoerceArrayValue<ushort>(PropertyType.UInt16Array); } - public Int32[] GetInt32Array() + public int[] GetInt32Array() { - return CoerceArrayValue<Int32>(PropertyType.Int32Array); + return CoerceArrayValue<int>(PropertyType.Int32Array); } - public UInt32[] GetUInt32Array() + public uint[] GetUInt32Array() { - return CoerceArrayValue<UInt32>(PropertyType.UInt32Array); + return CoerceArrayValue<uint>(PropertyType.UInt32Array); } - public Int64[] GetInt64Array() + public long[] GetInt64Array() { - return CoerceArrayValue<Int64>(PropertyType.Int64Array); + return CoerceArrayValue<long>(PropertyType.Int64Array); } - public UInt64[] GetUInt64Array() + public ulong[] GetUInt64Array() { - return CoerceArrayValue<UInt64>(PropertyType.UInt64Array); + return CoerceArrayValue<ulong>(PropertyType.UInt64Array); } - public Single[] GetSingleArray() + public float[] GetSingleArray() { - return CoerceArrayValue<Single>(PropertyType.SingleArray); + return CoerceArrayValue<float>(PropertyType.SingleArray); } - public Double[] GetDoubleArray() + public double[] GetDoubleArray() { - return CoerceArrayValue<Double>(PropertyType.DoubleArray); + return CoerceArrayValue<double>(PropertyType.DoubleArray); } public char[] GetChar16Array() @@ -236,23 +236,23 @@ namespace System.Runtime.InteropServices.WindowsRuntime return (char[])_data; } - public Boolean[] GetBooleanArray() + public bool[] GetBooleanArray() { if (this.Type != PropertyType.BooleanArray) throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Boolean[]"), HResults.TYPE_E_TYPEMISMATCH); return (bool[])_data; } - public String[] GetStringArray() + public string[] GetStringArray() { - return CoerceArrayValue<String>(PropertyType.StringArray); + return CoerceArrayValue<string>(PropertyType.StringArray); } - public Object[] GetInspectableArray() + public object[] GetInspectableArray() { if (this.Type != PropertyType.InspectableArray) throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Inspectable[]"), HResults.TYPE_E_TYPEMISMATCH); - return (Object[])_data; + return (object[])_data; } public Guid[] GetGuidArray() @@ -367,7 +367,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { return (T)(object)Guid.Parse((string)value); } - else if (type == PropertyType.Guid && typeof(T) == typeof(String)) + else if (type == PropertyType.Guid && typeof(T) == typeof(string)) { return (T)(object)((Guid)value).ToString("D", System.Globalization.CultureInfo.InvariantCulture); } @@ -401,39 +401,39 @@ namespace System.Runtime.InteropServices.WindowsRuntime IPropertyValue ipv = value as IPropertyValue; if (type == PropertyType.Inspectable && ipv != null) { - if (typeof(T) == typeof(Byte)) + if (typeof(T) == typeof(byte)) { return (T)(object)ipv.GetUInt8(); } - else if (typeof(T) == typeof(Int16)) + else if (typeof(T) == typeof(short)) { return (T)(object)ipv.GetInt16(); } - else if (typeof(T) == typeof(UInt16)) + else if (typeof(T) == typeof(ushort)) { return (T)(object)ipv.GetUInt16(); } - else if (typeof(T) == typeof(Int32)) + else if (typeof(T) == typeof(int)) { return (T)(object)ipv.GetUInt32(); } - else if (typeof(T) == typeof(UInt32)) + else if (typeof(T) == typeof(uint)) { return (T)(object)ipv.GetUInt32(); } - else if (typeof(T) == typeof(Int64)) + else if (typeof(T) == typeof(long)) { return (T)(object)ipv.GetInt64(); } - else if (typeof(T) == typeof(UInt64)) + else if (typeof(T) == typeof(ulong)) { return (T)(object)ipv.GetUInt64(); } - else if (typeof(T) == typeof(Single)) + else if (typeof(T) == typeof(float)) { return (T)(object)ipv.GetSingle(); } - else if (typeof(T) == typeof(Double)) + else if (typeof(T) == typeof(double)) { return (T)(object)ipv.GetDouble(); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs index 04150dbf05..7b70047e6d 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs @@ -50,7 +50,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // to the managed object, and free the native method. Also we want the return value boxed (aka normal value type boxing). // // This method is called by VM. - internal static Object UnboxHelper(Object wrapper) + internal static object UnboxHelper(object wrapper) { Debug.Assert(wrapper != null); IReference<T> reference = (IReference<T>)wrapper; @@ -108,7 +108,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // IList & ICollection methods. // This enables two-way data binding and index access in Jupiter // - Object IList.this[int index] + object IList.this[int index] { get { @@ -121,12 +121,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime } } - int IList.Add(Object value) + int IList.Add(object value) { return _list.Add(value); } - bool IList.Contains(Object value) + bool IList.Contains(object value) { return _list.Contains(value); } @@ -152,17 +152,17 @@ namespace System.Runtime.InteropServices.WindowsRuntime } } - int IList.IndexOf(Object value) + int IList.IndexOf(object value) { return _list.IndexOf(value); } - void IList.Insert(int index, Object value) + void IList.Insert(int index, object value) { _list.Insert(index, value); } - void IList.Remove(Object value) + void IList.Remove(object value) { _list.Remove(value); } @@ -185,7 +185,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime } } - Object ICollection.SyncRoot + object ICollection.SyncRoot { get { @@ -211,7 +211,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // to the managed object, and free the native method. // // This method is called by VM. - internal static Object UnboxHelper(Object wrapper) + internal static object UnboxHelper(object wrapper) { Debug.Assert(wrapper != null); IReferenceArray<T> reference = (IReferenceArray<T>)wrapper; @@ -228,7 +228,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime internal static readonly Type s_rectType = Type.GetType("Windows.Foundation.Rect, System.Runtime.WindowsRuntime"); internal static readonly Type s_sizeType = Type.GetType("Windows.Foundation.Size, System.Runtime.WindowsRuntime"); - internal static Object CreateIReference(Object obj) + internal static object CreateIReference(object obj) { Debug.Assert(obj != null, "Null should not be boxed."); @@ -239,8 +239,8 @@ namespace System.Runtime.InteropServices.WindowsRuntime if (type == typeof(int)) return new CLRIReferenceImpl<int>(PropertyType.Int32, (int)obj); - if (type == typeof(String)) - return new CLRIReferenceImpl<String>(PropertyType.String, (String)obj); + if (type == typeof(string)) + return new CLRIReferenceImpl<string>(PropertyType.String, (string)obj); if (type == typeof(byte)) return new CLRIReferenceImpl<byte>(PropertyType.UInt8, (byte)obj); if (type == typeof(short)) @@ -267,8 +267,8 @@ namespace System.Runtime.InteropServices.WindowsRuntime return new CLRIReferenceImpl<DateTimeOffset>(PropertyType.DateTime, (DateTimeOffset)obj); if (type == typeof(TimeSpan)) return new CLRIReferenceImpl<TimeSpan>(PropertyType.TimeSpan, (TimeSpan)obj); - if (type == typeof(Object)) - return new CLRIReferenceImpl<Object>(PropertyType.Inspectable, (Object)obj); + if (type == typeof(object)) + return new CLRIReferenceImpl<object>(PropertyType.Inspectable, (object)obj); if (type == typeof(RuntimeType)) { // If the type is System.RuntimeType, we want to use System.Type marshaler (it's parent of the type) return new CLRIReferenceImpl<Type>(PropertyType.Other, (Type)obj); @@ -296,14 +296,14 @@ namespace System.Runtime.InteropServices.WindowsRuntime if (propType.HasValue) { Type specificType = typeof(CLRIReferenceImpl<>).MakeGenericType(type); - return Activator.CreateInstance(specificType, new Object[] { propType.Value, obj }); + return Activator.CreateInstance(specificType, new object[] { propType.Value, obj }); } Debug.Fail("We should not see non-WinRT type here"); return null; } - internal static Object CreateIReferenceArray(Array obj) + internal static object CreateIReferenceArray(Array obj) { Debug.Assert(obj != null); Debug.Assert(obj.GetType().IsArray); @@ -314,8 +314,8 @@ namespace System.Runtime.InteropServices.WindowsRuntime if (type == typeof(int)) return new CLRIReferenceArrayImpl<int>(PropertyType.Int32Array, (int[])obj); - if (type == typeof(String)) - return new CLRIReferenceArrayImpl<String>(PropertyType.StringArray, (String[])obj); + if (type == typeof(string)) + return new CLRIReferenceArrayImpl<string>(PropertyType.StringArray, (string[])obj); if (type == typeof(byte)) return new CLRIReferenceArrayImpl<byte>(PropertyType.UInt8Array, (byte[])obj); if (type == typeof(short)) @@ -367,7 +367,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(System.Collections.Generic.KeyValuePair<,>)) { - Object[] objArray = new Object[obj.Length]; + object[] objArray = new object[obj.Length]; for (int i = 0; i < objArray.Length; i++) { objArray[i] = obj.GetValue(i); @@ -389,12 +389,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime { // All WinRT value type will be Property.Other Type specificType = typeof(CLRIReferenceArrayImpl<>).MakeGenericType(type); - return Activator.CreateInstance(specificType, new Object[] { propType.Value, obj }); + return Activator.CreateInstance(specificType, new object[] { propType.Value, obj }); } else { // All WinRT reference type (including arbitrary managed type) will be PropertyType.ObjectArray - return new CLRIReferenceArrayImpl<Object>(PropertyType.InspectableArray, (Object[])obj); + return new CLRIReferenceArrayImpl<object>(PropertyType.InspectableArray, (object[])obj); } } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs index e65025d839..a21d6a03b6 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs @@ -28,7 +28,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { private static readonly IComparer<TKey> keyComparator = Comparer<TKey>.Default; - public Int32 Compare(KeyValuePair<TKey, TValue> x, KeyValuePair<TKey, TValue> y) + public int Compare(KeyValuePair<TKey, TValue> x, KeyValuePair<TKey, TValue> y) { return keyComparator.Compare(x.Key, y.Key); } @@ -52,7 +52,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime } - private ConstantSplittableMap(KeyValuePair<TKey, TValue>[] items, Int32 firstItemIndex, Int32 lastItemIndex) + private ConstantSplittableMap(KeyValuePair<TKey, TValue>[] items, int firstItemIndex, int lastItemIndex) { this.items = items; this.firstItemIndex = firstItemIndex; @@ -60,11 +60,11 @@ namespace System.Runtime.InteropServices.WindowsRuntime } - private KeyValuePair<TKey, TValue>[] CreateKeyValueArray(Int32 count, IEnumerator<KeyValuePair<TKey, TValue>> data) + private KeyValuePair<TKey, TValue>[] CreateKeyValueArray(int count, IEnumerator<KeyValuePair<TKey, TValue>> data) { KeyValuePair<TKey, TValue>[] kvArray = new KeyValuePair<TKey, TValue>[count]; - Int32 i = 0; + int i = 0; while (data.MoveNext()) kvArray[i++] = data.Current; @@ -84,11 +84,11 @@ namespace System.Runtime.InteropServices.WindowsRuntime // [CLSCompliant(false)] - public UInt32 Size + public uint Size { get { - return (UInt32)(lastItemIndex - firstItemIndex + 1); + return (uint)(lastItemIndex - firstItemIndex + 1); } } @@ -140,7 +140,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime return; } - int pivot = (Int32)(((Int64)firstItemIndex + (Int64)lastItemIndex) / (Int64)2); + int pivot = (int)(((long)firstItemIndex + (long)lastItemIndex) / (long)2); firstPartition = new ConstantSplittableMap<TKey, TValue>(items, firstItemIndex, pivot); secondPartition = new ConstantSplittableMap<TKey, TValue>(items, pivot + 1, lastItemIndex); @@ -208,7 +208,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime } } - Object IEnumerator.Current + object IEnumerator.Current { get { diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryKeyCollection.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryKeyCollection.cs index f2434ce91d..2751209638 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryKeyCollection.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryKeyCollection.cs @@ -106,7 +106,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime return enumeration.MoveNext(); } - Object IEnumerator.Current + object IEnumerator.Current { get { return ((IEnumerator<TKey>)this).Current; } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryValueCollection.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryValueCollection.cs index d441a2fbf8..b1d9c8cb3a 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryValueCollection.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryValueCollection.cs @@ -113,7 +113,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime return enumeration.MoveNext(); } - Object IEnumerator.Current + object IEnumerator.Current { get { return ((IEnumerator<TValue>)this).Current; } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/EnumeratorToIteratorAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/EnumeratorToIteratorAdapter.cs index 3f3d8a99d6..5299af3b93 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/EnumeratorToIteratorAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/EnumeratorToIteratorAdapter.cs @@ -156,7 +156,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { string[] stringItems = items as string[]; - // Fill the rest of the array with String.Empty to avoid marshaling failure + // Fill the rest of the array with string.Empty to avoid marshaling failure for (int i = index; i < items.Length; ++i) stringItems[i] = string.Empty; } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs index f4f6ab9d4b..674bb51d23 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs @@ -199,7 +199,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime return enumeration.MoveNext(); } - Object IEnumerator.Current + object IEnumerator.Current { get { return ((IEnumerator<TKey>)this).Current; } } @@ -298,7 +298,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime return enumeration.MoveNext(); } - Object IEnumerator.Current + object IEnumerator.Current { get { return ((IEnumerator<TValue>)this).Current; } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IPropertyValue.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IPropertyValue.cs index 8a67119496..aefa7be4d1 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IPropertyValue.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IPropertyValue.cs @@ -23,29 +23,29 @@ namespace System.Runtime.InteropServices.WindowsRuntime get; } - Byte GetUInt8(); + byte GetUInt8(); - Int16 GetInt16(); + short GetInt16(); - UInt16 GetUInt16(); + ushort GetUInt16(); - Int32 GetInt32(); + int GetInt32(); - UInt32 GetUInt32(); + uint GetUInt32(); - Int64 GetInt64(); + long GetInt64(); - UInt64 GetUInt64(); + ulong GetUInt64(); - Single GetSingle(); + float GetSingle(); - Double GetDouble(); + double GetDouble(); char GetChar16(); - Boolean GetBoolean(); + bool GetBoolean(); - String GetString(); + string GetString(); Guid GetGuid(); @@ -59,29 +59,29 @@ namespace System.Runtime.InteropServices.WindowsRuntime Rect GetRect(); - Byte[] GetUInt8Array(); + byte[] GetUInt8Array(); - Int16[] GetInt16Array(); + short[] GetInt16Array(); - UInt16[] GetUInt16Array(); + ushort[] GetUInt16Array(); - Int32[] GetInt32Array(); + int[] GetInt32Array(); - UInt32[] GetUInt32Array(); + uint[] GetUInt32Array(); - Int64[] GetInt64Array(); + long[] GetInt64Array(); - UInt64[] GetUInt64Array(); + ulong[] GetUInt64Array(); - Single[] GetSingleArray(); + float[] GetSingleArray(); - Double[] GetDoubleArray(); + double[] GetDoubleArray(); char[] GetChar16Array(); - Boolean[] GetBooleanArray(); + bool[] GetBooleanArray(); - String[] GetStringArray(); + string[] GetStringArray(); object[] GetInspectableArray(); diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs index 3f1c02871d..6269f2e200 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs @@ -110,7 +110,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { string[] stringItems = items as string[]; - // Fill in the rest of the array with String.Empty to avoid marshaling failure + // Fill in the rest of the array with string.Empty to avoid marshaling failure for (uint i = itemCount; i < items.Length; ++i) stringItems[i] = string.Empty; } @@ -122,9 +122,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime private static void EnsureIndexInt32(uint index, int listCapacity) { - // We use '<=' and not '<' because Int32.MaxValue == index would imply - // that Size > Int32.MaxValue: - if (((uint)Int32.MaxValue) <= index || index >= (uint)listCapacity) + // We use '<=' and not '<' because int.MaxValue == index would imply + // that Size > int.MaxValue: + if (((uint)int.MaxValue) <= index || index >= (uint)listCapacity) { Exception e = new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexLargerThanMaxValue); e.HResult = HResults.E_BOUNDS; diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs index d7527c1ba9..08eb22b8e9 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs @@ -40,7 +40,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime try { - return _this[(Int32)index]; + return _this[(int)index]; } catch (ArgumentOutOfRangeException ex) { @@ -123,7 +123,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime try { - _this.RemoveAt((Int32)index); + _this.RemoveAt((int)index); } catch (ArgumentOutOfRangeException ex) { @@ -166,9 +166,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime private static void EnsureIndexInt32(uint index, int listCapacity) { - // We use '<=' and not '<' becasue Int32.MaxValue == index would imply - // that Size > Int32.MaxValue: - if (((uint)Int32.MaxValue) <= index || index >= (uint)listCapacity) + // We use '<=' and not '<' becasue int.MaxValue == index would imply + // that Size > int.MaxValue: + if (((uint)int.MaxValue) <= index || index >= (uint)listCapacity) { Exception e = new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexLargerThanMaxValue); e.HResult = HResults.E_BOUNDS; diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorViewAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorViewAdapter.cs index b453d90ba1..98beaf22f2 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorViewAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorViewAdapter.cs @@ -32,9 +32,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime private static void EnsureIndexInt32(uint index, int listCapacity) { - // We use '<=' and not '<' becasue Int32.MaxValue == index would imply - // that Size > Int32.MaxValue: - if (((uint)Int32.MaxValue) <= index || index >= (uint)listCapacity) + // We use '<=' and not '<' becasue int.MaxValue == index would imply + // that Size > int.MaxValue: + if (((uint)int.MaxValue) <= index || index >= (uint)listCapacity) { Exception e = new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexLargerThanMaxValue); e.HResult = HResults.E_BOUNDS; diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs index 2b146b7a4f..b6260dc52e 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs @@ -40,7 +40,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime try { - return _this[(Int32)index]; + return _this[(int)index]; } catch (ArgumentOutOfRangeException ex) { @@ -132,7 +132,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime try { - _this.RemoveAt((Int32)index); + _this.RemoveAt((int)index); } catch (ArgumentOutOfRangeException ex) { @@ -197,9 +197,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime private static void EnsureIndexInt32(uint index, int listCapacity) { - // We use '<=' and not '<' becasue Int32.MaxValue == index would imply - // that Size > Int32.MaxValue: - if (((uint)Int32.MaxValue) <= index || index >= (uint)listCapacity) + // We use '<=' and not '<' becasue int.MaxValue == index would imply + // that Size > int.MaxValue: + if (((uint)int.MaxValue) <= index || index >= (uint)listCapacity) { Exception e = new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexLargerThanMaxValue); e.HResult = HResults.E_BOUNDS; @@ -233,7 +233,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { string[] stringItems = items as string[]; - // Fill in rest of the array with String.Empty to avoid marshaling failure + // Fill in rest of the array with string.Empty to avoid marshaling failure for (uint i = itemCount; i < items.Length; ++i) stringItems[i] = string.Empty; } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs index c64703b80a..2ec85bb3f0 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs @@ -43,7 +43,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { uint size = _this_map.Size; - if (((uint)Int32.MaxValue) < size) + if (((uint)int.MaxValue) < size) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingDictionaryTooLarge); } @@ -55,7 +55,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime IVector<KeyValuePair<K, V>> _this_vector = Unsafe.As<IVector<KeyValuePair<K, V>>>(this); uint size = _this_vector.Size; - if (((uint)Int32.MaxValue) < size) + if (((uint)int.MaxValue) < size) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge); } @@ -171,7 +171,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime if (!exists) return false; - if (((uint)Int32.MaxValue) < index) + if (((uint)int.MaxValue) < index) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs index e1323dade4..880bffb623 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs @@ -43,7 +43,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { uint size = _this_map.Size; - if (((uint)Int32.MaxValue) < size) + if (((uint)int.MaxValue) < size) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingDictionaryTooLarge); } @@ -55,7 +55,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime IVectorView<KeyValuePair<K, V>> _this_vector = Unsafe.As<IVectorView<KeyValuePair<K, V>>>(this); uint size = _this_vector.Size; - if (((uint)Int32.MaxValue) < size) + if (((uint)int.MaxValue) < size) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs index 35b77b26d3..bda5168814 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs @@ -35,7 +35,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { IVector<T> _this = Unsafe.As<IVector<T>>(this); uint size = _this.Size; - if (((uint)Int32.MaxValue) < size) + if (((uint)int.MaxValue) < size) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge); } @@ -107,7 +107,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime if (!exists) return false; - if (((uint)Int32.MaxValue) < index) + if (((uint)int.MaxValue) < index) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs index ab3cb9c635..ee2c7df670 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs @@ -61,7 +61,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime if (!exists) return -1; - if (((uint)Int32.MaxValue) < index) + if (((uint)int.MaxValue) < index) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge); } @@ -109,7 +109,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime } } - private static void SetAt<T>(IVector<T> _this, UInt32 index, T value) + private static void SetAt<T>(IVector<T> _this, uint index, T value) { try { diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs index 58ec1dda92..bc87efa6dc 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs @@ -35,7 +35,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { IVectorView<T> _this = Unsafe.As<IVectorView<T>>(this); uint size = _this.Size; - if (((uint)Int32.MaxValue) < size) + if (((uint)int.MaxValue) < size) { throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge); } diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs index 7a4fef56e2..ad04b25dd2 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs @@ -363,7 +363,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime public bool Equals(EventCacheKey other) { - return (Object.Equals(target, other.target) && Object.Equals(method, other.method)); + return (object.Equals(target, other.target) && object.Equals(method, other.method)); } public int GetHashCode(EventCacheKey key) @@ -535,7 +535,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { foreach (KeyValuePair<object, EventRegistrationTokenListWithCount> item in registrationTable) { - if (Object.Equals(item.Key, handler)) + if (object.Equals(item.Key, handler)) { tokens = item.Value; return item.Key; @@ -1050,7 +1050,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { uint length; char* rawBuffer = UnsafeNativeMethods.WindowsGetStringRawBuffer(hstring, &length); - return new String(rawBuffer, 0, checked((int)length)); + return new string(rawBuffer, 0, checked((int)length)); } } @@ -1238,7 +1238,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime // HSTRING marshaling methods: - public static IntPtr StringToHString(String s) + public static IntPtr StringToHString(string s) { if (!Environment.IsWinRTSupported) throw new PlatformNotSupportedException(SR.PlatformNotSupported_WinRT); diff --git a/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs b/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs index cf5fc3cb11..7bc321aa2d 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs @@ -295,7 +295,7 @@ namespace System.Runtime.Loader // Custom AssemblyLoadContext implementations can override this // method to perform the load of unmanaged native dll // This function needs to return the HMODULE of the dll it loads - protected virtual IntPtr LoadUnmanagedDll(String unmanagedDllName) + protected virtual IntPtr LoadUnmanagedDll(string unmanagedDllName) { //defer to default coreclr policy of loading unmanaged dll return IntPtr.Zero; @@ -303,7 +303,7 @@ namespace System.Runtime.Loader // This method is invoked by the VM when using the host-provided assembly load context // implementation. - private static IntPtr ResolveUnmanagedDll(String unmanagedDllName, IntPtr gchManagedAssemblyLoadContext) + private static IntPtr ResolveUnmanagedDll(string unmanagedDllName, IntPtr gchManagedAssemblyLoadContext) { AssemblyLoadContext context = (AssemblyLoadContext)(GCHandle.FromIntPtr(gchManagedAssemblyLoadContext).Target); return context.LoadUnmanagedDll(unmanagedDllName); @@ -412,7 +412,7 @@ namespace System.Runtime.Loader private static volatile AssemblyLoadContext s_DefaultAssemblyLoadContext; // Synchronization primitive for controlling initialization of Default load context - private static readonly object s_initLock = new Object(); + private static readonly object s_initLock = new object(); // Occurs when an Assembly is loaded public static event AssemblyLoadEventHandler AssemblyLoad diff --git a/src/System.Private.CoreLib/src/System/Runtime/Serialization/FormatterServices.cs b/src/System.Private.CoreLib/src/System/Runtime/Serialization/FormatterServices.cs index 1377350b80..7642f1eb9e 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/Serialization/FormatterServices.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/Serialization/FormatterServices.cs @@ -38,7 +38,7 @@ namespace System.Runtime.Serialization // will not create an unitialized string because it is non-sensical to create an empty // instance of an immutable type. // - public static Object GetUninitializedObject(Type type) + public static object GetUninitializedObject(Type type) { if ((object)type == null) { @@ -54,7 +54,7 @@ namespace System.Runtime.Serialization } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern Object nativeGetUninitializedObject(RuntimeType type); + private static extern object nativeGetUninitializedObject(RuntimeType type); } } diff --git a/src/System.Private.CoreLib/src/System/RuntimeHandles.cs b/src/System.Private.CoreLib/src/System/RuntimeHandles.cs index dc659e3dee..f07ce90e52 100644 --- a/src/System.Private.CoreLib/src/System/RuntimeHandles.cs +++ b/src/System.Private.CoreLib/src/System/RuntimeHandles.cs @@ -45,7 +45,7 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern bool IsInstanceOfType(RuntimeType type, Object o); + internal static extern bool IsInstanceOfType(RuntimeType type, object o); internal static unsafe Type GetTypeHelper(Type typeStart, Type[] genericArgs, IntPtr pModifiers, int cModifiers) { @@ -219,16 +219,16 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern Object CreateInstance(RuntimeType type, bool publicOnly, bool wrapExceptions, ref bool canBeCached, ref RuntimeMethodHandleInternal ctor); + internal static extern object CreateInstance(RuntimeType type, bool publicOnly, bool wrapExceptions, ref bool canBeCached, ref RuntimeMethodHandleInternal ctor); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern Object CreateCaInstance(RuntimeType type, IRuntimeMethodInfo ctor); + internal static extern object CreateCaInstance(RuntimeType type, IRuntimeMethodInfo ctor); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern Object Allocate(RuntimeType type); + internal static extern object Allocate(RuntimeType type); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern Object CreateInstanceForAnotherGenericParameter(RuntimeType type, RuntimeType genericParameter); + internal static extern object CreateInstanceForAnotherGenericParameter(RuntimeType type, RuntimeType genericParameter); internal RuntimeType GetRuntimeType() { @@ -448,7 +448,7 @@ namespace System RuntimeType type = null; - Object keepAlive = null; + object keepAlive = null; GetTypeByName(name, throwOnError, ignoreCase, reflectionOnly, JitHelpers.GetStackCrawlMarkHandle(ref stackMark), pPrivHostBinder, @@ -1121,7 +1121,7 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern String GetName(RtFieldInfo field); + internal static extern string GetName(RtFieldInfo field); [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern unsafe void* _GetUtf8Name(RuntimeFieldHandleInternal field); @@ -1148,16 +1148,16 @@ namespace System internal static extern int GetToken(RtFieldInfo field); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern Object GetValue(RtFieldInfo field, Object instance, RuntimeType fieldType, RuntimeType declaringType, ref bool domainInitialized); + internal static extern object GetValue(RtFieldInfo field, object instance, RuntimeType fieldType, RuntimeType declaringType, ref bool domainInitialized); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern Object GetValueDirect(RtFieldInfo field, RuntimeType fieldType, void* pTypedRef, RuntimeType contextType); + internal static extern object GetValueDirect(RtFieldInfo field, RuntimeType fieldType, void* pTypedRef, RuntimeType contextType); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern void SetValue(RtFieldInfo field, Object obj, Object value, RuntimeType fieldType, FieldAttributes fieldAttr, RuntimeType declaringType, ref bool domainInitialized); + internal static extern void SetValue(RtFieldInfo field, object obj, object value, RuntimeType fieldType, FieldAttributes fieldAttr, RuntimeType declaringType, ref bool domainInitialized); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern void SetValueDirect(RtFieldInfo field, RuntimeType fieldType, void* pTypedRef, Object value, RuntimeType contextType); + internal static extern void SetValueDirect(RtFieldInfo field, RuntimeType fieldType, void* pTypedRef, object value, RuntimeType contextType); [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern RuntimeFieldHandleInternal GetStaticFieldForGenericType(RuntimeFieldHandleInternal field, RuntimeType declaringType); @@ -1528,7 +1528,7 @@ namespace System internal abstract unsafe void GetEHInfo(int EHNumber, void* exception); internal abstract unsafe byte[] GetRawEHInfo(); // token resolution - internal abstract String GetStringLiteral(int token); + internal abstract string GetStringLiteral(int token); internal abstract void ResolveToken(int token, out IntPtr typeHandle, out IntPtr methodHandle, out IntPtr fieldHandle); internal abstract byte[] ResolveSignature(int token, int fromMethod); // diff --git a/src/System.Private.CoreLib/src/System/String.CoreCLR.cs b/src/System.Private.CoreLib/src/System/String.CoreCLR.cs index a9688fe8a8..40a37c19c1 100644 --- a/src/System.Private.CoreLib/src/System/String.CoreCLR.cs +++ b/src/System.Private.CoreLib/src/System/String.CoreCLR.cs @@ -29,7 +29,7 @@ namespace System // We need to call the String constructor so that the compiler doesn't mark this as a literal. // Marking this as a literal would mean that it doesn't show up as a field which we can access // from native. - public static readonly String Empty; + public static readonly string Empty; // Gets the character at a specified position. // @@ -54,7 +54,7 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern String FastAllocateString(int length); + internal static extern string FastAllocateString(int length); // Is this a string that can be compared quickly (that is it has only characters > 0x80 // and not a - or ' @@ -73,7 +73,7 @@ namespace System internal extern bool TryGetTrailByte(out byte data); #endif - public static String Intern(String str) + public static string Intern(string str) { if (str == null) { @@ -83,7 +83,7 @@ namespace System return Thread.GetDomain().GetOrInternString(str); } - public static String IsInterned(String str) + public static string IsInterned(string str) { if (str == null) { @@ -94,7 +94,7 @@ namespace System } // Copies the source String (byte buffer) to the destination IntPtr memory allocated with len bytes. - internal static unsafe void InternalCopy(String src, IntPtr dest, int len) + internal static unsafe void InternalCopy(string src, IntPtr dest, int len) { if (len == 0) return; diff --git a/src/System.Private.CoreLib/src/System/StubHelpers.cs b/src/System.Private.CoreLib/src/System/StubHelpers.cs index 35aa214c67..069f752d4a 100644 --- a/src/System.Private.CoreLib/src/System/StubHelpers.cs +++ b/src/System.Private.CoreLib/src/System/StubHelpers.cs @@ -110,7 +110,7 @@ namespace System.StubHelpers if (IntPtr.Zero == cstr) return null; else - return new String((sbyte*)cstr); + return new string((sbyte*)cstr); } internal static void ClearNative(IntPtr pNative) @@ -307,12 +307,12 @@ namespace System.StubHelpers // In the empty string case, we need to use FastAllocateString rather than the // String .ctor, since newing up a 0 sized string will always return String.Emtpy. // When we marshal that out as a bstr, it can wind up getting modified which - // corrupts String.Empty. + // corrupts string.Empty. ret = string.FastAllocateString(0); } else { - ret = new String((char*)bstr, 0, (int)(length / 2)); + ret = new string((char*)bstr, 0, (int)(length / 2)); } if ((length & 1) == 1) @@ -387,7 +387,7 @@ namespace System.StubHelpers return null; } - return new String((sbyte*)pNative, 0, cch); + return new string((sbyte*)pNative, 0, cch); } internal static unsafe void ClearNative(IntPtr pNative) @@ -437,7 +437,7 @@ namespace System.StubHelpers // We intentionally ignore the length field of the BSTR for back compat reasons. // Unfortunately VB.NET uses Ansi BSTR marshaling when a string is passed ByRef // and we cannot afford to break this common scenario. - return new String((sbyte*)bstr); + return new string((sbyte*)bstr); } } @@ -480,24 +480,24 @@ namespace System.StubHelpers [StructLayout(LayoutKind.Sequential)] internal struct DateTimeNative { - public Int64 UniversalTime; + public long UniversalTime; }; internal static class DateTimeOffsetMarshaler { // Numer of ticks counted between 0001-01-01, 00:00:00 and 1601-01-01, 00:00:00. // You can get this through: (new DateTimeOffset(1601, 1, 1, 0, 0, 1, TimeSpan.Zero)).Ticks; - private const Int64 ManagedUtcTicksAtNativeZero = 504911232000000000; + private const long ManagedUtcTicksAtNativeZero = 504911232000000000; internal static void ConvertToNative(ref DateTimeOffset managedDTO, out DateTimeNative dateTime) { - Int64 managedUtcTicks = managedDTO.UtcTicks; + long managedUtcTicks = managedDTO.UtcTicks; dateTime.UniversalTime = managedUtcTicks - ManagedUtcTicksAtNativeZero; } internal static void ConvertToManaged(out DateTimeOffset managedLocalDTO, ref DateTimeNative nativeTicks) { - Int64 managedUtcTicks = ManagedUtcTicksAtNativeZero + nativeTicks.UniversalTime; + long managedUtcTicks = ManagedUtcTicksAtNativeZero + nativeTicks.UniversalTime; DateTimeOffset managedUtcDTO = new DateTimeOffset(managedUtcTicks, TimeSpan.Zero); // Some Utc times cannot be represented in local time in certain timezones. E.g. 0001-01-01 12:00:00 AM cannot @@ -742,7 +742,7 @@ namespace System.StubHelpers { if (managedArray != null) { - Int32* nativeBuffer = *(Int32**)pNativeHome; + int* nativeBuffer = *(int**)pNativeHome; for (int i = 0; i < managedArray.Length; i++) { nativeBuffer[i] = HResultExceptionMarshaler.ConvertToNative(managedArray[i]); @@ -809,7 +809,7 @@ namespace System.StubHelpers { if (managedArray != null) { - Int32* nativeBuffer = *(Int32**)pNativeHome; + int* nativeBuffer = *(int**)pNativeHome; for (int i = 0; i < managedArray.Length; i++) { managedArray[i] = HResultExceptionMarshaler.ConvertToManaged(nativeBuffer[i]); @@ -1454,7 +1454,7 @@ namespace System.StubHelpers private IntPtr data1; private IntPtr data2; #else - Int64 data1; + long data1; #endif } // struct NativeVariant @@ -1695,7 +1695,7 @@ namespace System.StubHelpers internal static extern unsafe int strlen(sbyte* ptr); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern void DecimalCanonicalizeInternal(ref Decimal dec); + internal static extern void DecimalCanonicalizeInternal(ref decimal dec); [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern unsafe void FmtClassUpdateNativeInternal(object obj, byte* pNative, ref CleanupWorkList pCleanupWorkList); diff --git a/src/System.Private.CoreLib/src/System/Text/CodePageDataItem.cs b/src/System.Private.CoreLib/src/System/Text/CodePageDataItem.cs index 6c7171a3e9..488537641a 100644 --- a/src/System.Private.CoreLib/src/System/Text/CodePageDataItem.cs +++ b/src/System.Private.CoreLib/src/System/Text/CodePageDataItem.cs @@ -21,9 +21,9 @@ namespace System.Text { internal int m_dataIndex; internal int m_uiFamilyCodePage; - internal String m_webName; - internal String m_headerName; - internal String m_bodyName; + internal string m_webName; + internal string m_headerName; + internal string m_bodyName; internal uint m_flags; internal unsafe CodePageDataItem(int dataIndex) @@ -33,7 +33,7 @@ namespace System.Text m_flags = EncodingTable.codePageDataPtr[dataIndex].flags; } - internal static unsafe String CreateString(sbyte* pStrings, uint index) + internal static unsafe string CreateString(sbyte* pStrings, uint index) { if (pStrings[0] == '|') // |str1|str2|str3 { @@ -47,7 +47,7 @@ namespace System.Text { if (index == 0) { - return new String(pStrings, start, i - start); + return new string(pStrings, start, i - start); } index--; @@ -64,11 +64,11 @@ namespace System.Text } else { - return new String(pStrings); + return new string(pStrings); } } - public unsafe String WebName + public unsafe string WebName { get { @@ -88,7 +88,7 @@ namespace System.Text } } - public unsafe String HeaderName + public unsafe string HeaderName { get { @@ -100,7 +100,7 @@ namespace System.Text } } - public unsafe String BodyName + public unsafe string BodyName { get { diff --git a/src/System.Private.CoreLib/src/System/Text/EncodingTable.cs b/src/System.Private.CoreLib/src/System/Text/EncodingTable.cs index 6925be2200..c1795ed5b0 100644 --- a/src/System.Private.CoreLib/src/System/Text/EncodingTable.cs +++ b/src/System.Private.CoreLib/src/System/Text/EncodingTable.cs @@ -51,7 +51,7 @@ namespace System.Text // Find the data item by binary searching the table that we have in native. // nativeCompareOrdinalWC is an internal-only function. - private static unsafe int internalGetCodePageFromName(String name) + private static unsafe int internalGetCodePageFromName(string name) { int left = 0; int right = lastEncodingItem; @@ -133,14 +133,14 @@ namespace System.Text ** internalGetCodePageFromName will throw ArgumentException if name is not a valid encoding name. ============================================================================*/ - internal static int GetCodePageFromName(String name) + internal static int GetCodePageFromName(string name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } - Object codePageObj; + object codePageObj; // // The name is case-insensitive, but ToLower isn't free. Check for @@ -217,7 +217,7 @@ namespace System.Text //This will not work in case-insensitive mode for any character greater than 0x7F. //We'll throw an ArgumentException. [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern unsafe int nativeCompareOrdinalIgnoreCaseWC(String strA, sbyte* strBBytes); + private static extern unsafe int nativeCompareOrdinalIgnoreCaseWC(string strA, sbyte* strBBytes); } /*=================================InternalEncodingDataItem========================== @@ -231,7 +231,7 @@ namespace System.Text internal unsafe struct InternalEncodingDataItem { internal sbyte* webName; - internal UInt16 codePage; + internal ushort codePage; } /*=================================InternalCodePageDataItem========================== @@ -242,8 +242,8 @@ namespace System.Text [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)] internal unsafe struct InternalCodePageDataItem { - internal UInt16 codePage; - internal UInt16 uiFamilyCodePage; + internal ushort codePage; + internal ushort uiFamilyCodePage; internal uint flags; internal sbyte* Names; } diff --git a/src/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs b/src/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs index 7eb1a3026a..d3c8113480 100644 --- a/src/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs +++ b/src/System.Private.CoreLib/src/System/Threading/CancellationTokenSource.cs @@ -147,7 +147,7 @@ namespace System.Threading /// </summary> /// <param name="delay">The time span to wait before canceling this <see cref="CancellationTokenSource"/></param> /// <exception cref="ArgumentOutOfRangeException"> - /// The exception that is thrown when <paramref name="delay"/> is less than -1 or greater than Int32.MaxValue. + /// The exception that is thrown when <paramref name="delay"/> is less than -1 or greater than int.MaxValue. /// </exception> /// <remarks> /// <para> @@ -268,7 +268,7 @@ namespace System.Threading /// </exception> /// <exception cref="ArgumentOutOfRangeException"> /// The exception thrown when <paramref name="delay"/> is less than -1 or - /// greater than Int32.MaxValue. + /// greater than int.MaxValue. /// </exception> /// <remarks> /// <para> diff --git a/src/System.Private.CoreLib/src/System/Threading/Interlocked.cs b/src/System.Private.CoreLib/src/System/Threading/Interlocked.cs index 898b0b1823..c4fc750a5c 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Interlocked.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Interlocked.cs @@ -70,7 +70,7 @@ namespace System.Threading public static extern double Exchange(ref double location1, double value); [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern Object Exchange(ref Object location1, Object value); + public static extern object Exchange(ref object location1, object value); [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern IntPtr Exchange(ref IntPtr location1, IntPtr value); @@ -106,7 +106,7 @@ namespace System.Threading public static extern double CompareExchange(ref double location1, double value, double comparand); [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern Object CompareExchange(ref Object location1, Object value, Object comparand); + public static extern object CompareExchange(ref object location1, object value, object comparand); [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern IntPtr CompareExchange(ref IntPtr location1, IntPtr value, IntPtr comparand); diff --git a/src/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs b/src/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs index 297afa1f9c..43cb176fbb 100644 --- a/src/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs +++ b/src/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs @@ -52,7 +52,7 @@ namespace System.Threading // -- State -- // //For a packed word a uint would seem better, but Interlocked.* doesn't support them as uint isn't CLS-compliant. - private volatile int m_combinedState; //ie a UInt32. Used for the state items listed below. + private volatile int m_combinedState; //ie a uint. Used for the state items listed below. //1-bit for signalled state private const int SignalledState_BitMask = unchecked((int)0x80000000);//1000 0000 0000 0000 0000 0000 0000 0000 @@ -438,7 +438,7 @@ namespace System.Threading /// false.</returns> /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative /// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater - /// than <see cref="System.Int32.MaxValue"/>.</exception> + /// than <see cref="System.int.MaxValue"/>.</exception> /// <exception cref="T:System.InvalidOperationException"> /// The maximum number of waiters has been exceeded. /// </exception> @@ -467,7 +467,7 @@ namespace System.Threading /// false.</returns> /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative /// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater - /// than <see cref="System.Int32.MaxValue"/>.</exception> + /// than <see cref="System.int.MaxValue"/>.</exception> /// <exception cref="T:System.Threading.OperationCanceledException"><paramref /// name="cancellationToken"/> was canceled.</exception> /// <exception cref="T:System.InvalidOperationException"> @@ -654,7 +654,7 @@ namespace System.Threading /// <param name="disposing">true to release both managed and unmanaged resources; /// false to release only unmanaged resources.</param> /// <remarks> - /// Unlike most of the members of <see cref="ManualResetEventSlim"/>, <see cref="Dispose(Boolean)"/> is not + /// Unlike most of the members of <see cref="ManualResetEventSlim"/>, <see cref="Dispose(bool)"/> is not /// thread-safe and may not be used concurrently with other members of this instance. /// </remarks> protected virtual void Dispose(bool disposing) diff --git a/src/System.Private.CoreLib/src/System/Threading/Monitor.cs b/src/System.Private.CoreLib/src/System/Threading/Monitor.cs index be7bded199..2837d908c6 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Monitor.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Monitor.cs @@ -36,7 +36,7 @@ namespace System.Threading ** Exceptions: ArgumentNullException if object is null. =========================================================================*/ [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern void Enter(Object obj); + public static extern void Enter(object obj); // Use a ref bool instead of out to ensure that unverifiable code must @@ -44,7 +44,7 @@ namespace System.Threading // could be uninitialized if we threw an exception in our prolog. // The JIT should inline this method to allow check of lockTaken argument to be optimized out // in the typical case. Note that the method has to be transparent for inlining to be allowed by the VM. - public static void Enter(Object obj, ref bool lockTaken) + public static void Enter(object obj, ref bool lockTaken) { if (lockTaken) ThrowLockTakenException(); @@ -59,7 +59,7 @@ namespace System.Threading } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void ReliableEnter(Object obj, ref bool lockTaken); + private static extern void ReliableEnter(object obj, ref bool lockTaken); @@ -73,7 +73,7 @@ namespace System.Threading ** own the lock. =========================================================================*/ [MethodImplAttribute(MethodImplOptions.InternalCall)] - public static extern void Exit(Object obj); + public static extern void Exit(object obj); /*========================================================================= ** Similar to Enter, but will never block. That is, if the current thread can @@ -82,7 +82,7 @@ namespace System.Threading ** ** Exceptions: ArgumentNullException if object is null. =========================================================================*/ - public static bool TryEnter(Object obj) + public static bool TryEnter(object obj) { bool lockTaken = false; TryEnter(obj, 0, ref lockTaken); @@ -91,7 +91,7 @@ namespace System.Threading // The JIT should inline this method to allow check of lockTaken argument to be optimized out // in the typical case. Note that the method has to be transparent for inlining to be allowed by the VM. - public static void TryEnter(Object obj, ref bool lockTaken) + public static void TryEnter(object obj, ref bool lockTaken) { if (lockTaken) ThrowLockTakenException(); @@ -109,7 +109,7 @@ namespace System.Threading =========================================================================*/ // The JIT should inline this method to allow check of lockTaken argument to be optimized out // in the typical case. Note that the method has to be transparent for inlining to be allowed by the VM. - public static bool TryEnter(Object obj, int millisecondsTimeout) + public static bool TryEnter(object obj, int millisecondsTimeout) { bool lockTaken = false; TryEnter(obj, millisecondsTimeout, ref lockTaken); @@ -119,19 +119,19 @@ namespace System.Threading private static int MillisecondsTimeoutFromTimeSpan(TimeSpan timeout) { long tm = (long)timeout.TotalMilliseconds; - if (tm < -1 || tm > (long)Int32.MaxValue) + if (tm < -1 || tm > (long)int.MaxValue) throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); return (int)tm; } - public static bool TryEnter(Object obj, TimeSpan timeout) + public static bool TryEnter(object obj, TimeSpan timeout) { return TryEnter(obj, MillisecondsTimeoutFromTimeSpan(timeout)); } // The JIT should inline this method to allow check of lockTaken argument to be optimized out // in the typical case. Note that the method has to be transparent for inlining to be allowed by the VM. - public static void TryEnter(Object obj, int millisecondsTimeout, ref bool lockTaken) + public static void TryEnter(object obj, int millisecondsTimeout, ref bool lockTaken) { if (lockTaken) ThrowLockTakenException(); @@ -139,7 +139,7 @@ namespace System.Threading ReliableEnterTimeout(obj, millisecondsTimeout, ref lockTaken); } - public static void TryEnter(Object obj, TimeSpan timeout, ref bool lockTaken) + public static void TryEnter(object obj, TimeSpan timeout, ref bool lockTaken) { if (lockTaken) ThrowLockTakenException(); @@ -148,7 +148,7 @@ namespace System.Threading } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void ReliableEnterTimeout(Object obj, int timeout, ref bool lockTaken); + private static extern void ReliableEnterTimeout(object obj, int timeout, ref bool lockTaken); public static bool IsEntered(object obj) { @@ -159,7 +159,7 @@ namespace System.Threading } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern bool IsEnteredNative(Object obj); + private static extern bool IsEnteredNative(object obj); /*======================================================================== ** Waits for notification from the object (via a Pulse/PulseAll). @@ -173,31 +173,31 @@ namespace System.Threading ** Exceptions: ArgumentNullException if object is null. ========================================================================*/ [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern bool ObjWait(bool exitContext, int millisecondsTimeout, Object obj); + private static extern bool ObjWait(bool exitContext, int millisecondsTimeout, object obj); - public static bool Wait(Object obj, int millisecondsTimeout, bool exitContext) + public static bool Wait(object obj, int millisecondsTimeout, bool exitContext) { if (obj == null) throw (new ArgumentNullException(nameof(obj))); return ObjWait(exitContext, millisecondsTimeout, obj); } - public static bool Wait(Object obj, TimeSpan timeout, bool exitContext) + public static bool Wait(object obj, TimeSpan timeout, bool exitContext) { return Wait(obj, MillisecondsTimeoutFromTimeSpan(timeout), exitContext); } - public static bool Wait(Object obj, int millisecondsTimeout) + public static bool Wait(object obj, int millisecondsTimeout) { return Wait(obj, millisecondsTimeout, false); } - public static bool Wait(Object obj, TimeSpan timeout) + public static bool Wait(object obj, TimeSpan timeout) { return Wait(obj, MillisecondsTimeoutFromTimeSpan(timeout), false); } - public static bool Wait(Object obj) + public static bool Wait(object obj) { return Wait(obj, Timeout.Infinite, false); } @@ -208,9 +208,9 @@ namespace System.Threading * a synchronized block of code. ========================================================================*/ [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void ObjPulse(Object obj); + private static extern void ObjPulse(object obj); - public static void Pulse(Object obj) + public static void Pulse(object obj) { if (obj == null) { @@ -223,9 +223,9 @@ namespace System.Threading ** Sends a notification to all waiting objects. ========================================================================*/ [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern void ObjPulseAll(Object obj); + private static extern void ObjPulseAll(object obj); - public static void PulseAll(Object obj) + public static void PulseAll(object obj) { if (obj == null) { diff --git a/src/System.Private.CoreLib/src/System/Threading/Overlapped.cs b/src/System.Private.CoreLib/src/System/Threading/Overlapped.cs index 12c0145d4b..d43c78d8f7 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Overlapped.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Overlapped.cs @@ -104,7 +104,7 @@ namespace System.Threading internal ref int OffsetHigh => ref (_pNativeOverlapped != null) ? ref _pNativeOverlapped->OffsetHigh : ref _offsetHigh; internal ref IntPtr EventHandle => ref (_pNativeOverlapped != null) ? ref _pNativeOverlapped->EventHandle : ref _eventHandle; - internal unsafe NativeOverlapped* Pack(IOCompletionCallback iocb, Object userData) + internal unsafe NativeOverlapped* Pack(IOCompletionCallback iocb, object userData) { if (_pNativeOverlapped != null) { @@ -124,7 +124,7 @@ namespace System.Threading return AllocateNativeOverlapped(); } - internal unsafe NativeOverlapped* UnsafePack(IOCompletionCallback iocb, Object userData) + internal unsafe NativeOverlapped* UnsafePack(IOCompletionCallback iocb, object userData) { if (_pNativeOverlapped != null) { diff --git a/src/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs b/src/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs index ac57e9e499..9001fcd499 100644 --- a/src/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs +++ b/src/System.Private.CoreLib/src/System/Threading/SemaphoreSlim.cs @@ -84,7 +84,7 @@ namespace System.Threading new Task<bool>(false, false, (TaskCreationOptions)InternalTaskOptions.DoNotDispose, default); // No maximum constant - private const int NO_MAXIMUM = Int32.MaxValue; + private const int NO_MAXIMUM = int.MaxValue; // Task in a linked list of asynchronous waiters private sealed class TaskNode : Task<bool>, IThreadPoolWorkItem @@ -238,12 +238,12 @@ namespace System.Threading /// otherwise, false.</returns> /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative /// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater - /// than <see cref="System.Int32.MaxValue"/>.</exception> + /// than <see cref="System.int.MaxValue"/>.</exception> public bool Wait(TimeSpan timeout) { // Validate the timeout - Int64 totalMilliseconds = (Int64)timeout.TotalMilliseconds; - if (totalMilliseconds < -1 || totalMilliseconds > Int32.MaxValue) + long totalMilliseconds = (long)timeout.TotalMilliseconds; + if (totalMilliseconds < -1 || totalMilliseconds > int.MaxValue) { throw new System.ArgumentOutOfRangeException( nameof(timeout), timeout, SR.SemaphoreSlim_Wait_TimeoutWrong); @@ -267,13 +267,13 @@ namespace System.Threading /// otherwise, false.</returns> /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative /// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater - /// than <see cref="System.Int32.MaxValue"/>.</exception> + /// than <see cref="System.int.MaxValue"/>.</exception> /// <exception cref="System.OperationCanceledException"><paramref name="cancellationToken"/> was canceled.</exception> public bool Wait(TimeSpan timeout, CancellationToken cancellationToken) { // Validate the timeout - Int64 totalMilliseconds = (Int64)timeout.TotalMilliseconds; - if (totalMilliseconds < -1 || totalMilliseconds > Int32.MaxValue) + long totalMilliseconds = (long)timeout.TotalMilliseconds; + if (totalMilliseconds < -1 || totalMilliseconds > int.MaxValue) { throw new System.ArgumentOutOfRangeException( nameof(timeout), timeout, SR.SemaphoreSlim_Wait_TimeoutWrong); @@ -578,7 +578,7 @@ namespace System.Threading /// </exception> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="timeout"/> is a negative number other than -1 milliseconds, which represents - /// an infinite time-out -or- timeout is greater than <see cref="System.Int32.MaxValue"/>. + /// an infinite time-out -or- timeout is greater than <see cref="System.int.MaxValue"/>. /// </exception> public Task<bool> WaitAsync(TimeSpan timeout) { @@ -599,13 +599,13 @@ namespace System.Threading /// </returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="timeout"/> is a negative number other than -1 milliseconds, which represents - /// an infinite time-out -or- timeout is greater than <see cref="System.Int32.MaxValue"/>. + /// an infinite time-out -or- timeout is greater than <see cref="System.int.MaxValue"/>. /// </exception> public Task<bool> WaitAsync(TimeSpan timeout, CancellationToken cancellationToken) { // Validate the timeout - Int64 totalMilliseconds = (Int64)timeout.TotalMilliseconds; - if (totalMilliseconds < -1 || totalMilliseconds > Int32.MaxValue) + long totalMilliseconds = (long)timeout.TotalMilliseconds; + if (totalMilliseconds < -1 || totalMilliseconds > int.MaxValue) { throw new System.ArgumentOutOfRangeException( nameof(timeout), timeout, SR.SemaphoreSlim_Wait_TimeoutWrong); @@ -911,7 +911,7 @@ namespace System.Threading /// <param name="disposing">true to release both managed and unmanaged resources; /// false to release only unmanaged resources.</param> /// <remarks> - /// Unlike most of the members of <see cref="SemaphoreSlim"/>, <see cref="Dispose(Boolean)"/> is not + /// Unlike most of the members of <see cref="SemaphoreSlim"/>, <see cref="Dispose(bool)"/> is not /// thread-safe and may not be used concurrently with other members of this instance. /// </remarks> protected virtual void Dispose(bool disposing) diff --git a/src/System.Private.CoreLib/src/System/Threading/SpinLock.cs b/src/System.Private.CoreLib/src/System/Threading/SpinLock.cs index 7e58a6cf89..bafe63f27e 100644 --- a/src/System.Private.CoreLib/src/System/Threading/SpinLock.cs +++ b/src/System.Private.CoreLib/src/System/Threading/SpinLock.cs @@ -219,12 +219,12 @@ namespace System.Threading /// </exception> /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative /// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater - /// than <see cref="System.Int32.MaxValue"/> milliseconds. + /// than <see cref="System.int.MaxValue"/> milliseconds. /// </exception> public void TryEnter(TimeSpan timeout, ref bool lockTaken) { // Validate the timeout - Int64 totalMilliseconds = (Int64)timeout.TotalMilliseconds; + long totalMilliseconds = (long)timeout.TotalMilliseconds; if (totalMilliseconds < -1 || totalMilliseconds > int.MaxValue) { throw new System.ArgumentOutOfRangeException( @@ -454,7 +454,7 @@ namespace System.Threading /// </summary> /// <remarks> /// The default overload of <see cref="Exit()"/> provides the same behavior as if calling <see - /// cref="Exit(Boolean)"/> using true as the argument, but Exit() could be slightly faster than Exit(true). + /// cref="Exit(bool)"/> using true as the argument, but Exit() could be slightly faster than Exit(true). /// </remarks> /// <exception cref="SynchronizationLockException"> /// Thread ownership tracking is enabled, and the current thread is not the owner of this lock. @@ -476,7 +476,7 @@ namespace System.Threading /// publish the exit operation to other threads. /// </param> /// <remarks> - /// Calling <see cref="Exit(Boolean)"/> with the <paramref name="useMemoryBarrier"/> argument set to + /// Calling <see cref="Exit(bool)"/> with the <paramref name="useMemoryBarrier"/> argument set to /// true will improve the fairness of the lock at the expense of some performance. The default <see /// cref="Enter"/> /// overload behaves as if specifying true for <paramref name="useMemoryBarrier"/>. diff --git a/src/System.Private.CoreLib/src/System/Threading/SynchronizationContext.cs b/src/System.Private.CoreLib/src/System/Threading/SynchronizationContext.cs index c7c588635b..7b7d06c10d 100644 --- a/src/System.Private.CoreLib/src/System/Threading/SynchronizationContext.cs +++ b/src/System.Private.CoreLib/src/System/Threading/SynchronizationContext.cs @@ -90,12 +90,12 @@ namespace System.Threading } - public virtual void Send(SendOrPostCallback d, Object state) + public virtual void Send(SendOrPostCallback d, object state) { d(state); } - public virtual void Post(SendOrPostCallback d, Object state) + public virtual void Post(SendOrPostCallback d, object state) { ThreadPool.QueueUserWorkItem(s => s.d(s.state), (d, state), preferLocal: false); } diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/AsyncCausalityTracer.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/AsyncCausalityTracer.cs index be1426ea33..3acb1a01d7 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/AsyncCausalityTracer.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/AsyncCausalityTracer.cs @@ -135,7 +135,7 @@ namespace System.Threading.Tasks //COM Interface GUID {50850B26-267E-451B-A890-AB6A370245EE} Guid guid = new Guid(0x50850B26, 0x267E, 0x451B, 0xA8, 0x90, 0XAB, 0x6A, 0x37, 0x02, 0x45, 0xEE); - Object factory = null; + object factory = null; try { @@ -157,7 +157,7 @@ namespace System.Threading.Tasks } } - private static void TracingStatusChangedHandler(Object sender, WFD.TracingStatusChangedEventArgs args) + private static void TracingStatusChangedHandler(object sender, WFD.TracingStatusChangedEventArgs args) { if (args.Enabled) f_LoggingOn |= Loggers.CausalityTracer; diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs index 1eaa85a079..378f1e00a3 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs @@ -396,7 +396,7 @@ namespace System.Threading.Tasks /// However, unless creation and scheduling must be separated, StartNew is the recommended approach /// for both simplicity and performance. /// </remarks> - public Task<TResult> StartNew(Func<Object, TResult> function, Object state) + public Task<TResult> StartNew(Func<object, TResult> function, object state) { Task currTask = Task.InternalCurrent; return Task<TResult>.StartNew(currTask, function, state, m_defaultCancellationToken, @@ -425,7 +425,7 @@ namespace System.Threading.Tasks /// However, unless creation and scheduling must be separated, StartNew is the recommended approach /// for both simplicity and performance. /// </remarks> - public Task<TResult> StartNew(Func<Object, TResult> function, Object state, CancellationToken cancellationToken) + public Task<TResult> StartNew(Func<object, TResult> function, object state, CancellationToken cancellationToken) { Task currTask = Task.InternalCurrent; return Task<TResult>.StartNew(currTask, function, state, cancellationToken, @@ -456,7 +456,7 @@ namespace System.Threading.Tasks /// However, unless creation and scheduling must be separated, StartNew is the recommended approach /// for both simplicity and performance. /// </remarks> - public Task<TResult> StartNew(Func<Object, TResult> function, Object state, TaskCreationOptions creationOptions) + public Task<TResult> StartNew(Func<object, TResult> function, object state, TaskCreationOptions creationOptions) { Task currTask = Task.InternalCurrent; return Task<TResult>.StartNew(currTask, function, state, m_defaultCancellationToken, @@ -498,7 +498,7 @@ namespace System.Threading.Tasks /// However, unless creation and scheduling must be separated, StartNew is the recommended approach /// for both simplicity and performance. /// </remarks> - public Task<TResult> StartNew(Func<Object, TResult> function, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler) + public Task<TResult> StartNew(Func<object, TResult> function, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler) { return Task<TResult>.StartNew(Task.InternalCurrentIfAttached(creationOptions), function, state, cancellationToken, creationOptions, InternalTaskOptions.None, scheduler); diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/ProducerConsumerQueues.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/ProducerConsumerQueues.cs index 13347ec9fb..bd715958cd 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/ProducerConsumerQueues.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/ProducerConsumerQueues.cs @@ -119,7 +119,7 @@ namespace System.Threading.Tasks /// <summary>The initial size to use for segments (in number of elements).</summary> private const int INIT_SEGMENT_SIZE = 32; // must be a power of 2 /// <summary>The maximum size to use for segments (in number of elements).</summary> - private const int MAX_SEGMENT_SIZE = 0x1000000; // this could be made as large as Int32.MaxValue / 2 + private const int MAX_SEGMENT_SIZE = 0x1000000; // this could be made as large as int.MaxValue / 2 /// <summary>The head of the linked list of segments.</summary> private volatile Segment m_head; @@ -133,7 +133,7 @@ namespace System.Threading.Tasks Debug.Assert(INIT_SEGMENT_SIZE > 0, "Initial segment size must be > 0."); Debug.Assert((INIT_SEGMENT_SIZE & (INIT_SEGMENT_SIZE - 1)) == 0, "Initial segment size must be a power of 2"); Debug.Assert(INIT_SEGMENT_SIZE <= MAX_SEGMENT_SIZE, "Initial segment size should be <= maximum."); - Debug.Assert(MAX_SEGMENT_SIZE < Int32.MaxValue / 2, "Max segment size * 2 must be < Int32.MaxValue, or else overflow could occur."); + Debug.Assert(MAX_SEGMENT_SIZE < int.MaxValue / 2, "Max segment size * 2 must be < int.MaxValue, or else overflow could occur."); // Initialize the queue m_head = m_tail = new Segment(INIT_SEGMENT_SIZE); diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/TPLETWProvider.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/TPLETWProvider.cs index 14d5fe88c4..9981020850 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/TPLETWProvider.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/TPLETWProvider.cs @@ -293,7 +293,7 @@ namespace System.Threading.Tasks unsafe { EventData* eventPayload = stackalloc EventData[4]; - Int32 isExceptionalInt = IsExceptional ? 1 : 0; + int isExceptionalInt = IsExceptional ? 1 : 0; eventPayload[0].Size = sizeof(int); eventPayload[0].DataPointer = ((IntPtr)(&OriginatingTaskSchedulerID)); eventPayload[0].Reserved = 0; diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs index 8179a7f5de..eb0227014f 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @@ -205,7 +205,7 @@ namespace System.Threading.Tasks // This dictonary relates the task id, from an operation id located in the Async Causality log to the actual // task. This is to be used by the debugger ONLY. Task in this dictionary represent current active tasks. private static readonly Dictionary<int, Task> s_currentActiveTasks = new Dictionary<int, Task>(); - private static readonly Object s_activeTasksLock = new Object(); + private static readonly object s_activeTasksLock = new object(); // These methods are a way to access the dictionary both from this class and for other classes that also // activate dummy tasks. Specifically the AsyncTaskMethodBuilder and AsyncTaskMethodBuilder<> @@ -665,8 +665,8 @@ namespace System.Threading.Tasks // Static delegate to be used as a cancellation callback on unstarted tasks that have a valid cancellation token. // This is necessary to transition them into canceled state if their cancellation token is signalled while they are still not queued - private readonly static Action<Object> s_taskCancelCallback = new Action<Object>(TaskCancelCallback); - private static void TaskCancelCallback(Object o) + private readonly static Action<object> s_taskCancelCallback = new Action<object>(TaskCancelCallback); + private static void TaskCancelCallback(object o) { var targetTask = o as Task; if (targetTask == null) @@ -2718,12 +2718,12 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="timeout"/> is a negative number other than -1 milliseconds, which represents an /// infinite time-out -or- timeout is greater than - /// <see cref="System.Int32.MaxValue"/>. + /// <see cref="System.int.MaxValue"/>. /// </exception> public bool Wait(TimeSpan timeout) { long totalMilliseconds = (long)timeout.TotalMilliseconds; - if (totalMilliseconds < -1 || totalMilliseconds > Int32.MaxValue) + if (totalMilliseconds < -1 || totalMilliseconds > int.MaxValue) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.timeout); } @@ -3582,7 +3582,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ArgumentNullException"> /// The <paramref name="continuationAction"/> argument is null. /// </exception> - public Task ContinueWith(Action<Task, Object> continuationAction, Object state) + public Task ContinueWith(Action<Task, object> continuationAction, object state) { return ContinueWith(continuationAction, state, TaskScheduler.Current, default, TaskContinuationOptions.None); } @@ -3608,7 +3608,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ObjectDisposedException">The provided <see cref="System.Threading.CancellationToken">CancellationToken</see> /// has already been disposed. /// </exception> - public Task ContinueWith(Action<Task, Object> continuationAction, Object state, CancellationToken cancellationToken) + public Task ContinueWith(Action<Task, object> continuationAction, object state, CancellationToken cancellationToken) { return ContinueWith(continuationAction, state, TaskScheduler.Current, cancellationToken, TaskContinuationOptions.None); } @@ -3636,7 +3636,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ArgumentNullException"> /// The <paramref name="scheduler"/> argument is null. /// </exception> - public Task ContinueWith(Action<Task, Object> continuationAction, Object state, TaskScheduler scheduler) + public Task ContinueWith(Action<Task, object> continuationAction, object state, TaskScheduler scheduler) { return ContinueWith(continuationAction, state, scheduler, default, TaskContinuationOptions.None); } @@ -3670,7 +3670,7 @@ namespace System.Threading.Tasks /// The <paramref name="continuationOptions"/> argument specifies an invalid value for <see /// cref="T:System.Threading.Tasks.TaskContinuationOptions">TaskContinuationOptions</see>. /// </exception> - public Task ContinueWith(Action<Task, Object> continuationAction, Object state, TaskContinuationOptions continuationOptions) + public Task ContinueWith(Action<Task, object> continuationAction, object state, TaskContinuationOptions continuationOptions) { return ContinueWith(continuationAction, state, TaskScheduler.Current, default, continuationOptions); } @@ -3714,14 +3714,14 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ObjectDisposedException">The provided <see cref="System.Threading.CancellationToken">CancellationToken</see> /// has already been disposed. /// </exception> - public Task ContinueWith(Action<Task, Object> continuationAction, Object state, CancellationToken cancellationToken, + public Task ContinueWith(Action<Task, object> continuationAction, object state, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler) { return ContinueWith(continuationAction, state, scheduler, cancellationToken, continuationOptions); } // Same as the above overload, just with a stack mark parameter. - private Task ContinueWith(Action<Task, Object> continuationAction, Object state, TaskScheduler scheduler, + private Task ContinueWith(Action<Task, object> continuationAction, object state, TaskScheduler scheduler, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions) { // Throw on continuation with null action @@ -3978,7 +3978,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ArgumentNullException"> /// The <paramref name="continuationFunction"/> argument is null. /// </exception> - public Task<TResult> ContinueWith<TResult>(Func<Task, Object, TResult> continuationFunction, Object state) + public Task<TResult> ContinueWith<TResult>(Func<Task, object, TResult> continuationFunction, object state) { return ContinueWith<TResult>(continuationFunction, state, TaskScheduler.Current, default, TaskContinuationOptions.None); @@ -4009,7 +4009,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ObjectDisposedException">The provided <see cref="System.Threading.CancellationToken">CancellationToken</see> /// has already been disposed. /// </exception> - public Task<TResult> ContinueWith<TResult>(Func<Task, Object, TResult> continuationFunction, Object state, CancellationToken cancellationToken) + public Task<TResult> ContinueWith<TResult>(Func<Task, object, TResult> continuationFunction, object state, CancellationToken cancellationToken) { return ContinueWith<TResult>(continuationFunction, state, TaskScheduler.Current, cancellationToken, TaskContinuationOptions.None); } @@ -4040,7 +4040,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ArgumentNullException"> /// The <paramref name="scheduler"/> argument is null. /// </exception> - public Task<TResult> ContinueWith<TResult>(Func<Task, Object, TResult> continuationFunction, Object state, TaskScheduler scheduler) + public Task<TResult> ContinueWith<TResult>(Func<Task, object, TResult> continuationFunction, object state, TaskScheduler scheduler) { return ContinueWith<TResult>(continuationFunction, state, scheduler, default, TaskContinuationOptions.None); } @@ -4077,7 +4077,7 @@ namespace System.Threading.Tasks /// The <paramref name="continuationOptions"/> argument specifies an invalid value for <see /// cref="T:System.Threading.Tasks.TaskContinuationOptions">TaskContinuationOptions</see>. /// </exception> - public Task<TResult> ContinueWith<TResult>(Func<Task, Object, TResult> continuationFunction, Object state, TaskContinuationOptions continuationOptions) + public Task<TResult> ContinueWith<TResult>(Func<Task, object, TResult> continuationFunction, object state, TaskContinuationOptions continuationOptions) { return ContinueWith<TResult>(continuationFunction, state, TaskScheduler.Current, default, continuationOptions); } @@ -4124,14 +4124,14 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ObjectDisposedException">The provided <see cref="System.Threading.CancellationToken">CancellationToken</see> /// has already been disposed. /// </exception> - public Task<TResult> ContinueWith<TResult>(Func<Task, Object, TResult> continuationFunction, Object state, CancellationToken cancellationToken, + public Task<TResult> ContinueWith<TResult>(Func<Task, object, TResult> continuationFunction, object state, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler) { return ContinueWith<TResult>(continuationFunction, state, scheduler, cancellationToken, continuationOptions); } // Same as the above overload, just with a stack mark parameter. - private Task<TResult> ContinueWith<TResult>(Func<Task, Object, TResult> continuationFunction, Object state, TaskScheduler scheduler, + private Task<TResult> ContinueWith<TResult>(Func<Task, object, TResult> continuationFunction, object state, TaskScheduler scheduler, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions) { // Throw on continuation with null function @@ -4521,13 +4521,13 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="timeout"/> is a negative number other than -1 milliseconds, which represents an /// infinite time-out -or- timeout is greater than - /// <see cref="System.Int32.MaxValue"/>. + /// <see cref="System.int.MaxValue"/>. /// </exception> [MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger public static bool WaitAll(Task[] tasks, TimeSpan timeout) { long totalMilliseconds = (long)timeout.TotalMilliseconds; - if (totalMilliseconds < -1 || totalMilliseconds > Int32.MaxValue) + if (totalMilliseconds < -1 || totalMilliseconds > int.MaxValue) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.timeout); } @@ -4908,13 +4908,13 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="timeout"/> is a negative number other than -1 milliseconds, which represents an /// infinite time-out -or- timeout is greater than - /// <see cref="System.Int32.MaxValue"/>. + /// <see cref="System.int.MaxValue"/>. /// </exception> [MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger public static int WaitAny(Task[] tasks, TimeSpan timeout) { long totalMilliseconds = (long)timeout.TotalMilliseconds; - if (totalMilliseconds < -1 || totalMilliseconds > Int32.MaxValue) + if (totalMilliseconds < -1 || totalMilliseconds > int.MaxValue) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.timeout); } @@ -5316,7 +5316,7 @@ namespace System.Threading.Tasks /// <param name="delay">The time span to wait before completing the returned Task</param> /// <returns>A Task that represents the time delay</returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> - /// The <paramref name="delay"/> is less than -1 or greater than Int32.MaxValue. + /// The <paramref name="delay"/> is less than -1 or greater than int.MaxValue. /// </exception> /// <remarks> /// After the specified time delay, the Task is completed in RanToCompletion state. @@ -5333,7 +5333,7 @@ namespace System.Threading.Tasks /// <param name="cancellationToken">The cancellation token that will be checked prior to completing the returned Task</param> /// <returns>A Task that represents the time delay</returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> - /// The <paramref name="delay"/> is less than -1 or greater than Int32.MaxValue. + /// The <paramref name="delay"/> is less than -1 or greater than int.MaxValue. /// </exception> /// <exception cref="T:System.ObjectDisposedException"> /// The provided <paramref name="cancellationToken"/> has already been disposed. @@ -5346,7 +5346,7 @@ namespace System.Threading.Tasks public static Task Delay(TimeSpan delay, CancellationToken cancellationToken) { long totalMilliseconds = (long)delay.TotalMilliseconds; - if (totalMilliseconds < -1 || totalMilliseconds > Int32.MaxValue) + if (totalMilliseconds < -1 || totalMilliseconds > int.MaxValue) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.delay, ExceptionResource.Task_Delay_InvalidDelay); } diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskFactory.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskFactory.cs index 94c449d4ac..5ce41461da 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskFactory.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskFactory.cs @@ -396,7 +396,7 @@ namespace System.Threading.Tasks /// However, unless creation and scheduling must be separated, StartNew is the recommended approach /// for both simplicity and performance. /// </remarks> - public Task StartNew(Action<Object> action, Object state) + public Task StartNew(Action<object> action, object state) { Task currTask = Task.InternalCurrent; return Task.InternalStartNew(currTask, action, state, m_defaultCancellationToken, GetDefaultScheduler(currTask), @@ -425,7 +425,7 @@ namespace System.Threading.Tasks /// However, unless creation and scheduling must be separated, StartNew is the recommended approach /// for both simplicity and performance. /// </remarks> - public Task StartNew(Action<Object> action, Object state, CancellationToken cancellationToken) + public Task StartNew(Action<object> action, object state, CancellationToken cancellationToken) { Task currTask = Task.InternalCurrent; return Task.InternalStartNew(currTask, action, state, cancellationToken, GetDefaultScheduler(currTask), @@ -455,7 +455,7 @@ namespace System.Threading.Tasks /// However, unless creation and scheduling must be separated, StartNew is the recommended approach /// for both simplicity and performance. /// </remarks> - public Task StartNew(Action<Object> action, Object state, TaskCreationOptions creationOptions) + public Task StartNew(Action<object> action, object state, TaskCreationOptions creationOptions) { Task currTask = Task.InternalCurrent; return Task.InternalStartNew(currTask, action, state, m_defaultCancellationToken, GetDefaultScheduler(currTask), @@ -496,7 +496,7 @@ namespace System.Threading.Tasks /// However, unless creation and scheduling must be separated, StartNew is the recommended approach /// for both simplicity and performance. /// </remarks> - public Task StartNew(Action<Object> action, Object state, CancellationToken cancellationToken, + public Task StartNew(Action<object> action, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler) { return Task.InternalStartNew( @@ -657,7 +657,7 @@ namespace System.Threading.Tasks /// However, unless creation and scheduling must be separated, StartNew is the recommended approach /// for both simplicity and performance. /// </remarks> - public Task<TResult> StartNew<TResult>(Func<Object, TResult> function, Object state) + public Task<TResult> StartNew<TResult>(Func<object, TResult> function, object state) { Task currTask = Task.InternalCurrent; return Task<TResult>.StartNew(currTask, function, state, m_defaultCancellationToken, @@ -690,7 +690,7 @@ namespace System.Threading.Tasks /// However, unless creation and scheduling must be separated, StartNew is the recommended approach /// for both simplicity and performance. /// </remarks> - public Task<TResult> StartNew<TResult>(Func<Object, TResult> function, Object state, CancellationToken cancellationToken) + public Task<TResult> StartNew<TResult>(Func<object, TResult> function, object state, CancellationToken cancellationToken) { Task currTask = Task.InternalCurrent; return Task<TResult>.StartNew(currTask, function, state, cancellationToken, @@ -724,7 +724,7 @@ namespace System.Threading.Tasks /// However, unless creation and scheduling must be separated, StartNew is the recommended approach /// for both simplicity and performance. /// </remarks> - public Task<TResult> StartNew<TResult>(Func<Object, TResult> function, Object state, TaskCreationOptions creationOptions) + public Task<TResult> StartNew<TResult>(Func<object, TResult> function, object state, TaskCreationOptions creationOptions) { Task currTask = Task.InternalCurrent; return Task<TResult>.StartNew(currTask, function, state, m_defaultCancellationToken, @@ -769,7 +769,7 @@ namespace System.Threading.Tasks /// However, unless creation and scheduling must be separated, StartNew is the recommended approach /// for both simplicity and performance. /// </remarks> - public Task<TResult> StartNew<TResult>(Func<Object, TResult> function, Object state, CancellationToken cancellationToken, + public Task<TResult> StartNew<TResult>(Func<object, TResult> function, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler) { return Task<TResult>.StartNew( diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs index e1fda2530d..8c929eb1ea 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs @@ -155,11 +155,11 @@ namespace System.Threading.Tasks /// Indicates the maximum concurrency level this /// <see cref="TaskScheduler"/> is able to support. /// </summary> - public virtual Int32 MaximumConcurrencyLevel + public virtual int MaximumConcurrencyLevel { get { - return Int32.MaxValue; + return int.MaxValue; } } @@ -389,7 +389,7 @@ namespace System.Threading.Tasks /// <summary> /// Gets the unique ID for this <see cref="TaskScheduler"/>. /// </summary> - public Int32 Id + public int Id { get { @@ -598,7 +598,7 @@ namespace System.Threading.Tasks } // returns the scheduler�s Id - public Int32 Id + public int Id { get { return m_taskScheduler.Id; } } @@ -682,7 +682,7 @@ namespace System.Threading.Tasks /// By default it returns 1, because a <see cref="T:System.Threading.SynchronizationContext"/> based /// scheduler only supports execution on a single thread. /// </summary> - public override Int32 MaximumConcurrencyLevel + public override int MaximumConcurrencyLevel { get { diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/future.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/future.cs index 352572bd90..77e032fddb 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Tasks/future.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/future.cs @@ -850,7 +850,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ArgumentNullException"> /// The <paramref name="continuationAction"/> argument is null. /// </exception> - public Task ContinueWith(Action<Task<TResult>, Object> continuationAction, Object state) + public Task ContinueWith(Action<Task<TResult>, object> continuationAction, object state) { return ContinueWith(continuationAction, state, TaskScheduler.Current, default, TaskContinuationOptions.None); } @@ -877,7 +877,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ObjectDisposedException">The provided <see cref="System.Threading.CancellationToken">CancellationToken</see> /// has already been disposed. /// </exception> - public Task ContinueWith(Action<Task<TResult>, Object> continuationAction, Object state, CancellationToken cancellationToken) + public Task ContinueWith(Action<Task<TResult>, object> continuationAction, object state, CancellationToken cancellationToken) { return ContinueWith(continuationAction, state, TaskScheduler.Current, cancellationToken, TaskContinuationOptions.None); } @@ -906,7 +906,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ArgumentNullException"> /// The <paramref name="scheduler"/> argument is null. /// </exception> - public Task ContinueWith(Action<Task<TResult>, Object> continuationAction, Object state, TaskScheduler scheduler) + public Task ContinueWith(Action<Task<TResult>, object> continuationAction, object state, TaskScheduler scheduler) { return ContinueWith(continuationAction, state, scheduler, default, TaskContinuationOptions.None); } @@ -940,7 +940,7 @@ namespace System.Threading.Tasks /// The <paramref name="continuationOptions"/> argument specifies an invalid value for <see /// cref="T:System.Threading.Tasks.TaskContinuationOptions">TaskContinuationOptions</see>. /// </exception> - public Task ContinueWith(Action<Task<TResult>, Object> continuationAction, Object state, TaskContinuationOptions continuationOptions) + public Task ContinueWith(Action<Task<TResult>, object> continuationAction, object state, TaskContinuationOptions continuationOptions) { return ContinueWith(continuationAction, state, TaskScheduler.Current, default, continuationOptions); } @@ -984,14 +984,14 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ObjectDisposedException">The provided <see cref="System.Threading.CancellationToken">CancellationToken</see> /// has already been disposed. /// </exception> - public Task ContinueWith(Action<Task<TResult>, Object> continuationAction, Object state, CancellationToken cancellationToken, + public Task ContinueWith(Action<Task<TResult>, object> continuationAction, object state, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler) { return ContinueWith(continuationAction, state, scheduler, cancellationToken, continuationOptions); } // Same as the above overload, only with a stack mark. - internal Task ContinueWith(Action<Task<TResult>, Object> continuationAction, Object state, TaskScheduler scheduler, CancellationToken cancellationToken, + internal Task ContinueWith(Action<Task<TResult>, object> continuationAction, object state, TaskScheduler scheduler, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions) { if (continuationAction == null) @@ -1262,7 +1262,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ArgumentNullException"> /// The <paramref name="continuationFunction"/> argument is null. /// </exception> - public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, Object, TNewResult> continuationFunction, Object state) + public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, object, TNewResult> continuationFunction, object state) { return ContinueWith<TNewResult>(continuationFunction, state, TaskScheduler.Current, default, TaskContinuationOptions.None); } @@ -1292,7 +1292,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ObjectDisposedException">The provided <see cref="System.Threading.CancellationToken">CancellationToken</see> /// has already been disposed. /// </exception> - public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, Object, TNewResult> continuationFunction, Object state, + public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, object, TNewResult> continuationFunction, object state, CancellationToken cancellationToken) { return ContinueWith<TNewResult>(continuationFunction, state, TaskScheduler.Current, cancellationToken, TaskContinuationOptions.None); @@ -1324,7 +1324,7 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ArgumentNullException"> /// The <paramref name="scheduler"/> argument is null. /// </exception> - public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, Object, TNewResult> continuationFunction, Object state, + public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, object, TNewResult> continuationFunction, object state, TaskScheduler scheduler) { return ContinueWith<TNewResult>(continuationFunction, state, scheduler, default, TaskContinuationOptions.None); @@ -1368,7 +1368,7 @@ namespace System.Threading.Tasks /// The <paramref name="continuationOptions"/> argument specifies an invalid value for <see /// cref="T:System.Threading.Tasks.TaskContinuationOptions">TaskContinuationOptions</see>. /// </exception> - public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, Object, TNewResult> continuationFunction, Object state, + public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, object, TNewResult> continuationFunction, object state, TaskContinuationOptions continuationOptions) { return ContinueWith<TNewResult>(continuationFunction, state, TaskScheduler.Current, default, continuationOptions); @@ -1423,14 +1423,14 @@ namespace System.Threading.Tasks /// <exception cref="T:System.ObjectDisposedException">The provided <see cref="System.Threading.CancellationToken">CancellationToken</see> /// has already been disposed. /// </exception> - public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, Object, TNewResult> continuationFunction, Object state, + public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, object, TNewResult> continuationFunction, object state, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler) { return ContinueWith<TNewResult>(continuationFunction, state, scheduler, cancellationToken, continuationOptions); } // Same as the above overload, just with a stack mark. - internal Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, Object, TNewResult> continuationFunction, Object state, + internal Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, object, TNewResult> continuationFunction, object state, TaskScheduler scheduler, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions) { if (continuationFunction == null) diff --git a/src/System.Private.CoreLib/src/System/Threading/Thread.cs b/src/System.Private.CoreLib/src/System/Threading/Thread.cs index 14e6ecb167..0fea39c7ef 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Thread.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Thread.cs @@ -29,12 +29,12 @@ namespace System.Threading using System.Runtime.Versioning; using System.Diagnostics; - internal delegate Object InternalCrossContextDelegate(Object[] args); + internal delegate object InternalCrossContextDelegate(object[] args); internal class ThreadHelper { private Delegate _start; - private Object _startArg = null; + private object _startArg = null; private ExecutionContext _executionContext = null; internal ThreadHelper(Delegate start) { @@ -48,7 +48,7 @@ namespace System.Threading internal static ContextCallback _ccb = new ContextCallback(ThreadStart_Context); - private static void ThreadStart_Context(Object state) + private static void ThreadStart_Context(object state) { ThreadHelper t = (ThreadHelper)state; if (t._start is ThreadStart) @@ -68,7 +68,7 @@ namespace System.Threading ExecutionContext context = _executionContext; if (context != null) { - ExecutionContext.RunInternal(context, _ccb, (Object)this); + ExecutionContext.RunInternal(context, _ccb, (object)this); } else { @@ -82,7 +82,7 @@ namespace System.Threading ExecutionContext context = _executionContext; if (context != null) { - ExecutionContext.RunInternal(context, _ccb, (Object)this); + ExecutionContext.RunInternal(context, _ccb, (object)this); } else { @@ -111,10 +111,10 @@ namespace System.Threading private ExecutionContext m_ExecutionContext; // this call context follows the logical thread private SynchronizationContext m_SynchronizationContext; // On CoreCLR, this is maintained separately from ExecutionContext - private String m_Name; + private string m_Name; private Delegate m_Delegate; // Delegate - private Object m_ThreadStartArg; + private object m_ThreadStartArg; /*========================================================================= ** The base implementation of Thread is all native. The following fields @@ -307,7 +307,7 @@ namespace System.Threading public static void Sleep(TimeSpan timeout) { long tm = (long)timeout.TotalMilliseconds; - if (tm < -1 || tm > (long)Int32.MaxValue) + if (tm < -1 || tm > (long)int.MaxValue) throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); Sleep((int)tm); } @@ -503,7 +503,7 @@ namespace System.Threading // Retrieves the name of the thread. // - public new String Name + public new string Name { get { @@ -523,7 +523,7 @@ namespace System.Threading } [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] - private static extern void InformThreadNameChange(ThreadHandle t, String name, int len); + private static extern void InformThreadNameChange(ThreadHandle t, string name, int len); } // End of class Thread diff --git a/src/System.Private.CoreLib/src/System/Threading/ThreadPool.cs b/src/System.Private.CoreLib/src/System/Threading/ThreadPool.cs index ad70726cbe..490c805729 100644 --- a/src/System.Private.CoreLib/src/System/Threading/ThreadPool.cs +++ b/src/System.Private.CoreLib/src/System/Threading/ThreadPool.cs @@ -864,9 +864,9 @@ namespace System.Threading } } - public delegate void WaitCallback(Object state); + public delegate void WaitCallback(object state); - public delegate void WaitOrTimerCallback(Object state, bool timedOut); // signaled or timed out + public delegate void WaitOrTimerCallback(object state, bool timedOut); // signaled or timed out // // This type is necessary because VS 2010's debugger looks for a method named _ThreadPoolWaitCallbacck.PerformWaitCallback @@ -1068,11 +1068,11 @@ namespace System.Threading { private WaitOrTimerCallback _waitOrTimerCallback; private ExecutionContext _executionContext; - private Object _state; + private object _state; private static readonly ContextCallback _ccbt = new ContextCallback(WaitOrTimerCallback_Context_t); private static readonly ContextCallback _ccbf = new ContextCallback(WaitOrTimerCallback_Context_f); - internal _ThreadPoolWaitOrTimerCallback(WaitOrTimerCallback waitOrTimerCallback, Object state, bool compressStack) + internal _ThreadPoolWaitOrTimerCallback(WaitOrTimerCallback waitOrTimerCallback, object state, bool compressStack) { _waitOrTimerCallback = waitOrTimerCallback; _state = state; @@ -1084,20 +1084,20 @@ namespace System.Threading } } - private static void WaitOrTimerCallback_Context_t(Object state) => + private static void WaitOrTimerCallback_Context_t(object state) => WaitOrTimerCallback_Context(state, timedOut: true); - private static void WaitOrTimerCallback_Context_f(Object state) => + private static void WaitOrTimerCallback_Context_f(object state) => WaitOrTimerCallback_Context(state, timedOut: false); - private static void WaitOrTimerCallback_Context(Object state, bool timedOut) + private static void WaitOrTimerCallback_Context(object state, bool timedOut) { _ThreadPoolWaitOrTimerCallback helper = (_ThreadPoolWaitOrTimerCallback)state; helper._waitOrTimerCallback(helper._state, timedOut); } // call back helper - internal static void PerformWaitOrTimerCallback(Object state, bool timedOut) + internal static void PerformWaitOrTimerCallback(object state, bool timedOut) { _ThreadPoolWaitOrTimerCallback helper = (_ThreadPoolWaitOrTimerCallback)state; Debug.Assert(helper != null, "Null state passed to PerformWaitOrTimerCallback!"); @@ -1152,7 +1152,7 @@ namespace System.Threading public static RegisteredWaitHandle RegisterWaitForSingleObject( // throws RegisterWaitException WaitHandle waitObject, WaitOrTimerCallback callBack, - Object state, + object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce // NOTE: we do not allow other options that allow the callback to be queued as an APC ) @@ -1164,7 +1164,7 @@ namespace System.Threading public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( // throws RegisterWaitException WaitHandle waitObject, WaitOrTimerCallback callBack, - Object state, + object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce // NOTE: we do not allow other options that allow the callback to be queued as an APC ) @@ -1176,7 +1176,7 @@ namespace System.Threading private static RegisteredWaitHandle RegisterWaitForSingleObject( // throws RegisterWaitException WaitHandle waitObject, WaitOrTimerCallback callBack, - Object state, + object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce, // NOTE: we do not allow other options that allow the callback to be queued as an APC bool compressStack @@ -1187,7 +1187,7 @@ namespace System.Threading if (callBack != null) { _ThreadPoolWaitOrTimerCallback callBackHelper = new _ThreadPoolWaitOrTimerCallback(callBack, state, compressStack); - state = (Object)callBackHelper; + state = (object)callBackHelper; // call SetWaitObject before native call so that waitObject won't be closed before threadpoolmgr registration // this could occur if callback were to fire before SetWaitObject does its addref registeredWaitHandle.SetWaitObject(waitObject); @@ -1209,59 +1209,59 @@ namespace System.Threading public static RegisteredWaitHandle RegisterWaitForSingleObject( // throws RegisterWaitException WaitHandle waitObject, WaitOrTimerCallback callBack, - Object state, + object state, int millisecondsTimeOutInterval, bool executeOnlyOnce // NOTE: we do not allow other options that allow the callback to be queued as an APC ) { if (millisecondsTimeOutInterval < -1) throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); - return RegisterWaitForSingleObject(waitObject, callBack, state, (UInt32)millisecondsTimeOutInterval, executeOnlyOnce, true); + return RegisterWaitForSingleObject(waitObject, callBack, state, (uint)millisecondsTimeOutInterval, executeOnlyOnce, true); } public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( // throws RegisterWaitException WaitHandle waitObject, WaitOrTimerCallback callBack, - Object state, + object state, int millisecondsTimeOutInterval, bool executeOnlyOnce // NOTE: we do not allow other options that allow the callback to be queued as an APC ) { if (millisecondsTimeOutInterval < -1) throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); - return RegisterWaitForSingleObject(waitObject, callBack, state, (UInt32)millisecondsTimeOutInterval, executeOnlyOnce, false); + return RegisterWaitForSingleObject(waitObject, callBack, state, (uint)millisecondsTimeOutInterval, executeOnlyOnce, false); } public static RegisteredWaitHandle RegisterWaitForSingleObject( // throws RegisterWaitException WaitHandle waitObject, WaitOrTimerCallback callBack, - Object state, + object state, long millisecondsTimeOutInterval, bool executeOnlyOnce // NOTE: we do not allow other options that allow the callback to be queued as an APC ) { if (millisecondsTimeOutInterval < -1) throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); - return RegisterWaitForSingleObject(waitObject, callBack, state, (UInt32)millisecondsTimeOutInterval, executeOnlyOnce, true); + return RegisterWaitForSingleObject(waitObject, callBack, state, (uint)millisecondsTimeOutInterval, executeOnlyOnce, true); } public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( // throws RegisterWaitException WaitHandle waitObject, WaitOrTimerCallback callBack, - Object state, + object state, long millisecondsTimeOutInterval, bool executeOnlyOnce // NOTE: we do not allow other options that allow the callback to be queued as an APC ) { if (millisecondsTimeOutInterval < -1) throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); - return RegisterWaitForSingleObject(waitObject, callBack, state, (UInt32)millisecondsTimeOutInterval, executeOnlyOnce, false); + return RegisterWaitForSingleObject(waitObject, callBack, state, (uint)millisecondsTimeOutInterval, executeOnlyOnce, false); } public static RegisteredWaitHandle RegisterWaitForSingleObject( WaitHandle waitObject, WaitOrTimerCallback callBack, - Object state, + object state, TimeSpan timeout, bool executeOnlyOnce ) @@ -1269,15 +1269,15 @@ namespace System.Threading long tm = (long)timeout.TotalMilliseconds; if (tm < -1) throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); - if (tm > (long)Int32.MaxValue) + if (tm > (long)int.MaxValue) throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_LessEqualToIntegerMaxVal); - return RegisterWaitForSingleObject(waitObject, callBack, state, (UInt32)tm, executeOnlyOnce, true); + return RegisterWaitForSingleObject(waitObject, callBack, state, (uint)tm, executeOnlyOnce, true); } public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject( WaitHandle waitObject, WaitOrTimerCallback callBack, - Object state, + object state, TimeSpan timeout, bool executeOnlyOnce ) @@ -1285,9 +1285,9 @@ namespace System.Threading long tm = (long)timeout.TotalMilliseconds; if (tm < -1) throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); - if (tm > (long)Int32.MaxValue) + if (tm > (long)int.MaxValue) throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_LessEqualToIntegerMaxVal); - return RegisterWaitForSingleObject(waitObject, callBack, state, (UInt32)tm, executeOnlyOnce, false); + return RegisterWaitForSingleObject(waitObject, callBack, state, (uint)tm, executeOnlyOnce, false); } public static bool QueueUserWorkItem(WaitCallback callBack) => @@ -1333,7 +1333,7 @@ namespace System.Threading return true; } - public static bool UnsafeQueueUserWorkItem(WaitCallback callBack, Object state) + public static bool UnsafeQueueUserWorkItem(WaitCallback callBack, object state) { if (callBack == null) { @@ -1507,7 +1507,7 @@ namespace System.Threading [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern IntPtr RegisterWaitForSingleObjectNative( WaitHandle waitHandle, - Object state, + object state, uint timeOutInterval, bool executeOnlyOnce, RegisteredWaitHandle registeredWaitHandle diff --git a/src/System.Private.CoreLib/src/System/Threading/Timer.cs b/src/System.Private.CoreLib/src/System/Threading/Timer.cs index 9825087da0..4d5c1c7fc1 100644 --- a/src/System.Private.CoreLib/src/System/Threading/Timer.cs +++ b/src/System.Private.CoreLib/src/System/Threading/Timer.cs @@ -17,7 +17,7 @@ using Internal.Runtime.Augments; namespace System.Threading { - public delegate void TimerCallback(Object state); + public delegate void TimerCallback(object state); // // TimerQueue maintains a list of active timers in this AppDomain. We use a single native timer, supplied by the VM, @@ -424,7 +424,7 @@ namespace System.Threading // Info about the user's callback // private readonly TimerCallback m_timerCallback; - private readonly Object m_state; + private readonly object m_state; private readonly ExecutionContext m_executionContext; @@ -670,12 +670,12 @@ namespace System.Threading public sealed class Timer : MarshalByRefObject, IDisposable { - private const UInt32 MAX_SUPPORTED_TIMEOUT = (uint)0xfffffffe; + private const uint MAX_SUPPORTED_TIMEOUT = (uint)0xfffffffe; private TimerHolder m_timer; public Timer(TimerCallback callback, - Object state, + object state, int dueTime, int period) { @@ -684,11 +684,11 @@ namespace System.Threading if (period < -1) throw new ArgumentOutOfRangeException(nameof(period), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); - TimerSetup(callback, state, (UInt32)dueTime, (UInt32)period); + TimerSetup(callback, state, (uint)dueTime, (uint)period); } public Timer(TimerCallback callback, - Object state, + object state, TimeSpan dueTime, TimeSpan period) { @@ -704,20 +704,20 @@ namespace System.Threading if (periodTm > MAX_SUPPORTED_TIMEOUT) throw new ArgumentOutOfRangeException(nameof(periodTm), SR.ArgumentOutOfRange_PeriodTooLarge); - TimerSetup(callback, state, (UInt32)dueTm, (UInt32)periodTm); + TimerSetup(callback, state, (uint)dueTm, (uint)periodTm); } [CLSCompliant(false)] public Timer(TimerCallback callback, - Object state, - UInt32 dueTime, - UInt32 period) + object state, + uint dueTime, + uint period) { TimerSetup(callback, state, dueTime, period); } public Timer(TimerCallback callback, - Object state, + object state, long dueTime, long period) { @@ -729,7 +729,7 @@ namespace System.Threading throw new ArgumentOutOfRangeException(nameof(dueTime), SR.ArgumentOutOfRange_TimeoutTooLarge); if (period > MAX_SUPPORTED_TIMEOUT) throw new ArgumentOutOfRangeException(nameof(period), SR.ArgumentOutOfRange_PeriodTooLarge); - TimerSetup(callback, state, (UInt32)dueTime, (UInt32)period); + TimerSetup(callback, state, (uint)dueTime, (uint)period); } public Timer(TimerCallback callback) @@ -739,13 +739,13 @@ namespace System.Threading // for a timer to be fired before the returned value is assigned to the variable, // potentially causing the callback to reference a bogus value (if passing the timer to the callback). - TimerSetup(callback, this, (UInt32)dueTime, (UInt32)period); + TimerSetup(callback, this, (uint)dueTime, (uint)period); } private void TimerSetup(TimerCallback callback, - Object state, - UInt32 dueTime, - UInt32 period) + object state, + uint dueTime, + uint period) { if (callback == null) throw new ArgumentNullException(nameof(TimerCallback)); @@ -760,7 +760,7 @@ namespace System.Threading if (period < -1) throw new ArgumentOutOfRangeException(nameof(period), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); - return m_timer.m_timer.Change((UInt32)dueTime, (UInt32)period); + return m_timer.m_timer.Change((uint)dueTime, (uint)period); } public bool Change(TimeSpan dueTime, TimeSpan period) @@ -769,7 +769,7 @@ namespace System.Threading } [CLSCompliant(false)] - public bool Change(UInt32 dueTime, UInt32 period) + public bool Change(uint dueTime, uint period) { return m_timer.m_timer.Change(dueTime, period); } @@ -785,7 +785,7 @@ namespace System.Threading if (period > MAX_SUPPORTED_TIMEOUT) throw new ArgumentOutOfRangeException(nameof(period), SR.ArgumentOutOfRange_PeriodTooLarge); - return m_timer.m_timer.Change((UInt32)dueTime, (UInt32)period); + return m_timer.m_timer.Change((uint)dueTime, (uint)period); } public bool Dispose(WaitHandle notifyObject) diff --git a/src/System.Private.CoreLib/src/System/Threading/WaitHandle.cs b/src/System.Private.CoreLib/src/System/Threading/WaitHandle.cs index cbb076d2bf..6f3f9d220a 100644 --- a/src/System.Private.CoreLib/src/System/Threading/WaitHandle.cs +++ b/src/System.Private.CoreLib/src/System/Threading/WaitHandle.cs @@ -144,7 +144,7 @@ namespace System.Threading public virtual bool WaitOne(TimeSpan timeout, bool exitContext) { long tm = (long)timeout.TotalMilliseconds; - if (-1 > tm || (long)Int32.MaxValue < tm) + if (-1 > tm || (long)int.MaxValue < tm) { throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); } @@ -283,7 +283,7 @@ namespace System.Threading bool exitContext) { long tm = (long)timeout.TotalMilliseconds; - if (-1 > tm || (long)Int32.MaxValue < tm) + if (-1 > tm || (long)int.MaxValue < tm) { throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); } @@ -376,7 +376,7 @@ namespace System.Threading bool exitContext) { long tm = (long)timeout.TotalMilliseconds; - if (-1 > tm || (long)Int32.MaxValue < tm) + if (-1 > tm || (long)int.MaxValue < tm) { throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); } @@ -424,7 +424,7 @@ namespace System.Threading bool exitContext) { long tm = (long)timeout.TotalMilliseconds; - if (-1 > tm || (long)Int32.MaxValue < tm) + if (-1 > tm || (long)int.MaxValue < tm) { throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1); } diff --git a/src/System.Private.CoreLib/src/System/ThrowHelper.cs b/src/System.Private.CoreLib/src/System/ThrowHelper.cs index e7f73b5cc1..dd9ee5073f 100644 --- a/src/System.Private.CoreLib/src/System/ThrowHelper.cs +++ b/src/System.Private.CoreLib/src/System/ThrowHelper.cs @@ -383,11 +383,11 @@ namespace System internal static void ThrowNotSupportedExceptionIfNonNumericType<T>() { - if (typeof(T) != typeof(Byte) && typeof(T) != typeof(SByte) && - typeof(T) != typeof(Int16) && typeof(T) != typeof(UInt16) && - typeof(T) != typeof(Int32) && typeof(T) != typeof(UInt32) && - typeof(T) != typeof(Int64) && typeof(T) != typeof(UInt64) && - typeof(T) != typeof(Single) && typeof(T) != typeof(Double)) + if (typeof(T) != typeof(byte) && typeof(T) != typeof(sbyte) && + typeof(T) != typeof(short) && typeof(T) != typeof(ushort) && + typeof(T) != typeof(int) && typeof(T) != typeof(uint) && + typeof(T) != typeof(long) && typeof(T) != typeof(ulong) && + typeof(T) != typeof(float) && typeof(T) != typeof(double)) { throw new NotSupportedException(SR.Arg_TypeNotSupported); } diff --git a/src/System.Private.CoreLib/src/System/Type.CoreCLR.cs b/src/System.Private.CoreLib/src/System/Type.CoreCLR.cs index 571f53e473..9717766f3c 100644 --- a/src/System.Private.CoreLib/src/System/Type.CoreCLR.cs +++ b/src/System.Private.CoreLib/src/System/Type.CoreCLR.cs @@ -22,21 +22,21 @@ namespace System } [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod - public static Type GetType(String typeName, bool throwOnError, bool ignoreCase) + public static Type GetType(string typeName, bool throwOnError, bool ignoreCase) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; return RuntimeType.GetType(typeName, throwOnError, ignoreCase, false, ref stackMark); } [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod - public static Type GetType(String typeName, bool throwOnError) + public static Type GetType(string typeName, bool throwOnError) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; return RuntimeType.GetType(typeName, throwOnError, false, false, ref stackMark); } [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod - public static Type GetType(String typeName) + public static Type GetType(string typeName) { StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; return RuntimeType.GetType(typeName, false, false, false, ref stackMark); @@ -84,7 +84,7 @@ namespace System // param progID: the progID of the class to retrieve // returns: the class object associated to the progID //// - public static Type GetTypeFromProgID(String progID, String server, bool throwOnError) + public static Type GetTypeFromProgID(string progID, string server, bool throwOnError) { return RuntimeType.GetTypeFromProgIDImpl(progID, server, throwOnError); } @@ -96,7 +96,7 @@ namespace System // param CLSID: the CLSID of the class to retrieve // returns: the class object associated to the CLSID //// - public static Type GetTypeFromCLSID(Guid clsid, String server, bool throwOnError) + public static Type GetTypeFromCLSID(Guid clsid, string server, bool throwOnError) { return RuntimeType.GetTypeFromCLSIDImpl(clsid, server, throwOnError); } diff --git a/src/System.Private.CoreLib/src/System/TypedReference.cs b/src/System.Private.CoreLib/src/System/TypedReference.cs index 748f2db461..3f5d5acd47 100644 --- a/src/System.Private.CoreLib/src/System/TypedReference.cs +++ b/src/System.Private.CoreLib/src/System/TypedReference.cs @@ -22,7 +22,7 @@ namespace System private IntPtr Type; [CLSCompliant(false)] - public static TypedReference MakeTypedReference(Object target, FieldInfo[] flds) + public static TypedReference MakeTypedReference(object target, FieldInfo[] flds) { if (target == null) throw new ArgumentNullException(nameof(target)); @@ -70,7 +70,7 @@ namespace System [MethodImplAttribute(MethodImplOptions.InternalCall)] // reference to TypedReference is banned, so have to pass result as pointer - private static extern unsafe void InternalMakeTypedReference(void* result, Object target, IntPtr[] flds, RuntimeType lastFieldType); + private static extern unsafe void InternalMakeTypedReference(void* result, object target, IntPtr[] flds, RuntimeType lastFieldType); public override int GetHashCode() { @@ -80,18 +80,18 @@ namespace System return __reftype(this).GetHashCode(); } - public override bool Equals(Object o) + public override bool Equals(object o) { throw new NotSupportedException(SR.NotSupported_NYI); } - public static unsafe Object ToObject(TypedReference value) + public static unsafe object ToObject(TypedReference value) { return InternalToObject(&value); } [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern unsafe Object InternalToObject(void* value); + internal static extern unsafe object InternalToObject(void* value); internal bool IsNull { @@ -113,12 +113,12 @@ namespace System // This may cause the type to be changed. [CLSCompliant(false)] - public static unsafe void SetTypedReference(TypedReference target, Object value) + public static unsafe void SetTypedReference(TypedReference target, object value) { InternalSetTypedReference(&target, value); } [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern unsafe void InternalSetTypedReference(void* target, Object value); + internal static extern unsafe void InternalSetTypedReference(void* target, object value); } } diff --git a/src/System.Private.CoreLib/src/System/ValueType.cs b/src/System.Private.CoreLib/src/System/ValueType.cs index cd8d0e05aa..59d8bdd94b 100644 --- a/src/System.Private.CoreLib/src/System/ValueType.cs +++ b/src/System.Private.CoreLib/src/System/ValueType.cs @@ -22,7 +22,7 @@ namespace System [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public abstract class ValueType { - public override bool Equals(Object obj) + public override bool Equals(object obj) { if (null == obj) { @@ -36,8 +36,8 @@ namespace System return false; } - Object thisObj = (Object)this; - Object thisResult, thatResult; + object thisObj = (object)this; + object thisResult, thatResult; // if there are no GC references in this object we can avoid reflection // and do a fast memcmp @@ -67,10 +67,10 @@ namespace System } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern bool CanCompareBits(Object obj); + private static extern bool CanCompareBits(object obj); [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern bool FastEqualsCheck(Object a, Object b); + private static extern bool FastEqualsCheck(object a, object b); /*=================================GetHashCode================================== **Action: Our algorithm for returning the hashcode is a little bit complex. We look @@ -88,7 +88,7 @@ namespace System [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int GetHashCodeOfPtr(IntPtr ptr); - public override String ToString() + public override string ToString() { return this.GetType().ToString(); } diff --git a/src/System.Private.CoreLib/src/System/Variant.cs b/src/System.Private.CoreLib/src/System/Variant.cs index 7717fc485f..5d781476c6 100644 --- a/src/System.Private.CoreLib/src/System/Variant.cs +++ b/src/System.Private.CoreLib/src/System/Variant.cs @@ -27,7 +27,7 @@ namespace System { //Do Not change the order of these fields. //They are mapped to the native VariantData * data structure. - private Object m_objref; + private object m_objref; private int m_data1; private int m_data2; private int m_flags; @@ -88,25 +88,25 @@ namespace System internal static readonly Type[] ClassTypes = { typeof(System.Empty), typeof(void), - typeof(Boolean), - typeof(Char), - typeof(SByte), - typeof(Byte), - typeof(Int16), - typeof(UInt16), - typeof(Int32), - typeof(UInt32), - typeof(Int64), - typeof(UInt64), - typeof(Single), - typeof(Double), - typeof(String), + typeof(bool), + typeof(char), + typeof(sbyte), + typeof(byte), + typeof(short), + typeof(ushort), + typeof(int), + typeof(uint), + typeof(long), + typeof(ulong), + typeof(float), + typeof(double), + typeof(string), typeof(void), // ptr for the moment typeof(DateTime), typeof(TimeSpan), - typeof(Object), - typeof(Decimal), - typeof(Object), // Treat enum as Object + typeof(object), + typeof(decimal), + typeof(object), // Treat enum as Object typeof(System.Reflection.Missing), typeof(System.DBNull), }; @@ -127,7 +127,7 @@ namespace System [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern void SetFieldsR8(double val); [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal extern void SetFieldsObject(Object val); + internal extern void SetFieldsObject(object val); // Use this function instead of an ECALL - saves about 150 clock cycles // by avoiding the ecall transition and because the JIT inlines this. @@ -141,7 +141,7 @@ namespace System // Constructors // - internal Variant(int flags, Object or, int data1, int data2) + internal Variant(int flags, object or, int data1, int data2) { m_flags = flags; m_objref = or; @@ -153,7 +153,7 @@ namespace System { m_objref = null; m_flags = CV_BOOLEAN; - m_data1 = (val) ? Boolean.True : Boolean.False; + m_data1 = (val) ? bool.True : bool.False; m_data2 = 0; } @@ -257,15 +257,15 @@ namespace System m_data2 = (int)(ticks >> 32); } - public Variant(Decimal val) + public Variant(decimal val) { - m_objref = (Object)val; + m_objref = (object)val; m_flags = CV_DECIMAL; m_data1 = 0; m_data2 = 0; } - public Variant(Object obj) + public Variant(object obj) { m_data1 = 0; m_data2 = 0; @@ -282,7 +282,7 @@ namespace System return; } - if (obj is String) + if (obj is string) { m_flags = CV_STRING; m_objref = obj; @@ -330,19 +330,19 @@ namespace System else if (obj is ErrorWrapper) { vt = VarEnum.VT_ERROR; - obj = (Object)(((ErrorWrapper)obj).ErrorCode); + obj = (object)(((ErrorWrapper)obj).ErrorCode); Debug.Assert(obj != null, "obj != null"); } else if (obj is CurrencyWrapper) { vt = VarEnum.VT_CY; - obj = (Object)(((CurrencyWrapper)obj).WrappedObject); + obj = (object)(((CurrencyWrapper)obj).WrappedObject); Debug.Assert(obj != null, "obj != null"); } else if (obj is BStrWrapper) { vt = VarEnum.VT_BSTR; - obj = (Object)(((BStrWrapper)obj).WrappedObject); + obj = (object)(((BStrWrapper)obj).WrappedObject); } if (obj != null) @@ -365,36 +365,36 @@ namespace System } } - public Object ToObject() + public object ToObject() { switch (CVType) { case CV_EMPTY: return null; case CV_BOOLEAN: - return (Object)(m_data1 != 0); + return (object)(m_data1 != 0); case CV_I1: - return (Object)((sbyte)m_data1); + return (object)((sbyte)m_data1); case CV_U1: - return (Object)((byte)m_data1); + return (object)((byte)m_data1); case CV_CHAR: - return (Object)((char)m_data1); + return (object)((char)m_data1); case CV_I2: - return (Object)((short)m_data1); + return (object)((short)m_data1); case CV_U2: - return (Object)((ushort)m_data1); + return (object)((ushort)m_data1); case CV_I4: - return (Object)(m_data1); + return (object)(m_data1); case CV_U4: - return (Object)((uint)m_data1); + return (object)((uint)m_data1); case CV_I8: - return (Object)(GetI8FromVar()); + return (object)(GetI8FromVar()); case CV_U8: - return (Object)((ulong)GetI8FromVar()); + return (object)((ulong)GetI8FromVar()); case CV_R4: - return (Object)(GetR4FromVar()); + return (object)(GetR4FromVar()); case CV_R8: - return (Object)(GetR8FromVar()); + return (object)(GetR8FromVar()); case CV_DATETIME: return new DateTime(GetI8FromVar()); case CV_TIMESPAN: @@ -415,12 +415,12 @@ namespace System // This routine will return an boxed enum. [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern Object BoxEnum(); + private extern object BoxEnum(); // Helper code for marshaling managed objects to VARIANT's (we use // managed variants as an intermediate type. - internal static void MarshalHelperConvertObjectToVariant(Object o, ref Variant v) + internal static void MarshalHelperConvertObjectToVariant(object o, ref Variant v) { IConvertible ic = o as IConvertible; @@ -445,7 +445,7 @@ namespace System break; case TypeCode.Object: - v = new Variant((Object)o); + v = new Variant((object)o); break; case TypeCode.DBNull: @@ -520,7 +520,7 @@ namespace System // Helper code for marshaling VARIANTS to managed objects (we use // managed variants as an intermediate type. - internal static Object MarshalHelperConvertVariantToObject(ref Variant v) + internal static object MarshalHelperConvertVariantToObject(ref Variant v) { return v.ToObject(); } @@ -528,7 +528,7 @@ namespace System // Helper code: on the back propagation path where a VT_BYREF VARIANT* // is marshaled to a "ref Object", we use this helper to force the // updated object back to the original type. - internal static void MarshalHelperCastVariant(Object pValue, int vt, ref Variant v) + internal static void MarshalHelperCastVariant(object pValue, int vt, ref Variant v) { IConvertible iv = pValue as IConvertible; if (iv == null) @@ -609,7 +609,7 @@ namespace System break; case 9: /*VT_DISPATCH*/ - v = new Variant(new DispatchWrapper((Object)iv)); + v = new Variant(new DispatchWrapper((object)iv)); break; case 10: /*VT_ERROR*/ @@ -621,11 +621,11 @@ namespace System break; case 12: /*VT_VARIANT*/ - v = new Variant((Object)iv); + v = new Variant((object)iv); break; case 13: /*VT_UNKNOWN*/ - v = new Variant(new UnknownWrapper((Object)iv)); + v = new Variant(new UnknownWrapper((object)iv)); break; case 14: /*VT_DECIMAL*/ diff --git a/src/System.Private.CoreLib/src/System/WeakReference.cs b/src/System.Private.CoreLib/src/System/WeakReference.cs index b99e3683a6..da0b1a284a 100644 --- a/src/System.Private.CoreLib/src/System/WeakReference.cs +++ b/src/System.Private.CoreLib/src/System/WeakReference.cs @@ -37,14 +37,14 @@ namespace System // Creates a new WeakReference that keeps track of target. // Assumes a Short Weak Reference (ie TrackResurrection is false.) // - public WeakReference(Object target) + public WeakReference(object target) : this(target, false) { } //Creates a new WeakReference that keeps track of target. // - public WeakReference(Object target, bool trackResurrection) + public WeakReference(object target, bool trackResurrection) { Create(target, trackResurrection); } @@ -56,7 +56,7 @@ namespace System throw new ArgumentNullException(nameof(info)); } - Object target = info.GetValue("TrackedObject", typeof(Object)); // Do not rename (binary serialization) + object target = info.GetValue("TrackedObject", typeof(object)); // Do not rename (binary serialization) bool trackResurrection = info.GetBoolean("TrackResurrection"); // Do not rename (binary serialization) Create(target, trackResurrection); @@ -83,7 +83,7 @@ namespace System //Gets the Object stored in the handle if it's accessible. // Or sets it. // - public extern virtual Object Target + public extern virtual object Target { [MethodImplAttribute(MethodImplOptions.InternalCall)] get; @@ -106,12 +106,12 @@ namespace System { throw new ArgumentNullException(nameof(info)); } - info.AddValue("TrackedObject", Target, typeof(Object)); // Do not rename (binary serialization) + info.AddValue("TrackedObject", Target, typeof(object)); // Do not rename (binary serialization) info.AddValue("TrackResurrection", IsTrackResurrection()); // Do not rename (binary serialization) } [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern void Create(Object target, bool trackResurrection); + private extern void Create(object target, bool trackResurrection); [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern bool IsTrackResurrection(); diff --git a/src/System.Private.CoreLib/src/System/__ComObject.cs b/src/System.Private.CoreLib/src/System/__ComObject.cs index 412b763ab1..8175637b82 100644 --- a/src/System.Private.CoreLib/src/System/__ComObject.cs +++ b/src/System.Private.CoreLib/src/System/__ComObject.cs @@ -63,9 +63,9 @@ namespace System // This method retrieves the data associated with the specified // key if any such data exists for the current __ComObject. //==================================================================== - internal Object GetData(Object key) + internal object GetData(object key) { - Object data = null; + object data = null; // Synchronize access to the map. lock (this) @@ -85,7 +85,7 @@ namespace System // This method sets the data for the specified key on the current // __ComObject. //==================================================================== - internal bool SetData(Object key, Object data) + internal bool SetData(object key, object data) { bool bAdded = false; @@ -119,7 +119,7 @@ namespace System // If the map hasn't been allocated, then there is nothing to do. if (m_ObjectToDataMap != null) { - foreach (Object o in m_ObjectToDataMap.Values) + foreach (object o in m_ObjectToDataMap.Values) { // Note: the value could be an object[] // We are fine for now as object[] doesn't implement IDisposable nor derive from __ComObject @@ -145,10 +145,10 @@ namespace System // This method is called from within the EE and is used to handle // calls on methods of event interfaces. //==================================================================== - internal Object GetEventProvider(RuntimeType t) + internal object GetEventProvider(RuntimeType t) { // Check to see if we already have a cached event provider for this type. - Object EvProvider = GetData(t); + object EvProvider = GetData(t); // If we don't then we need to create one. if (EvProvider == null) @@ -167,10 +167,10 @@ namespace System Marshal.InternalFinalReleaseComObject(this); } - private Object CreateEventProvider(RuntimeType t) + private object CreateEventProvider(RuntimeType t) { // Create the event provider for the specified type. - Object EvProvider = Activator.CreateInstance(t, Activator.ConstructorDefault | BindingFlags.NonPublic, null, new Object[] { this }, null); + object EvProvider = Activator.CreateInstance(t, Activator.ConstructorDefault | BindingFlags.NonPublic, null, new object[] { this }, null); // Attempt to cache the wrapper on the object. if (!SetData(t, EvProvider)) |