Use nameof where possible for ArgumentNullException
authorStephen A. Imhoff <clockwork-muse@outlook.com>
Wed, 26 Oct 2016 05:55:25 +0000 (22:55 -0700)
committerStephen A. Imhoff <clockwork-muse@outlook.com>
Fri, 28 Oct 2016 02:47:35 +0000 (19:47 -0700)
260 files changed:
src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs
src/mscorlib/src/Microsoft/Win32/Registry.cs
src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
src/mscorlib/src/System/Activator.cs
src/mscorlib/src/System/AggregateException.cs
src/mscorlib/src/System/AppContext/AppContext.cs
src/mscorlib/src/System/AppDomain.cs
src/mscorlib/src/System/AppDomainManager.cs
src/mscorlib/src/System/AppDomainSetup.cs
src/mscorlib/src/System/ApplicationId.cs
src/mscorlib/src/System/ArgumentException.cs
src/mscorlib/src/System/ArgumentOutOfRangeException.cs
src/mscorlib/src/System/Attribute.cs
src/mscorlib/src/System/BitConverter.cs
src/mscorlib/src/System/Boolean.cs
src/mscorlib/src/System/Buffer.cs
src/mscorlib/src/System/CfgParser.cs
src/mscorlib/src/System/Char.cs
src/mscorlib/src/System/Collections/ArrayList.cs
src/mscorlib/src/System/Collections/CollectionBase.cs
src/mscorlib/src/System/Collections/Comparer.cs
src/mscorlib/src/System/Collections/CompatibleComparer.cs
src/mscorlib/src/System/Collections/Concurrent/ConcurrentQueue.cs
src/mscorlib/src/System/Collections/Concurrent/ConcurrentStack.cs
src/mscorlib/src/System/Collections/Concurrent/IProducerConsumerCollection.cs
src/mscorlib/src/System/Collections/Concurrent/PartitionerStatic.cs
src/mscorlib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs
src/mscorlib/src/System/Collections/Generic/Comparer.cs
src/mscorlib/src/System/Collections/Generic/DebugView.cs
src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs
src/mscorlib/src/System/Collections/Hashtable.cs
src/mscorlib/src/System/Collections/ListDictionaryInternal.cs
src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs
src/mscorlib/src/System/Collections/SortedList.cs
src/mscorlib/src/System/Collections/Stack.cs
src/mscorlib/src/System/Convert.cs
src/mscorlib/src/System/DateTime.cs
src/mscorlib/src/System/DateTimeOffset.cs
src/mscorlib/src/System/Decimal.cs
src/mscorlib/src/System/DefaultBinder.cs
src/mscorlib/src/System/Delegate.cs
src/mscorlib/src/System/DelegateSerializationHolder.cs
src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs
src/mscorlib/src/System/Diagnostics/DebuggerAttributes.cs
src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventPayload.cs
src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceActivity.cs
src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/FieldMetadata.cs
src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs
src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventTypes.cs
src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingTypeInfo.cs
src/mscorlib/src/System/Diagnostics/Stacktrace.cs
src/mscorlib/src/System/Empty.cs
src/mscorlib/src/System/Enum.cs
src/mscorlib/src/System/Environment.cs
src/mscorlib/src/System/Exception.cs
src/mscorlib/src/System/FormattableString.cs
src/mscorlib/src/System/GC.cs
src/mscorlib/src/System/Globalization/Calendar.cs
src/mscorlib/src/System/Globalization/CharUnicodeInfo.cs
src/mscorlib/src/System/Globalization/CompareInfo.cs
src/mscorlib/src/System/Globalization/CultureInfo.cs
src/mscorlib/src/System/Globalization/CultureNotFoundException.cs
src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs
src/mscorlib/src/System/Globalization/EncodingTable.cs
src/mscorlib/src/System/Globalization/IdnMapping.cs
src/mscorlib/src/System/Globalization/NumberFormatInfo.cs
src/mscorlib/src/System/Globalization/RegionInfo.cs
src/mscorlib/src/System/Globalization/SortKey.cs
src/mscorlib/src/System/Globalization/StringInfo.cs
src/mscorlib/src/System/Globalization/TextInfo.cs
src/mscorlib/src/System/Guid.cs
src/mscorlib/src/System/IO/BinaryReader.cs
src/mscorlib/src/System/IO/BinaryWriter.cs
src/mscorlib/src/System/IO/Directory.cs
src/mscorlib/src/System/IO/DirectoryInfo.cs
src/mscorlib/src/System/IO/DriveInfo.cs
src/mscorlib/src/System/IO/File.cs
src/mscorlib/src/System/IO/FileInfo.cs
src/mscorlib/src/System/IO/FileSecurityState.cs
src/mscorlib/src/System/IO/FileStream.cs
src/mscorlib/src/System/IO/FileSystemInfo.cs
src/mscorlib/src/System/IO/MemoryStream.cs
src/mscorlib/src/System/IO/Path.cs
src/mscorlib/src/System/IO/Stream.cs
src/mscorlib/src/System/IO/StreamReader.cs
src/mscorlib/src/System/IO/StreamWriter.cs
src/mscorlib/src/System/IO/TextReader.cs
src/mscorlib/src/System/IO/TextWriter.cs
src/mscorlib/src/System/IO/UnmanagedMemoryAccessor.cs
src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs
src/mscorlib/src/System/IO/UnmanagedMemoryStreamWrapper.cs
src/mscorlib/src/System/IntPtr.cs
src/mscorlib/src/System/Lazy.cs
src/mscorlib/src/System/MarshalByRefObject.cs
src/mscorlib/src/System/MissingMemberException.cs
src/mscorlib/src/System/NotFiniteNumberException.cs
src/mscorlib/src/System/Nullable.cs
src/mscorlib/src/System/Number.cs
src/mscorlib/src/System/OperatingSystem.cs
src/mscorlib/src/System/Progress.cs
src/mscorlib/src/System/Random.cs
src/mscorlib/src/System/Reflection/Assembly.cs
src/mscorlib/src/System/Reflection/AssemblyAttributes.cs
src/mscorlib/src/System/Reflection/AssemblyName.cs
src/mscorlib/src/System/Reflection/ConstructorInfo.cs
src/mscorlib/src/System/Reflection/CustomAttribute.cs
src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs
src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs
src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs
src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs
src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs
src/mscorlib/src/System/Reflection/Emit/EventBuilder.cs
src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs
src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs
src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs
src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs
src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs
src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs
src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs
src/mscorlib/src/System/Reflection/Emit/SymbolType.cs
src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs
src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs
src/mscorlib/src/System/Reflection/EventInfo.cs
src/mscorlib/src/System/Reflection/FieldInfo.cs
src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs
src/mscorlib/src/System/Reflection/MemberInfoSerializationHolder.cs
src/mscorlib/src/System/Reflection/Metadata/AssemblyExtensions.cs
src/mscorlib/src/System/Reflection/MethodInfo.cs
src/mscorlib/src/System/Reflection/Missing.cs
src/mscorlib/src/System/Reflection/Module.cs
src/mscorlib/src/System/Reflection/ParameterInfo.cs
src/mscorlib/src/System/Reflection/Pointer.cs
src/mscorlib/src/System/Reflection/PropertyInfo.cs
src/mscorlib/src/System/Reflection/ReflectionContext.cs
src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs
src/mscorlib/src/System/Reflection/RuntimeReflectionExtensions.cs
src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs
src/mscorlib/src/System/Reflection/TypeDelegator.cs
src/mscorlib/src/System/Resources/LooselyLinkedResourceReference.cs
src/mscorlib/src/System/Resources/NeutralResourcesLanguageAttribute.cs
src/mscorlib/src/System/Resources/ResourceManager.cs
src/mscorlib/src/System/Resources/ResourceReader.cs
src/mscorlib/src/System/Resources/ResourceSet.cs
src/mscorlib/src/System/Resources/RuntimeResourceSet.cs
src/mscorlib/src/System/Resources/SatelliteContractVersionAttribute.cs
src/mscorlib/src/System/RtType.cs
src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs
src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs
src/mscorlib/src/System/Runtime/CompilerServices/FormattableStringFactory.cs
src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs
src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs
src/mscorlib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs
src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs
src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs
src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionServicesCommon.cs
src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
src/mscorlib/src/System/Runtime/InteropServices/RegistrationServices.cs
src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs
src/mscorlib/src/System/Runtime/InteropServices/StringBuffer.cs
src/mscorlib/src/System/Runtime/InteropServices/TypeLibConverter.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryKeyCollection.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryValueCollection.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorViewAdapter.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToDictionaryAdapter.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMetadata.cs
src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs
src/mscorlib/src/System/Runtime/Serialization/FormatterConverter.cs
src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs
src/mscorlib/src/System/Runtime/Serialization/SafeSerializationManager.cs
src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs
src/mscorlib/src/System/Runtime/Versioning/BinaryCompatibility.cs
src/mscorlib/src/System/Runtime/Versioning/TargetFrameworkAttribute.cs
src/mscorlib/src/System/RuntimeHandles.cs
src/mscorlib/src/System/Security/CodeAccessPermission.cs
src/mscorlib/src/System/Security/HostProtectionException.cs
src/mscorlib/src/System/Security/HostSecurityManager.cs
src/mscorlib/src/System/Security/NamedPermissionSet.cs
src/mscorlib/src/System/Security/PermissionSet.cs
src/mscorlib/src/System/Security/PermissionToken.cs
src/mscorlib/src/System/Security/Permissions/StrongNameIdentityPermission.cs
src/mscorlib/src/System/Security/Permissions/StrongNamePublicKeyBlob.cs
src/mscorlib/src/System/Security/Permissions/URLIdentityPermission.cs
src/mscorlib/src/System/Security/Permissions/keycontainerpermission.cs
src/mscorlib/src/System/Security/Policy/ApplicationTrust.cs
src/mscorlib/src/System/Security/Policy/Evidence.cs
src/mscorlib/src/System/Security/Policy/PolicyStatement.cs
src/mscorlib/src/System/Security/Policy/Site.cs
src/mscorlib/src/System/Security/Policy/StrongName.cs
src/mscorlib/src/System/Security/Policy/URL.cs
src/mscorlib/src/System/Security/Policy/Zone.cs
src/mscorlib/src/System/Security/SecurityElement.cs
src/mscorlib/src/System/Security/SecurityException.cs
src/mscorlib/src/System/Security/SecurityManager.cs
src/mscorlib/src/System/Security/Util/Hex.cs
src/mscorlib/src/System/Security/Util/StringExpressionSet.cs
src/mscorlib/src/System/Security/Util/URLString.cs
src/mscorlib/src/System/String.Comparison.cs
src/mscorlib/src/System/String.Manipulation.cs
src/mscorlib/src/System/String.Searching.cs
src/mscorlib/src/System/String.cs
src/mscorlib/src/System/StringComparer.cs
src/mscorlib/src/System/StubHelpers.cs
src/mscorlib/src/System/Text/BaseCodePageEncoding.cs
src/mscorlib/src/System/Text/CodePageEncoding.cs
src/mscorlib/src/System/Text/DBCSCodePageEncoding.cs
src/mscorlib/src/System/Text/Decoder.cs
src/mscorlib/src/System/Text/DecoderNLS.cs
src/mscorlib/src/System/Text/DecoderReplacementFallback.cs
src/mscorlib/src/System/Text/Encoder.cs
src/mscorlib/src/System/Text/EncoderNLS.cs
src/mscorlib/src/System/Text/EncoderReplacementFallback.cs
src/mscorlib/src/System/Text/Encoding.cs
src/mscorlib/src/System/Text/EncodingForwarder.cs
src/mscorlib/src/System/Text/EncodingProvider.cs
src/mscorlib/src/System/Text/GB18030Encoding.cs
src/mscorlib/src/System/Text/MLangCodePageEncoding.cs
src/mscorlib/src/System/Text/SBCSCodePageEncoding.cs
src/mscorlib/src/System/Text/StringBuilder.cs
src/mscorlib/src/System/Text/SurrogateEncoder.cs
src/mscorlib/src/System/Text/UTF7Encoding.cs
src/mscorlib/src/System/Text/UTF8Encoding.cs
src/mscorlib/src/System/Text/UnicodeEncoding.cs
src/mscorlib/src/System/Threading/CancellationToken.cs
src/mscorlib/src/System/Threading/CancellationTokenSource.cs
src/mscorlib/src/System/Threading/EventWaitHandle.cs
src/mscorlib/src/System/Threading/ExecutionContext.cs
src/mscorlib/src/System/Threading/Monitor.cs
src/mscorlib/src/System/Threading/Mutex.cs
src/mscorlib/src/System/Threading/Overlapped.cs
src/mscorlib/src/System/Threading/Semaphore.cs
src/mscorlib/src/System/Threading/SpinWait.cs
src/mscorlib/src/System/Threading/SynchronizationContext.cs
src/mscorlib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs
src/mscorlib/src/System/Threading/Tasks/Parallel.cs
src/mscorlib/src/System/Threading/Tasks/TaskFactory.cs
src/mscorlib/src/System/Threading/Thread.cs
src/mscorlib/src/System/Threading/ThreadLocal.cs
src/mscorlib/src/System/Threading/ThreadPool.cs
src/mscorlib/src/System/Threading/Timer.cs
src/mscorlib/src/System/Threading/WaitHandle.cs
src/mscorlib/src/System/ThrowHelper.cs
src/mscorlib/src/System/TimeZoneInfo.cs
src/mscorlib/src/System/Type.cs
src/mscorlib/src/System/TypeLoadException.cs
src/mscorlib/src/System/TypeNameParser.cs
src/mscorlib/src/System/TypedReference.cs
src/mscorlib/src/System/UIntPtr.cs
src/mscorlib/src/System/UnitySerializationHolder.cs
src/mscorlib/src/System/Variant.cs
src/mscorlib/src/System/Version.cs
src/mscorlib/src/System/WeakReference.cs
src/mscorlib/src/System/WeakReferenceOfT.cs

index 118c69b..254b2f6 100644 (file)
@@ -77,9 +77,9 @@ namespace Microsoft.Win32 {
         internal static Variant ChangeType(Variant source, Type targetClass, short options, CultureInfo culture)
         {
             if (targetClass == null)
-                throw new ArgumentNullException("targetClass");
+                throw new ArgumentNullException(nameof(targetClass));
             if (culture == null)
-                throw new ArgumentNullException("culture");
+                throw new ArgumentNullException(nameof(culture));
             Variant result = new Variant ();
             ChangeTypeEx(ref result, ref source, 
 #if FEATURE_USE_LCID
index 4faf29d..3d94d5b 100644 (file)
@@ -84,7 +84,7 @@ namespace Microsoft.Win32 {
         [System.Security.SecurityCritical]  // auto-generated
         private static RegistryKey GetBaseKeyFromKeyName(string keyName, out string subKeyName) {
             if( keyName == null) {
-                throw new ArgumentNullException("keyName");
+                throw new ArgumentNullException(nameof(keyName));
             }
 
             string basekeyName;
index 0d6a447..793cf06 100644 (file)
@@ -644,7 +644,7 @@ namespace Microsoft.Win32 {
         [ComVisible(false)]
         public static RegistryKey OpenRemoteBaseKey(RegistryHive hKey, String machineName, RegistryView view) {
             if (machineName==null)
-                throw new ArgumentNullException("machineName");
+                throw new ArgumentNullException(nameof(machineName));
             int index = (int)hKey & 0x0FFFFFFF;
             if (index < 0 || index >= hkeyNames.Length || ((int)hKey & 0xFFFFFFF0) != 0x80000000) {
                 throw new ArgumentException(Environment.GetResourceString("Arg_RegKeyOutOfRange"));
@@ -898,7 +898,7 @@ namespace Microsoft.Win32 {
         [ComVisible(false)]
         [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
         public static RegistryKey FromHandle(SafeRegistryHandle handle, RegistryView view) {
-            if (handle == null) throw new ArgumentNullException("handle");
+            if (handle == null) throw new ArgumentNullException(nameof(handle));
             ValidateKeyView(view);
 
             return new RegistryKey(handle, true /* isWritable */, view);
@@ -1591,7 +1591,7 @@ namespace Microsoft.Win32 {
         public void SetAccessControl(RegistrySecurity registrySecurity) {
             EnsureWriteable();
             if (registrySecurity == null)
-                throw new ArgumentNullException("registrySecurity");
+                throw new ArgumentNullException(nameof(registrySecurity));
 
             registrySecurity.Persist(hkey, keyName);
         }
index 48fedc0..bc43c76 100644 (file)
@@ -70,7 +70,7 @@ namespace System {
                                             Object[] activationAttributes)
         {
             if ((object)type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             Contract.EndContractBlock();
 
             if (type is System.Reflection.Emit.TypeBuilder)
@@ -182,7 +182,7 @@ namespace System {
         static public Object CreateInstance(Type type, bool nonPublic)
         {
             if ((object)type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             Contract.EndContractBlock();
 
             RuntimeType rt = type.UnderlyingSystemType as RuntimeType;
@@ -441,7 +441,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated_required
         public static ObjectHandle CreateInstance (AppDomain domain, string assemblyName, string typeName) {
             if (domain == null)
-                throw new ArgumentNullException("domain");
+                throw new ArgumentNullException(nameof(domain));
             Contract.EndContractBlock();
             return domain.InternalCreateInstanceWithNoSecurity(assemblyName, typeName);
         }
@@ -459,7 +459,7 @@ namespace System {
                                                    Object[] activationAttributes,
                                                    Evidence securityAttributes) {
             if (domain == null)
-                throw new ArgumentNullException("domain");
+                throw new ArgumentNullException(nameof(domain));
             Contract.EndContractBlock();
 
 #if FEATURE_CAS_POLICY
@@ -484,7 +484,7 @@ namespace System {
                                                   object[] activationAttributes)
         {
             if (domain == null)
-                throw new ArgumentNullException("domain");
+                throw new ArgumentNullException(nameof(domain));
             Contract.EndContractBlock();
 
             return domain.InternalCreateInstanceWithNoSecurity(assemblyName,
@@ -508,7 +508,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated_required
         public static ObjectHandle CreateInstanceFrom (AppDomain domain, string assemblyFile, string typeName) {
             if (domain == null)
-                throw new ArgumentNullException("domain");
+                throw new ArgumentNullException(nameof(domain));
             Contract.EndContractBlock();
             return domain.InternalCreateInstanceFromWithNoSecurity(assemblyFile, typeName);
         }
@@ -526,7 +526,7 @@ namespace System {
                                                        Object[] activationAttributes,
                                                        Evidence securityAttributes) {
             if (domain == null)
-                throw new ArgumentNullException("domain");
+                throw new ArgumentNullException(nameof(domain));
             Contract.EndContractBlock();
 
 #if FEATURE_CAS_POLICY
@@ -551,7 +551,7 @@ namespace System {
                                                       object[] activationAttributes)
         {
             if (domain == null)
-                throw new ArgumentNullException("domain");
+                throw new ArgumentNullException(nameof(domain));
             Contract.EndContractBlock();
 
             return domain.InternalCreateInstanceFromWithNoSecurity(assemblyFile,
@@ -647,7 +647,7 @@ namespace System {
         static public Object GetObject(Type type, String url, Object state)
         {
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             Contract.EndContractBlock();
             return RemotingServices.Connect(type, url, state);
         }
index 064432a..07523e1 100644 (file)
@@ -69,7 +69,7 @@ namespace System
         {
             if (innerException == null)
             {
-                throw new ArgumentNullException("innerException");
+                throw new ArgumentNullException(nameof(innerException));
             }
 
             m_innerExceptions = new ReadOnlyCollection<Exception>(new Exception[] { innerException });
@@ -149,7 +149,7 @@ namespace System
         {
             if (innerExceptions == null)
             {
-                throw new ArgumentNullException("innerExceptions");
+                throw new ArgumentNullException(nameof(innerExceptions));
             }
 
             // Copy exceptions to our internal array and validate them. We must copy them,
@@ -227,7 +227,7 @@ namespace System
         {
             if (innerExceptionInfos == null)
             {
-                throw new ArgumentNullException("innerExceptionInfos");
+                throw new ArgumentNullException(nameof(innerExceptionInfos));
             }
 
             // Copy exceptions to our internal array and validate them. We must copy them,
@@ -264,7 +264,7 @@ namespace System
         {
             if (info == null)
             {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
 
             Exception[] innerExceptions = info.GetValue("InnerExceptions", typeof(Exception[])) as Exception[];
@@ -290,7 +290,7 @@ namespace System
         {
             if (info == null)
             {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
 
             base.GetObjectData(info, context);
@@ -351,7 +351,7 @@ namespace System
         {
             if (predicate == null)
             {
-                throw new ArgumentNullException("predicate");
+                throw new ArgumentNullException(nameof(predicate));
             }
 
             List<Exception> unhandledExceptions = null;
index 5e78f8d..f678ecb 100644 (file)
@@ -114,7 +114,7 @@ namespace System
         public static bool TryGetSwitch(string switchName, out bool isEnabled)
         {
             if (switchName == null)
-                throw new ArgumentNullException("switchName");
+                throw new ArgumentNullException(nameof(switchName));
             if (switchName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "switchName");
 
@@ -210,7 +210,7 @@ namespace System
         public static void SetSwitch(string switchName, bool isEnabled)
         {
             if (switchName == null)
-                throw new ArgumentNullException("switchName");
+                throw new ArgumentNullException(nameof(switchName));
             if (switchName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "switchName");
 
index 814a4d4..475fdd7 100644 (file)
@@ -1516,7 +1516,7 @@ namespace System {
                 throw new NullReferenceException();
 
             if (assemblyName == null)
-                throw new ArgumentNullException("assemblyName");
+                throw new ArgumentNullException(nameof(assemblyName));
             Contract.EndContractBlock();
 
             return Activator.CreateInstance(assemblyName,
@@ -1591,7 +1591,7 @@ namespace System {
                 throw new NullReferenceException();
 
             if (assemblyName == null)
-                throw new ArgumentNullException("assemblyName");
+                throw new ArgumentNullException(nameof(assemblyName));
             Contract.EndContractBlock();
 
             return Activator.CreateInstance(assemblyName,
@@ -1630,7 +1630,7 @@ namespace System {
                 throw new NullReferenceException();
             
             if (assemblyName == null)
-                throw new ArgumentNullException("assemblyName");
+                throw new ArgumentNullException(nameof(assemblyName));
             Contract.EndContractBlock();
 
 #if FEATURE_CAS_POLICY
@@ -1667,7 +1667,7 @@ namespace System {
                 throw new NullReferenceException();
 
             if (assemblyName == null)
-                throw new ArgumentNullException("assemblyName");
+                throw new ArgumentNullException(nameof(assemblyName));
             Contract.EndContractBlock();
 
             return Activator.CreateInstance(assemblyName,
@@ -2258,7 +2258,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated
         private void SetDataHelper (string name, object data, IPermission permission) {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             Contract.EndContractBlock();
 
             //
@@ -2372,7 +2372,7 @@ namespace System {
         public Object GetData(string name)
         {
             if(name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             Contract.EndContractBlock();
 
             int key = AppDomainSetup.Locate(name);
@@ -2477,7 +2477,7 @@ namespace System {
         public static void Unload(AppDomain domain)
         {
             if (domain == null)
-                throw new ArgumentNullException("domain");
+                throw new ArgumentNullException(nameof(domain));
             Contract.EndContractBlock();
 
             try {
@@ -2502,7 +2502,7 @@ namespace System {
         public void SetAppDomainPolicy(PolicyLevel domainPolicy)
         {
             if (domainPolicy == null)
-                throw new ArgumentNullException("domainPolicy");
+                throw new ArgumentNullException(nameof(domainPolicy));
             Contract.EndContractBlock();
 
             if (!IsLegacyCasPolicyEnabled)
@@ -2566,7 +2566,7 @@ namespace System {
         public void SetThreadPrincipal(IPrincipal principal)
         {
             if (principal == null)
-                throw new ArgumentNullException("principal");
+                throw new ArgumentNullException(nameof(principal));
             Contract.EndContractBlock();
 
             lock (this) {
@@ -2606,7 +2606,7 @@ namespace System {
         public void DoCallBack(CrossAppDomainDelegate callBackDelegate)
         {
             if (callBackDelegate == null)
-                throw new ArgumentNullException("callBackDelegate");
+                throw new ArgumentNullException(nameof(callBackDelegate));
             Contract.EndContractBlock();
 
             callBackDelegate();        
@@ -3282,7 +3282,7 @@ namespace System {
                                       AppDomainSetup info)
         {
             if (friendlyName == null)
-                throw new ArgumentNullException("friendlyName", Environment.GetResourceString("ArgumentNull_String"));
+                throw new ArgumentNullException(nameof(friendlyName), Environment.GetResourceString("ArgumentNull_String"));
 
             Contract.EndContractBlock();
 
@@ -3326,7 +3326,7 @@ namespace System {
                                               params StrongName[] fullTrustAssemblies)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             if (info.ApplicationBase == null)
                 throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_AppDomainSandboxAPINeedsExplicitAppBase"));
             Contract.EndContractBlock();
index dc9fae4..bc5e5dc 100644 (file)
@@ -55,7 +55,7 @@ namespace System {
                                                        Evidence securityInfo,
                                                        AppDomainSetup appDomainInfo) {
             if (friendlyName == null)
-                throw new ArgumentNullException("friendlyName", Environment.GetResourceString("ArgumentNull_String"));
+                throw new ArgumentNullException(nameof(friendlyName), Environment.GetResourceString("ArgumentNull_String"));
 
             Contract.EndContractBlock();
             // If evidence is provided, we check to make sure that is allowed.
index f1057da..c4dc97c 100644 (file)
@@ -233,7 +233,7 @@ namespace System {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public AppDomainSetup (ActivationArguments activationArguments) {
             if (activationArguments == null)
-                throw new ArgumentNullException("activationArguments");
+                throw new ArgumentNullException(nameof(activationArguments));
             Contract.EndContractBlock();
 
             _LoaderOptimization = LoaderOptimization.NotSpecified;
@@ -677,12 +677,12 @@ namespace System {
         {
             if(functionName == null) 
             {
-                throw new ArgumentNullException("functionName");
+                throw new ArgumentNullException(nameof(functionName));
             }
 
             if(functionPointer == IntPtr.Zero)
             {
-                throw new ArgumentNullException("functionPointer");
+                throw new ArgumentNullException(nameof(functionPointer));
             }
 
             if(String.IsNullOrWhiteSpace(functionName))
index fa8be95..93fc37d 100644 (file)
@@ -33,13 +33,13 @@ namespace System {
 
         public ApplicationId (byte[] publicKeyToken, string name, Version version, string processorArchitecture, string culture) {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyApplicationName"));
             if (version == null)
-                throw new ArgumentNullException("version");
+                throw new ArgumentNullException(nameof(version));
             if (publicKeyToken == null)
-                throw new ArgumentNullException("publicKeyToken");
+                throw new ArgumentNullException(nameof(publicKeyToken));
             Contract.EndContractBlock();
 
             m_publicKeyToken = new byte[publicKeyToken.Length];
index 8edb7e4..0afa56f 100644 (file)
@@ -85,7 +85,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated_required
         public override void GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
             base.GetObjectData(info, context);
index a54380b..0b1ed4d 100644 (file)
@@ -92,7 +92,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated_required
         public override void GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
             base.GetObjectData(info, context);
index f21d527..f02aba2 100644 (file)
@@ -456,10 +456,10 @@ namespace System {
         public static Attribute[] GetCustomAttributes(MemberInfo element, Type type, bool inherit)
         {
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
 
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             
             if (!type.IsSubclassOf(typeof(Attribute)) && type != typeof(Attribute))
                 throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -486,7 +486,7 @@ namespace System {
         public static Attribute[] GetCustomAttributes(MemberInfo element, bool inherit)
         {
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
             Contract.EndContractBlock();
 
             switch (element.MemberType)
@@ -511,10 +511,10 @@ namespace System {
         {
             // Returns true if a custom attribute subclass of attributeType class/interface with inheritance walk
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
 
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             
             if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
                 throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -568,10 +568,10 @@ namespace System {
         public static Attribute[] GetCustomAttributes(ParameterInfo element, Type attributeType, bool inherit)
         {
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
 
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             
             if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
                 throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -591,7 +591,7 @@ namespace System {
         public static Attribute[] GetCustomAttributes(ParameterInfo element, bool inherit)
         {
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
 
             if (element.Member == null)
                 throw new ArgumentException(Environment.GetResourceString("Argument_InvalidParameterInfo"), "element");
@@ -614,10 +614,10 @@ namespace System {
         {
             // Returns true is a custom attribute subclass of attributeType class/interface with inheritance walk
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
 
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             
             if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
                 throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -681,7 +681,7 @@ namespace System {
         public static Attribute[] GetCustomAttributes(Module element, bool inherit)
         {
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
             Contract.EndContractBlock();
 
             return (Attribute[])element.GetCustomAttributes(typeof(Attribute), inherit);
@@ -690,10 +690,10 @@ namespace System {
         public static Attribute[] GetCustomAttributes(Module element, Type attributeType, bool inherit)
         {
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
 
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
 
             if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
                 throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -711,10 +711,10 @@ namespace System {
         {
             // Returns true is a custom attribute subclass of attributeType class/interface with no inheritance walk
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
 
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
 
             if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
                 throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -754,10 +754,10 @@ namespace System {
         public static Attribute[] GetCustomAttributes(Assembly element, Type attributeType, bool inherit)
         {
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
 
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
 
             if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
                 throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -774,7 +774,7 @@ namespace System {
         public static Attribute[] GetCustomAttributes(Assembly element, bool inherit)
         {
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
             Contract.EndContractBlock();
 
             return (Attribute[])element.GetCustomAttributes(typeof(Attribute), inherit);
@@ -789,10 +789,10 @@ namespace System {
         {
             // Returns true is a custom attribute subclass of attributeType class/interface with no inheritance walk
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
 
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
 
             if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
                 throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
index 8be545c..a93ec94 100644 (file)
@@ -358,7 +358,7 @@ namespace System {
         // Converts an array of bytes into a String.  
         public static String ToString (byte[] value, int startIndex, int length) {            
             if (value == null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
 
             if (startIndex < 0 || startIndex >= value.Length && startIndex > 0) {  // Don't throw for a 0 length array.
@@ -402,7 +402,7 @@ namespace System {
         // Converts an array of bytes into a String.  
         public static String ToString(byte [] value) {
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             Contract.Ensures(Contract.Result<String>() != null);            
             Contract.EndContractBlock();
             return ToString(value, 0, value.Length);
@@ -411,7 +411,7 @@ namespace System {
         // Converts an array of bytes into a String.  
         public static String ToString (byte [] value, int startIndex) {
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
             return ToString(value, startIndex, value.Length - startIndex);
@@ -428,7 +428,7 @@ namespace System {
         // Converts an array of bytes into a boolean.  
         public static bool ToBoolean(byte[] value, int startIndex) {
             if (value==null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             if (startIndex < 0)
                 throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (startIndex > value.Length - 1)
index c5cd45a..9aaec9a 100644 (file)
@@ -151,7 +151,7 @@ namespace System {
         // Determines whether a String represents true or false.
         // 
         public static Boolean Parse (String value) {
-            if (value==null) throw new ArgumentNullException("value");
+            if (value==null) throw new ArgumentNullException(nameof(value));
             Contract.EndContractBlock();
             Boolean result = false;
             if (!TryParse(value, out result)) {
index ea647f1..3975416 100644 (file)
@@ -141,7 +141,7 @@ namespace System {
         {
             // Is the array present?
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
 
             // Is it of primitive types?
             if (!IsPrimitiveTypeArray(array))
@@ -169,7 +169,7 @@ namespace System {
         {
             // Is the array present?
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
 
             // Is it of primitive types?
             if (!IsPrimitiveTypeArray(array))
@@ -199,7 +199,7 @@ namespace System {
         {
             // Is the array present?
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
 
             // Is it of primitive types?
             if (!IsPrimitiveTypeArray(array))
index ef368a9..1996f8d 100644 (file)
@@ -249,7 +249,7 @@ namespace System
         internal ConfigNode Parse(String fileName, String configPath, bool skipSecurityStuff)
         {
             if (fileName == null)
-                throw new ArgumentNullException("fileName");
+                throw new ArgumentNullException(nameof(fileName));
             Contract.EndContractBlock();
             this.fileName = fileName;
             if (configPath[0] == '/'){
index ff936c6..b9f7650 100644 (file)
@@ -167,7 +167,7 @@ namespace System {
 
       public static char Parse(String s) {
           if (s==null) {
-              throw new ArgumentNullException("s");
+              throw new ArgumentNullException(nameof(s));
           } 
           Contract.EndContractBlock();
           
@@ -364,7 +364,7 @@ namespace System {
       // <;<;Not fully implemented>;>;
       public static char ToUpper(char c, CultureInfo culture) {
         if (culture==null)
-            throw new ArgumentNullException("culture");
+            throw new ArgumentNullException(nameof(culture));
         Contract.EndContractBlock();
         return culture.TextInfo.ToUpper(c);
       }
@@ -393,7 +393,7 @@ namespace System {
       // <;<;Not fully implemented>;>;
       public static char ToLower(char c, CultureInfo culture) {
         if (culture==null)
-            throw new ArgumentNullException("culture");
+            throw new ArgumentNullException(nameof(culture));
         Contract.EndContractBlock();
         return culture.TextInfo.ToLower(c);
       }
@@ -508,7 +508,7 @@ namespace System {
   
         public static bool IsControl(String s, int index) {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -524,7 +524,7 @@ namespace System {
         public static bool IsDigit(String s, int index)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -539,7 +539,7 @@ namespace System {
         public static bool IsLetter(String s, int index)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -558,7 +558,7 @@ namespace System {
         public static bool IsLetterOrDigit(String s, int index)
         {   
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -573,7 +573,7 @@ namespace System {
         public static bool IsLower(String s, int index)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -617,7 +617,7 @@ namespace System {
         public static bool IsNumber(String s, int index)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -643,7 +643,7 @@ namespace System {
         public static bool IsPunctuation (String s, int index)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -688,7 +688,7 @@ namespace System {
         public static bool IsSeparator(String s, int index)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -710,7 +710,7 @@ namespace System {
         public static bool IsSurrogate(String s, int index)
         {
             if (s==null) {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
@@ -745,7 +745,7 @@ namespace System {
         public static bool IsSymbol(String s, int index)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -760,7 +760,7 @@ namespace System {
         public static bool IsUpper(String s, int index)
         {   
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -779,7 +779,7 @@ namespace System {
         public static bool IsWhiteSpace(String s, int index)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -803,7 +803,7 @@ namespace System {
         public static UnicodeCategory GetUnicodeCategory(String s, int index)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -822,7 +822,7 @@ namespace System {
         public static double GetNumericValue(String s, int index)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -842,7 +842,7 @@ namespace System {
         [Pure]
         public static bool IsHighSurrogate(String s, int index) {
             if (s == null) {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
             if (index < 0 || index >= s.Length) {
                 throw new ArgumentOutOfRangeException("index");
@@ -862,7 +862,7 @@ namespace System {
         [Pure]
         public static bool IsLowSurrogate(String s, int index) {
             if (s == null) {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
             if (index < 0 || index >= s.Length) {
                 throw new ArgumentOutOfRangeException("index");
@@ -877,7 +877,7 @@ namespace System {
         [Pure]
         public static bool IsSurrogatePair(String s, int index) {
             if (s == null) {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
             if (index < 0 || index >= s.Length) {
                 throw new ArgumentOutOfRangeException("index");
@@ -964,7 +964,7 @@ namespace System {
         
         public static int ConvertToUtf32(String s, int index) {
             if (s == null) {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
 
             if (index < 0 || index >= s.Length) {
index 94f4dc7..b2aa5ae 100644 (file)
@@ -83,7 +83,7 @@ namespace System.Collections {
         // 
         public ArrayList(ICollection c) {
             if (c==null)
-                throw new ArgumentNullException("c", Environment.GetResourceString("ArgumentNull_Collection"));
+                throw new ArgumentNullException(nameof(c), Environment.GetResourceString("ArgumentNull_Collection"));
             Contract.EndContractBlock();
 
             int count = c.Count;
@@ -188,7 +188,7 @@ namespace System.Collections {
         //
         public static ArrayList Adapter(IList list) {
             if (list==null)
-                throw new ArgumentNullException("list");
+                throw new ArgumentNullException(nameof(list));
             Contract.Ensures(Contract.Result<ArrayList>() != null);
             Contract.EndContractBlock();
             return new IListWrapper(list);
@@ -356,7 +356,7 @@ namespace System.Collections {
         //
         public static IList FixedSize(IList list) {
             if (list==null)
-                throw new ArgumentNullException("list");
+                throw new ArgumentNullException(nameof(list));
             Contract.Ensures(Contract.Result<IList>() != null);
             Contract.EndContractBlock();
             return new FixedSizeList(list);
@@ -367,7 +367,7 @@ namespace System.Collections {
         //
         public static ArrayList FixedSize(ArrayList list) {
             if (list==null)
-                throw new ArgumentNullException("list");
+                throw new ArgumentNullException(nameof(list));
             Contract.Ensures(Contract.Result<ArrayList>() != null);
             Contract.EndContractBlock();
             return new FixedSizeArrayList(list);
@@ -475,7 +475,7 @@ namespace System.Collections {
         //
         public virtual void InsertRange(int index, ICollection c) {
             if (c==null)
-                throw new ArgumentNullException("c", Environment.GetResourceString("ArgumentNull_Collection"));
+                throw new ArgumentNullException(nameof(c), Environment.GetResourceString("ArgumentNull_Collection"));
             if (index < 0 || index > _size) throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
             //Contract.Ensures(Count == Contract.OldValue(Count) + c.Count);
             Contract.EndContractBlock();
@@ -559,7 +559,7 @@ namespace System.Collections {
 #endif
         public static IList ReadOnly(IList list) {
             if (list==null)
-                throw new ArgumentNullException("list");
+                throw new ArgumentNullException(nameof(list));
             Contract.Ensures(Contract.Result<IList>() != null);
             Contract.EndContractBlock();
             return new ReadOnlyList(list);
@@ -569,7 +569,7 @@ namespace System.Collections {
         //
         public static ArrayList ReadOnly(ArrayList list) {
             if (list==null)
-                throw new ArgumentNullException("list");
+                throw new ArgumentNullException(nameof(list));
             Contract.Ensures(Contract.Result<ArrayList>() != null);
             Contract.EndContractBlock();
             return new ReadOnlyArrayList(list);
@@ -671,7 +671,7 @@ namespace System.Collections {
         // given collection.
         //
         public virtual void SetRange(int index, ICollection c) {
-            if (c==null) throw new ArgumentNullException("c", Environment.GetResourceString("ArgumentNull_Collection"));
+            if (c==null) throw new ArgumentNullException(nameof(c), Environment.GetResourceString("ArgumentNull_Collection"));
             Contract.EndContractBlock();
             int count = c.Count;
             if (index < 0 || index > _size - count) throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
@@ -732,7 +732,7 @@ namespace System.Collections {
         [HostProtection(Synchronization=true)]
         public static IList Synchronized(IList list) {
             if (list==null)
-                throw new ArgumentNullException("list");
+                throw new ArgumentNullException(nameof(list));
             Contract.Ensures(Contract.Result<IList>() != null);
             Contract.EndContractBlock();
             return new SyncIList(list);
@@ -743,7 +743,7 @@ namespace System.Collections {
         [HostProtection(Synchronization=true)]
         public static ArrayList Synchronized(ArrayList list) {
             if (list==null)
-                throw new ArgumentNullException("list");
+                throw new ArgumentNullException(nameof(list));
             Contract.Ensures(Contract.Result<ArrayList>() != null);
             Contract.EndContractBlock();
             return new SyncArrayList(list);
@@ -767,7 +767,7 @@ namespace System.Collections {
         [SecuritySafeCritical]
         public virtual Array ToArray(Type type) {
             if (type==null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             Contract.Ensures(Contract.Result<Array>() != null);
             Contract.EndContractBlock();
             Array array = Array.UnsafeCreateInstance(type, _size);
@@ -906,7 +906,7 @@ namespace System.Collections {
     
             public override void CopyTo(int index, Array array, int arrayIndex, int count) {
                 if (array==null)
-                    throw new ArgumentNullException("array");
+                    throw new ArgumentNullException(nameof(array));
                 if (index < 0 || arrayIndex < 0)
                     throw new ArgumentOutOfRangeException((index < 0) ? "index" : "arrayIndex", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
                 if( count < 0)
@@ -973,7 +973,7 @@ namespace System.Collections {
     
             public override void InsertRange(int index, ICollection c) {
                 if (c==null)
-                    throw new ArgumentNullException("c", Environment.GetResourceString("ArgumentNull_Collection"));
+                    throw new ArgumentNullException(nameof(c), Environment.GetResourceString("ArgumentNull_Collection"));
                 if (index < 0 || index > this.Count) throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
                 Contract.EndContractBlock();
 
@@ -1073,7 +1073,7 @@ namespace System.Collections {
     
             public override void SetRange(int index, ICollection c) {
                 if (c==null) {
-                    throw new ArgumentNullException("c", Environment.GetResourceString("ArgumentNull_Collection"));
+                    throw new ArgumentNullException(nameof(c), Environment.GetResourceString("ArgumentNull_Collection"));
                 }
                 Contract.EndContractBlock();
 
@@ -1126,7 +1126,7 @@ namespace System.Collections {
             public override Array ToArray(Type type)
             {
                 if (type==null)
-                    throw new ArgumentNullException("type");
+                    throw new ArgumentNullException(nameof(type));
                 Contract.EndContractBlock();
                 Array array = Array.UnsafeCreateInstance(type, _list.Count);
                 _list.CopyTo(array, 0);
@@ -2191,7 +2191,7 @@ namespace System.Collections {
 
             public override void AddRange(ICollection c) {
                 if( c ==  null ) {
-                    throw new ArgumentNullException("c");
+                    throw new ArgumentNullException(nameof(c));
                 }
                 Contract.EndContractBlock();
 
@@ -2265,7 +2265,7 @@ namespace System.Collections {
     
             public override void CopyTo(Array array, int index) {
                 if (array==null)
-                    throw new ArgumentNullException("array");
+                    throw new ArgumentNullException(nameof(array));
                 if (array.Rank != 1)
                     throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
                 if (index < 0)
@@ -2280,7 +2280,7 @@ namespace System.Collections {
 
             public override void CopyTo(int index, Array array, int arrayIndex, int count) {
                 if (array==null)
-                    throw new ArgumentNullException("array");
+                    throw new ArgumentNullException(nameof(array));
                 if (array.Rank != 1)
                     throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
                 if (index < 0 || count < 0)
@@ -2394,7 +2394,7 @@ namespace System.Collections {
             public override void InsertRange(int index, ICollection c) {
                 if (index < 0 || index > _baseSize) throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
                 if( c == null) {
-                    throw new ArgumentNullException("c");
+                    throw new ArgumentNullException(nameof(c));
                 }
                 Contract.EndContractBlock();
 
@@ -2522,7 +2522,7 @@ namespace System.Collections {
             [SecuritySafeCritical]
             public override Array ToArray(Type type) {
                 if (type==null)
-                    throw new ArgumentNullException("type");
+                    throw new ArgumentNullException(nameof(type));
                 Contract.EndContractBlock();
 
                 InternalUpdateRange();
@@ -2619,7 +2619,7 @@ namespace System.Collections {
         
             public ArrayListDebugView( ArrayList arrayList) {
                 if( arrayList == null)
-                    throw new ArgumentNullException("arrayList");
+                    throw new ArgumentNullException(nameof(arrayList));
 
                 this.arrayList = arrayList;
             }
index 1bb08af..389a79d 100644 (file)
@@ -194,7 +194,7 @@ namespace System.Collections {
         }
 
         protected virtual void OnValidate(Object value) { 
-            if (value == null) throw new ArgumentNullException("value");
+            if (value == null) throw new ArgumentNullException(nameof(value));
             Contract.EndContractBlock();
         }
 
index 11e2625..d905a6e 100644 (file)
@@ -36,7 +36,7 @@ namespace System.Collections {
 
         public Comparer(CultureInfo culture) {
             if (culture==null) {
-                throw new ArgumentNullException("culture");
+                throw new ArgumentNullException(nameof(culture));
             }
             Contract.EndContractBlock();
             m_compareInfo = culture.CompareInfo;
@@ -86,7 +86,7 @@ namespace System.Collections {
         [System.Security.SecurityCritical]  // auto-generated_required
         public void GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
 
index 85e6c3f..e5d3961 100644 (file)
@@ -39,7 +39,7 @@ namespace System.Collections {
 
         public int GetHashCode(Object obj) {
             if( obj == null) {
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             }
             Contract.EndContractBlock();
 
index 9164ead..d815ae9 100644 (file)
@@ -103,7 +103,7 @@ namespace System.Collections.Concurrent
         {
             if (collection == null)
             {
-                throw new ArgumentNullException("collection");
+                throw new ArgumentNullException(nameof(collection));
             }
 
             InitializeFromCollection(collection);
@@ -160,7 +160,7 @@ namespace System.Collections.Concurrent
             // Validate arguments.
             if (array == null)
             {
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             }
 
             // We must be careful not to corrupt the array, so we will first accumulate an
@@ -441,7 +441,7 @@ namespace System.Collections.Concurrent
         {
             if (array == null)
             {
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             }
 
             // We must be careful not to corrupt the array, so we will first accumulate an
index 15d4176..2884adc 100644 (file)
@@ -101,7 +101,7 @@ namespace System.Collections.Concurrent
         {
             if (collection == null)
             {
-                throw new ArgumentNullException("collection");
+                throw new ArgumentNullException(nameof(collection));
             }
             InitializeFromCollection(collection);
         }
@@ -293,7 +293,7 @@ namespace System.Collections.Concurrent
             // Validate arguments.
             if (array == null)
             {
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             }
 
             // We must be careful not to corrupt the array, so we will first accumulate an
@@ -327,7 +327,7 @@ namespace System.Collections.Concurrent
         {
             if (array == null)
             {
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             }
 
             // We must be careful not to corrupt the array, so we will first accumulate an
@@ -379,7 +379,7 @@ namespace System.Collections.Concurrent
         {
             if (items == null)
             {
-                throw new ArgumentNullException("items");
+                throw new ArgumentNullException(nameof(items));
             }
             PushRange(items, 0, items.Length);
         }
@@ -471,7 +471,7 @@ namespace System.Collections.Concurrent
         {
             if (items == null)
             {
-                throw new ArgumentNullException("items");
+                throw new ArgumentNullException(nameof(items));
             }
             if (count < 0)
             {
@@ -584,7 +584,7 @@ namespace System.Collections.Concurrent
         {
             if (items == null)
             {
-                throw new ArgumentNullException("items");
+                throw new ArgumentNullException(nameof(items));
             }
 
             return TryPopRange(items, 0, items.Length);
index a74f690..56be775 100644 (file)
@@ -97,7 +97,7 @@ namespace System.Collections.Concurrent
         {
             if (collection == null)
             {
-                throw new ArgumentNullException("collection");
+                throw new ArgumentNullException(nameof(collection));
             }
 
             m_collection = collection;
index 2169c6d..811019b 100644 (file)
@@ -91,7 +91,7 @@ namespace System.Collections.Concurrent
         {
             if (list == null)
             {
-                throw new ArgumentNullException("list");
+                throw new ArgumentNullException(nameof(list));
             }
             if (loadBalance)
             {
@@ -122,7 +122,7 @@ namespace System.Collections.Concurrent
 
             if (array == null)
             {
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             }
             if (loadBalance)
             {
@@ -172,7 +172,7 @@ namespace System.Collections.Concurrent
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
 
             if ((partitionerOptions & (~EnumerablePartitionerOptions.NoBuffering)) != 0)
index 6e28493..097599e 100644 (file)
@@ -36,7 +36,7 @@ namespace System.Collections {
 
         public void CopyTo(Array array, int index)  {
             if (array==null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
 
             if (array.Rank != 1)
                 throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
@@ -74,14 +74,14 @@ namespace System.Collections {
         public Object this[Object key] {
             get {
                 if (key == null) {
-                    throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                    throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
                 }
                 Contract.EndContractBlock();
                 return null;
             }
             set {
                 if (key == null) {
-                    throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                    throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
                 }
 
                 if (!key.GetType().IsSerializable)                 
@@ -113,7 +113,7 @@ namespace System.Collections {
 
         public void Add(Object key, Object value) {
             if (key == null) {
-                throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
             }
 
             if (!key.GetType().IsSerializable)                 
index e209c16..6e65daf 100644 (file)
@@ -33,7 +33,7 @@ namespace System.Collections.Generic
             Contract.Ensures(Contract.Result<Comparer<T>>() != null);
 
             if (comparison == null)
-                throw new ArgumentNullException("comparison");
+                throw new ArgumentNullException(nameof(comparison));
 
             return new ComparisonComparer<T>(comparison);
         }
index 57b91ef..d0711e5 100644 (file)
@@ -110,7 +110,7 @@ namespace System.Collections.Generic {
         
         public Mscorlib_KeyedCollectionDebugView(KeyedCollection<K, T> keyedCollection) {
             if (keyedCollection == null) {
-                throw new ArgumentNullException("keyedCollection");
+                throw new ArgumentNullException(nameof(keyedCollection));
             }
             Contract.EndContractBlock();
 
index 9624d84..8ebe7b1 100644 (file)
@@ -340,7 +340,7 @@ namespace System.Collections.Generic
         [System.Security.SecuritySafeCritical]  // auto-generated
         internal unsafe override int IndexOf(byte[] array, byte value, int startIndex, int count) {
             if (array==null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             if (startIndex < 0)
                 throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_Index"));
             if (count < 0)
index 262cced..052bce7 100644 (file)
@@ -375,7 +375,7 @@ namespace System.Collections {
         public Hashtable(IDictionary d, float loadFactor, IHashCodeProvider hcp, IComparer comparer) 
             : this((d != null ? d.Count : 0), loadFactor, hcp, comparer) {
             if (d==null)
-                throw new ArgumentNullException("d", Environment.GetResourceString("ArgumentNull_Dictionary"));
+                throw new ArgumentNullException(nameof(d), Environment.GetResourceString("ArgumentNull_Dictionary"));
             Contract.EndContractBlock();
  
             IDictionaryEnumerator e = d.GetEnumerator();
@@ -385,7 +385,7 @@ namespace System.Collections {
         public Hashtable(IDictionary d, float loadFactor, IEqualityComparer equalityComparer) 
             : this((d != null ? d.Count : 0), loadFactor, equalityComparer) {
             if (d==null)
-                throw new ArgumentNullException("d", Environment.GetResourceString("ArgumentNull_Dictionary"));
+                throw new ArgumentNullException(nameof(d), Environment.GetResourceString("ArgumentNull_Dictionary"));
             Contract.EndContractBlock();
             
             IDictionaryEnumerator e = d.GetEnumerator();
@@ -501,7 +501,7 @@ namespace System.Collections {
         // 
         public virtual bool ContainsKey(Object key) {
             if (key == null) {
-                throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
             }
             Contract.EndContractBlock();
 
@@ -590,7 +590,7 @@ namespace System.Collections {
         public virtual void CopyTo(Array array, int arrayIndex)
         {
             if (array == null)
-                throw new ArgumentNullException("array", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(nameof(array), Environment.GetResourceString("ArgumentNull_Array"));
             if (array.Rank != 1)
                 throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
             if (arrayIndex < 0) 
@@ -643,7 +643,7 @@ namespace System.Collections {
         public virtual Object this[Object key] {
             get {
                 if (key == null) {
-                    throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                    throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
                 }
                 Contract.EndContractBlock();
 
@@ -872,7 +872,7 @@ namespace System.Collections {
         [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         private void Insert (Object key, Object nvalue, bool add) {
             if (key == null) {
-                throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
             }
             Contract.EndContractBlock();
             if (count >= loadsize) {
@@ -1069,7 +1069,7 @@ namespace System.Collections {
         [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
         public virtual void Remove(Object key) {
             if (key == null) {
-                throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
             }
             Contract.EndContractBlock();
             Contract.Assert(!isWriterInProgress, "Race condition detected in usages of Hashtable - multiple threads appear to be writing to a Hashtable instance simultaneously!  Don't do that - use Hashtable.Synchronized.");
@@ -1134,7 +1134,7 @@ namespace System.Collections {
         [HostProtection(Synchronization=true)]
         public static Hashtable Synchronized(Hashtable table) {
             if (table==null)
-                throw new ArgumentNullException("table");
+                throw new ArgumentNullException(nameof(table));
             Contract.EndContractBlock();
             return new SyncHashtable(table);
         }
@@ -1146,7 +1146,7 @@ namespace System.Collections {
         [System.Security.SecurityCritical]
         public virtual void GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
             // This is imperfect - it only works well if all other writes are
@@ -1302,7 +1302,7 @@ namespace System.Collections {
             
             public virtual void CopyTo(Array array, int arrayIndex) {
                 if (array==null)
-                    throw new ArgumentNullException("array");
+                    throw new ArgumentNullException(nameof(array));
                 if (array.Rank != 1)
                     throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
                 if (arrayIndex < 0) 
@@ -1343,7 +1343,7 @@ namespace System.Collections {
             
             public virtual void CopyTo(Array array, int arrayIndex) {
                 if (array==null)
-                    throw new ArgumentNullException("array");
+                    throw new ArgumentNullException(nameof(array));
                 if (array.Rank != 1)
                     throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
                 if (arrayIndex < 0) 
@@ -1402,7 +1402,7 @@ namespace System.Collections {
             [System.Security.SecurityCritical]  // auto-generated
             public override void GetObjectData(SerializationInfo info, StreamingContext context) {
                 if (info==null) {
-                    throw new ArgumentNullException("info");
+                    throw new ArgumentNullException(nameof(info));
                 }
                 Contract.EndContractBlock();
                 // Our serialization code hasn't been fully tweaked to be safe 
@@ -1461,7 +1461,7 @@ namespace System.Collections {
     
             public override bool ContainsKey(Object key) {
                 if (key == null) {
-                    throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                    throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
                 }
                 Contract.EndContractBlock();
                 return _table.ContainsKey(key);
@@ -1630,7 +1630,7 @@ namespace System.Collections {
         
             public HashtableDebugView( Hashtable hashtable) {
                 if( hashtable == null) {
-                    throw new ArgumentNullException( "hashtable");
+                    throw new ArgumentNullException(nameof(hashtable));
                 }
                 Contract.EndContractBlock();
 
index 944523c..da9839f 100644 (file)
@@ -30,7 +30,7 @@ namespace System.Collections {
         public Object this[Object key] {
             get {
                 if (key == null) {
-                    throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                    throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
                 }
                 Contract.EndContractBlock();
                 DictionaryNode node = head;
@@ -45,7 +45,7 @@ namespace System.Collections {
             }
             set {
                 if (key == null) {
-                    throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                    throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
                 }
                 Contract.EndContractBlock();
 
@@ -132,7 +132,7 @@ namespace System.Collections {
 
         public void Add(Object key, Object value) {
             if (key == null) {
-                throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
             }
             Contract.EndContractBlock();
 
@@ -179,7 +179,7 @@ namespace System.Collections {
 
         public bool Contains(Object key) {
             if (key == null) {
-                throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
             }
             Contract.EndContractBlock();
             for (DictionaryNode node = head; node != null; node = node.next) {
@@ -192,7 +192,7 @@ namespace System.Collections {
 
         public void CopyTo(Array array, int index)  {
             if (array==null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
                 
             if (array.Rank != 1)
                 throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
@@ -220,7 +220,7 @@ namespace System.Collections {
 
         public void Remove(Object key) {
             if (key == null) {
-                throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
             }
             Contract.EndContractBlock();
             version++;
@@ -328,7 +328,7 @@ namespace System.Collections {
 
             void ICollection.CopyTo(Array array, int index)  {
                 if (array==null)
-                    throw new ArgumentNullException("array");
+                    throw new ArgumentNullException(nameof(array));
                 if (array.Rank != 1)
                     throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
                 if (index < 0)
index 57dd34d..5c9e8c4 100644 (file)
@@ -34,7 +34,7 @@ namespace System.Collections.ObjectModel
 
         public ReadOnlyDictionary(IDictionary<TKey, TValue> dictionary) {
             if (dictionary == null) {
-                throw new ArgumentNullException("dictionary");
+                throw new ArgumentNullException(nameof(dictionary));
             }
             Contract.EndContractBlock();
             m_dictionary = dictionary;
index 8e3926a..5672a75 100644 (file)
@@ -164,7 +164,7 @@ namespace System.Collections {
         public SortedList(IDictionary d, IComparer comparer) 
             : this(comparer, (d != null ? d.Count : 0)) {
             if (d==null)
-                throw new ArgumentNullException("d", Environment.GetResourceString("ArgumentNull_Dictionary"));
+                throw new ArgumentNullException(nameof(d), Environment.GetResourceString("ArgumentNull_Dictionary"));
             Contract.EndContractBlock();
             d.Keys.CopyTo(keys, 0);
             d.Values.CopyTo(values, 0);
@@ -176,7 +176,7 @@ namespace System.Collections {
         // ArgumentException is thrown if the key is already present in the sorted list.
         // 
         public virtual void Add(Object key, Object value) {
-            if (key == null) throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+            if (key == null) throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
             Contract.EndContractBlock();
             int i = Array.BinarySearch(keys, 0, _size, key, comparer);
             if (i >= 0)
@@ -325,7 +325,7 @@ namespace System.Collections {
         // Copies the values in this SortedList to an array.
         public virtual void CopyTo(Array array, int arrayIndex) {
             if (array == null)
-                throw new ArgumentNullException("array", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(nameof(array), Environment.GetResourceString("ArgumentNull_Array"));
             if (array.Rank != 1)
                 throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
             if (arrayIndex < 0) 
@@ -442,7 +442,7 @@ namespace System.Collections {
                 return null;
             }
             set {
-                if (key == null) throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                if (key == null) throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
                 Contract.EndContractBlock();
                 int i = Array.BinarySearch(keys, 0, _size, key, comparer);
                 if (i >= 0) {
@@ -463,7 +463,7 @@ namespace System.Collections {
         // 
         public virtual int IndexOfKey(Object key) {
             if (key == null) 
-                throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
             Contract.EndContractBlock();
             int ret = Array.BinarySearch(keys, 0, _size, key, comparer);
             return ret >=0 ? ret : -1;
@@ -533,7 +533,7 @@ namespace System.Collections {
         [HostProtection(Synchronization=true)]
         public static SortedList Synchronized(SortedList list) {
             if (list==null)
-                throw new ArgumentNullException("list");
+                throw new ArgumentNullException(nameof(list));
             Contract.EndContractBlock();
             return new SyncSortedList(list);
         }
@@ -677,7 +677,7 @@ namespace System.Collections {
     
             public override int IndexOfKey(Object key) {
                 if (key == null)
-                    throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                    throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
                 Contract.EndContractBlock();
 
                 lock(_root) {
@@ -888,7 +888,7 @@ namespace System.Collections {
     
             public virtual int IndexOf(Object key) {
                 if (key==null)
-                    throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+                    throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
                 Contract.EndContractBlock();
     
                 int i = Array.BinarySearch(sortedList.keys, 0,
@@ -993,7 +993,7 @@ namespace System.Collections {
         
             public SortedListDebugView( SortedList sortedList) {
                 if( sortedList == null) {
-                    throw new ArgumentNullException("sortedList");
+                    throw new ArgumentNullException(nameof(sortedList));
                 }
                 Contract.EndContractBlock();
 
index 0384a4e..46d3949 100644 (file)
@@ -59,7 +59,7 @@ namespace System.Collections {
         public Stack(ICollection col) : this((col==null ? 32 : col.Count))
         {
             if (col==null)
-                throw new ArgumentNullException("col");
+                throw new ArgumentNullException(nameof(col));
             Contract.EndContractBlock();
             IEnumerator en = col.GetEnumerator();
             while(en.MoveNext())
@@ -121,7 +121,7 @@ namespace System.Collections {
         // Copies the stack into an array.
         public virtual void CopyTo(Array array, int index) {
             if (array==null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             if (array.Rank != 1)
                 throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
             if (index < 0)
@@ -192,7 +192,7 @@ namespace System.Collections {
         [HostProtection(Synchronization=true)]
         public static Stack Synchronized(Stack stack) {
             if (stack==null)
-                throw new ArgumentNullException("stack");
+                throw new ArgumentNullException(nameof(stack));
             Contract.Ensures(Contract.Result<Stack>() != null);
             Contract.EndContractBlock();
             return new SyncStack(stack);
@@ -363,7 +363,7 @@ namespace System.Collections {
         
             public StackDebugView( Stack stack) {
                 if( stack == null)
-                    throw new ArgumentNullException("stack");
+                    throw new ArgumentNullException(nameof(stack));
                 Contract.EndContractBlock();
 
                 this.stack = stack;
index d146831..1054475 100644 (file)
@@ -259,7 +259,7 @@ namespace System {
         internal static Object DefaultToType(IConvertible value, Type targetType, IFormatProvider provider) {
             Contract.Requires(value != null, "[Convert.DefaultToType]value!=null");
             if (targetType==null) {
-                throw new ArgumentNullException("targetType");
+                throw new ArgumentNullException(nameof(targetType));
             }
             Contract.EndContractBlock();
 
@@ -322,7 +322,7 @@ namespace System {
 
         public static Object ChangeType(Object value, Type conversionType, IFormatProvider provider) {
             if( conversionType == null) {
-                throw new ArgumentNullException("conversionType");
+                throw new ArgumentNullException(nameof(conversionType));
             }
             Contract.EndContractBlock();
 
@@ -575,7 +575,7 @@ namespace System {
 
         public static char ToChar(String value, IFormatProvider provider) {
             if (value == null) 
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             Contract.EndContractBlock();
          
             if (value.Length != 1) 
@@ -2155,7 +2155,7 @@ namespace System {
 
         public static String ToBase64String(byte[] inArray) {
             if (inArray==null) {
-                throw new ArgumentNullException("inArray");
+                throw new ArgumentNullException(nameof(inArray));
             }
             Contract.Ensures(Contract.Result<string>() != null);
             Contract.EndContractBlock();
@@ -2165,7 +2165,7 @@ namespace System {
         [System.Runtime.InteropServices.ComVisible(false)]
         public static String ToBase64String(byte[] inArray, Base64FormattingOptions options) {
             if (inArray==null) {
-                throw new ArgumentNullException("inArray");
+                throw new ArgumentNullException(nameof(inArray));
             }
             Contract.Ensures(Contract.Result<string>() != null);
             Contract.EndContractBlock();
@@ -2181,7 +2181,7 @@ namespace System {
         public static unsafe String ToBase64String(byte[] inArray, int offset, int length, Base64FormattingOptions options) {
             //Do data verfication
             if (inArray==null) 
-                throw new ArgumentNullException("inArray");
+                throw new ArgumentNullException(nameof(inArray));
             if (length<0)
                 throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_Index"));
             if (offset<0)
@@ -2228,9 +2228,9 @@ namespace System {
         public static unsafe int ToBase64CharArray(byte[] inArray, int offsetIn, int length, char[] outArray, int offsetOut, Base64FormattingOptions options) {
             //Do data verfication
             if (inArray==null) 
-                throw new ArgumentNullException("inArray");
+                throw new ArgumentNullException(nameof(inArray));
             if (outArray==null)
-                throw new ArgumentNullException("outArray");
+                throw new ArgumentNullException(nameof(outArray));
             if (length<0)
                 throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_Index"));
             if (offsetIn<0)
@@ -2372,7 +2372,7 @@ namespace System {
             // "s" is an unfortunate parameter name, but we need to keep it for backward compat.
 
             if (s == null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
 
             Contract.EndContractBlock();
 
@@ -2396,7 +2396,7 @@ namespace System {
         public static Byte[] FromBase64CharArray(Char[] inArray, Int32 offset, Int32 length) {
 
             if (inArray == null)
-                throw new ArgumentNullException("inArray");
+                throw new ArgumentNullException(nameof(inArray));
 
             if (length < 0)
                 throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_Index"));
index ff8ad29..65a9f04 100644 (file)
@@ -208,7 +208,7 @@ namespace System {
         //
         public DateTime(int year, int month, int day, int hour, int minute, int second, Calendar calendar) {
             if (calendar == null)
-                throw new ArgumentNullException("calendar");
+                throw new ArgumentNullException(nameof(calendar));
             Contract.EndContractBlock();
             this.dateData = (UInt64)calendar.ToDateTime(year, month, day, hour, minute, second, 0).Ticks;
         }
@@ -248,7 +248,7 @@ namespace System {
         //
         public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar) {
             if (calendar == null)
-                throw new ArgumentNullException("calendar");
+                throw new ArgumentNullException(nameof(calendar));
             if (millisecond < 0 || millisecond >= MillisPerSecond) {
                 throw new ArgumentOutOfRangeException("millisecond", Environment.GetResourceString("ArgumentOutOfRange_Range", 0, MillisPerSecond - 1));
             }
@@ -262,7 +262,7 @@ namespace System {
 
         public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar, DateTimeKind kind) {
             if (calendar == null)
-                throw new ArgumentNullException("calendar");
+                throw new ArgumentNullException(nameof(calendar));
             if (millisecond < 0 || millisecond >= MillisPerSecond) {
                 throw new ArgumentOutOfRangeException("millisecond", Environment.GetResourceString("ArgumentOutOfRange_Range", 0, MillisPerSecond - 1));
             }            
@@ -279,7 +279,7 @@ namespace System {
         
         private DateTime(SerializationInfo info, StreamingContext context) {
             if (info==null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
     
             Boolean foundTicks = false;
@@ -675,7 +675,7 @@ namespace System {
         [System.Security.SecurityCritical /*auto-generated_required*/]
         void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
 
index 3e63c76..cf27bfd 100644 (file)
@@ -516,7 +516,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated_required
         void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info == null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
 
             Contract.EndContractBlock();
@@ -528,7 +528,7 @@ namespace System {
 
         DateTimeOffset(SerializationInfo info, StreamingContext context) {
             if (info == null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
 
             m_dateTime      = (DateTime)info.GetValue("DateTime", typeof(DateTime));
index 8a2c30f..788f768 100644 (file)
@@ -264,7 +264,7 @@ namespace System {
 
         private void SetBits(int[] bits) {
             if (bits==null)
-                throw new ArgumentNullException("bits");
+                throw new ArgumentNullException(nameof(bits));
             Contract.EndContractBlock();
             if (bits.Length == 4) {
                 int f = bits[3];
index 405055e..61fdfc5 100644 (file)
@@ -441,7 +441,7 @@ namespace System {
         public override FieldInfo BindToField(BindingFlags bindingAttr,FieldInfo[] match, Object value,CultureInfo cultureInfo)
         {
             if (match == null) {
-                throw new ArgumentNullException("match");
+                throw new ArgumentNullException(nameof(match));
             }
 
             int i;
@@ -596,7 +596,7 @@ namespace System {
             // Allow a null indexes array. But if it is not null, every element must be non-null as well.
             if (indexes != null && !Contract.ForAll(indexes, delegate(Type t) { return t != null; }))
             {
-                throw new ArgumentNullException("indexes");
+                throw new ArgumentNullException(nameof(indexes));
             }
             if (match == null || match.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Arg_EmptyArray"), "match");
@@ -732,7 +732,7 @@ namespace System {
         public static MethodBase ExactBinding(MethodBase[] match,Type[] types,ParameterModifier[] modifiers)
         {
             if (match==null)
-                throw new ArgumentNullException("match");
+                throw new ArgumentNullException(nameof(match));
             Contract.EndContractBlock();
             MethodBase[] aExactMatches = new MethodBase[match.Length];
             int cExactMatches = 0;
@@ -772,7 +772,7 @@ namespace System {
         public static PropertyInfo ExactPropertyBinding(PropertyInfo[] match,Type returnType,Type[] types,ParameterModifier[] modifiers)
         {
             if (match==null)
-                throw new ArgumentNullException("match");
+                throw new ArgumentNullException(nameof(match));
             Contract.EndContractBlock();
 
             PropertyInfo bestMatch = null;
index 1105554..2c66b9f 100644 (file)
@@ -46,10 +46,10 @@ namespace System {
         protected Delegate(Object target,String method)
         {
             if (target == null)
-                throw new ArgumentNullException("target");
+                throw new ArgumentNullException(nameof(target));
             
             if (method == null)
-                throw new ArgumentNullException("method");
+                throw new ArgumentNullException(nameof(method));
             Contract.EndContractBlock();
             
             // This API existed in v1/v1.1 and only expected to create closed
@@ -71,13 +71,13 @@ namespace System {
         protected unsafe Delegate(Type target,String method)
         {
             if (target == null)
-                throw new ArgumentNullException("target");
+                throw new ArgumentNullException(nameof(target));
 
             if (target.IsGenericType && target.ContainsGenericParameters)
                 throw new ArgumentException(Environment.GetResourceString("Arg_UnboundGenParam"), "target");
 
             if (method == null)
-                throw new ArgumentNullException("method");
+                throw new ArgumentNullException(nameof(method));
             Contract.EndContractBlock();
 
             RuntimeType rtTarget = target as RuntimeType;
@@ -354,11 +354,11 @@ namespace System {
         public static Delegate CreateDelegate(Type type, Object target, String method, bool ignoreCase, bool throwOnBindFailure)
         {
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             if (target == null)
-                throw new ArgumentNullException("target");
+                throw new ArgumentNullException(nameof(target));
             if (method == null)
-                throw new ArgumentNullException("method");
+                throw new ArgumentNullException(nameof(method));
             Contract.EndContractBlock();
 
             RuntimeType rtType = type as RuntimeType;
@@ -406,13 +406,13 @@ namespace System {
         public static Delegate CreateDelegate(Type type, Type target, String method, bool ignoreCase, bool throwOnBindFailure)
         {
             if (type == null)
-                    throw new ArgumentNullException("type");
+                    throw new ArgumentNullException(nameof(type));
             if (target == null)
-                throw new ArgumentNullException("target");
+                throw new ArgumentNullException(nameof(target));
             if (target.IsGenericType && target.ContainsGenericParameters)
                 throw new ArgumentException(Environment.GetResourceString("Arg_UnboundGenParam"), "target");
             if (method == null)
-                throw new ArgumentNullException("method");
+                throw new ArgumentNullException(nameof(method));
             Contract.EndContractBlock();
 
             RuntimeType rtType = type as RuntimeType;
@@ -449,9 +449,9 @@ namespace System {
         {
             // Validate the parameters.
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             if (method == null)
-                throw new ArgumentNullException("method");
+                throw new ArgumentNullException(nameof(method));
             Contract.EndContractBlock();
 
             RuntimeType rtType = type as RuntimeType;
@@ -500,9 +500,9 @@ namespace System {
         {
             // Validate the parameters.
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             if (method == null)
-                throw new ArgumentNullException("method");
+                throw new ArgumentNullException(nameof(method));
             Contract.EndContractBlock();
 
             RuntimeType rtType = type as RuntimeType;
@@ -571,11 +571,11 @@ namespace System {
         {
             // Validate the parameters.
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             Contract.EndContractBlock();
 
             if (method.IsNullHandle())
-                throw new ArgumentNullException("method");
+                throw new ArgumentNullException(nameof(method));
 
             RuntimeType rtType = type as RuntimeType;
             if (rtType == null)
@@ -605,9 +605,9 @@ namespace System {
         {
             // Validate the parameters.
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             if (method == null)
-                throw new ArgumentNullException("method");
+                throw new ArgumentNullException(nameof(method));
 
             Contract.EndContractBlock();
 
index a628033..9313dfd 100644 (file)
@@ -24,7 +24,7 @@ namespace System
             // Used for MulticastDelegate
 
             if (method == null) 
-                throw new ArgumentNullException("method");
+                throw new ArgumentNullException(nameof(method));
             Contract.EndContractBlock();
     
             if (!method.IsPublic || (method.DeclaringType != null && !method.DeclaringType.IsVisible))
@@ -120,7 +120,7 @@ namespace System
         private DelegateSerializationHolder(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
     
             bool bNewWire = true;
@@ -182,7 +182,7 @@ namespace System
         private DelegateEntry OldDelegateWireFormat(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             String delegateType = info.GetString("DelegateType");
index e002e6a..057d40f 100644 (file)
@@ -654,7 +654,7 @@ namespace System.Diagnostics.Contracts {
                 throw new ArgumentException("fromInclusive must be less than or equal to toExclusive.");
 #endif
             if (predicate == null)
-                throw new ArgumentNullException("predicate");
+                throw new ArgumentNullException(nameof(predicate));
             Contract.EndContractBlock();
 
             for (int i = fromInclusive; i < toExclusive; i++)
@@ -679,9 +679,9 @@ namespace System.Diagnostics.Contracts {
         public static bool ForAll<T>(IEnumerable<T> collection, Predicate<T> predicate)
         {
             if (collection == null)
-                throw new ArgumentNullException("collection");
+                throw new ArgumentNullException(nameof(collection));
             if (predicate == null)
-                throw new ArgumentNullException("predicate");
+                throw new ArgumentNullException(nameof(predicate));
             Contract.EndContractBlock();
 
             foreach (T t in collection)
@@ -716,7 +716,7 @@ namespace System.Diagnostics.Contracts {
                 throw new ArgumentException("fromInclusive must be less than or equal to toExclusive.");
 #endif
             if (predicate == null)
-                throw new ArgumentNullException("predicate");
+                throw new ArgumentNullException(nameof(predicate));
             Contract.EndContractBlock();
 
             for (int i = fromInclusive; i < toExclusive; i++)
@@ -740,9 +740,9 @@ namespace System.Diagnostics.Contracts {
         public static bool Exists<T>(IEnumerable<T> collection, Predicate<T> predicate)
         {
             if (collection == null)
-                throw new ArgumentNullException("collection");
+                throw new ArgumentNullException(nameof(collection));
             if (predicate == null)
-                throw new ArgumentNullException("predicate");
+                throw new ArgumentNullException(nameof(predicate));
             Contract.EndContractBlock();
 
             foreach (T t in collection)
index 6adcf34..bf66c2e 100644 (file)
@@ -166,7 +166,7 @@ namespace System.Diagnostics {
         public DebuggerTypeProxyAttribute(Type type)
         {
             if (type == null) {
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             }
             Contract.EndContractBlock();
 
@@ -186,7 +186,7 @@ namespace System.Diagnostics {
         {
             set { 
                 if( value == null) {
-                    throw new ArgumentNullException("value");
+                    throw new ArgumentNullException(nameof(value));
                 }
                 Contract.EndContractBlock();
                 
@@ -257,7 +257,7 @@ namespace System.Diagnostics {
         {
             set { 
                 if( value == null) {
-                    throw new ArgumentNullException("value");
+                    throw new ArgumentNullException(nameof(value));
                 }
                 Contract.EndContractBlock();
                 
@@ -302,7 +302,7 @@ namespace System.Diagnostics {
         public DebuggerVisualizerAttribute(string visualizerTypeName, Type visualizerObjectSource)
         {
             if (visualizerObjectSource == null) {
-                throw new ArgumentNullException("visualizerObjectSource");
+                throw new ArgumentNullException(nameof(visualizerObjectSource));
             }
             Contract.EndContractBlock();
             this.visualizerName = visualizerTypeName;
@@ -311,7 +311,7 @@ namespace System.Diagnostics {
         public DebuggerVisualizerAttribute(Type visualizer)
         {    
             if (visualizer == null) {
-                throw new ArgumentNullException("visualizer");
+                throw new ArgumentNullException(nameof(visualizer));
             }
             Contract.EndContractBlock();
             this.visualizerName = visualizer.AssemblyQualifiedName;
@@ -319,10 +319,10 @@ namespace System.Diagnostics {
         public DebuggerVisualizerAttribute(Type visualizer, Type visualizerObjectSource)
         {
             if (visualizer == null) {
-                throw new ArgumentNullException("visualizer");
+                throw new ArgumentNullException(nameof(visualizer));
             }
             if (visualizerObjectSource == null) {
-                throw new ArgumentNullException("visualizerObjectSource");
+                throw new ArgumentNullException(nameof(visualizerObjectSource));
             }
             Contract.EndContractBlock();
             this.visualizerName = visualizer.AssemblyQualifiedName;
@@ -331,7 +331,7 @@ namespace System.Diagnostics {
         public DebuggerVisualizerAttribute(Type visualizer, string visualizerObjectSourceTypeName)
         {
             if (visualizer == null) {
-                throw new ArgumentNullException("visualizer");
+                throw new ArgumentNullException(nameof(visualizer));
             }
             Contract.EndContractBlock();
             this.visualizerName = visualizer.AssemblyQualifiedName;
@@ -356,7 +356,7 @@ namespace System.Diagnostics {
         {
             set {                 
                 if( value == null) {
-                    throw new ArgumentNullException("value");
+                    throw new ArgumentNullException(nameof(value));
                 }
                 Contract.EndContractBlock();
                 
index be97447..a894d89 100644 (file)
@@ -40,7 +40,7 @@ namespace System.Diagnostics.Tracing
             get
             {
                 if (key == null)
-                    throw new System.ArgumentNullException("key");
+                    throw new System.ArgumentNullException(nameof(key));
 
                 int position = 0;
                 foreach(var name in m_names)
@@ -83,7 +83,7 @@ namespace System.Diagnostics.Tracing
         public bool ContainsKey(string key)
         {
             if (key == null)
-                throw new System.ArgumentNullException("key");
+                throw new System.ArgumentNullException(nameof(key));
 
             foreach (var item in m_names)
             {
@@ -129,7 +129,7 @@ namespace System.Diagnostics.Tracing
         public bool TryGetValue(string key, out object value)
         {
             if (key == null)
-                throw new System.ArgumentNullException("key");
+                throw new System.ArgumentNullException(nameof(key));
 
             int position = 0;
             foreach (var name in m_names)
index fccfd48..38c1767 100644 (file)
@@ -35,7 +35,7 @@ namespace System.Diagnostics.Tracing
         public EventSourceActivity(EventSource eventSource)
         {
             if (eventSource == null)
-                throw new ArgumentNullException("eventSource");
+                throw new ArgumentNullException(nameof(eventSource));
             Contract.EndContractBlock();
 
             this.eventSource = eventSource;
index 45673f7..309226b 100644 (file)
@@ -108,7 +108,7 @@ namespace System.Diagnostics.Tracing
             if (name == null)
             {
                 throw new ArgumentNullException(
-                    "name",
+                    nameof(name),
                     "This usually means that the object passed to Write is of a type that"
                     + " does not support being used as the top-level object in an event,"
                     + " e.g. a primitive or built-in type.");
index 963c492..a34ed7b 100644 (file)
@@ -100,7 +100,7 @@ namespace System.Diagnostics.Tracing
         {
             if (eventSourceName == null)
             {
-                throw new ArgumentNullException("eventSourceName");
+                throw new ArgumentNullException(nameof(eventSourceName));
             }
             Contract.EndContractBlock();
         }
@@ -115,7 +115,7 @@ namespace System.Diagnostics.Tracing
         {
             if (eventName == null)
             {
-                throw new ArgumentNullException("eventName");
+                throw new ArgumentNullException(nameof(eventName));
             }
 
             Contract.EndContractBlock();
@@ -143,7 +143,7 @@ namespace System.Diagnostics.Tracing
         {
             if (eventName == null)
             {
-                throw new ArgumentNullException("eventName");
+                throw new ArgumentNullException(nameof(eventName));
             }
 
             Contract.EndContractBlock();
index 4e33e58..c223967 100644 (file)
@@ -94,7 +94,7 @@ namespace System.Diagnostics.Tracing
         {
             if (name == null)
             {
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             }
 
             Contract.EndContractBlock();
@@ -132,7 +132,7 @@ namespace System.Diagnostics.Tracing
         {
             if (defaultName == null)
             {
-                throw new ArgumentNullException("defaultName");
+                throw new ArgumentNullException(nameof(defaultName));
             }
 
             Contract.EndContractBlock();
@@ -212,7 +212,7 @@ namespace System.Diagnostics.Tracing
         {
             if (paramInfos == null)
             {
-                throw new ArgumentNullException("paramInfos");
+                throw new ArgumentNullException(nameof(paramInfos));
             }
 
             Contract.EndContractBlock();
@@ -231,7 +231,7 @@ namespace System.Diagnostics.Tracing
         {
             if (types == null)
             {
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             }
 
             Contract.EndContractBlock();
@@ -251,7 +251,7 @@ namespace System.Diagnostics.Tracing
         {
             if (typeInfos == null)
             {
-                throw new ArgumentNullException("typeInfos");
+                throw new ArgumentNullException(nameof(typeInfos));
             }
 
             Contract.EndContractBlock();
index 5815d12..0cc17e0 100644 (file)
@@ -36,7 +36,7 @@ namespace System.Diagnostics.Tracing
         {
             if (dataType == null)
             {
-                throw new ArgumentNullException("dataType");
+                throw new ArgumentNullException(nameof(dataType));
             }
 
             Contract.EndContractBlock();
@@ -56,7 +56,7 @@ namespace System.Diagnostics.Tracing
         {
             if (dataType == null)
             {
-                throw new ArgumentNullException("dataType");
+                throw new ArgumentNullException(nameof(dataType));
             }
 
             if (name == null)
index 047a60f..c3dd086 100644 (file)
@@ -347,7 +347,7 @@ namespace System.Diagnostics {
         public StackTrace(Exception e)
         {
             if (e == null)
-                throw new ArgumentNullException("e");
+                throw new ArgumentNullException(nameof(e));
             Contract.EndContractBlock();
 
             m_iNumOfFrames = 0;
@@ -363,7 +363,7 @@ namespace System.Diagnostics {
         public StackTrace(Exception e, bool fNeedFileInfo)
         {
             if (e == null)
-                throw new ArgumentNullException("e");
+                throw new ArgumentNullException(nameof(e));
             Contract.EndContractBlock();
 
             m_iNumOfFrames = 0;
@@ -380,7 +380,7 @@ namespace System.Diagnostics {
         public StackTrace(Exception e, int skipFrames)
         {
             if (e == null)
-                throw new ArgumentNullException("e");
+                throw new ArgumentNullException(nameof(e));
 
             if (skipFrames < 0)
                 throw new ArgumentOutOfRangeException("skipFrames", 
@@ -402,7 +402,7 @@ namespace System.Diagnostics {
         public StackTrace(Exception e, int skipFrames, bool fNeedFileInfo)
         {
             if (e == null)
-                throw new ArgumentNullException("e");
+                throw new ArgumentNullException(nameof(e));
 
             if (skipFrames < 0)
                 throw new ArgumentOutOfRangeException("skipFrames", 
index f7e7486..c54c99a 100644 (file)
@@ -28,7 +28,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated
         public void GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
             UnitySerializationHolder.GetUnitySerializationInfo(info, UnitySerializationHolder.EmptyUnity, null, null);
index abbb636..404d4d7 100644 (file)
@@ -399,7 +399,7 @@ namespace System
         private static bool TryParseEnum(Type enumType, String value, bool ignoreCase, ref EnumResult parseResult)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             Contract.EndContractBlock();
 
             RuntimeType rtType = enumType as RuntimeType;
@@ -534,7 +534,7 @@ namespace System
         public static Type GetUnderlyingType(Type enumType)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             Contract.Ensures(Contract.Result<Type>() != null);
             Contract.EndContractBlock();
 
@@ -545,7 +545,7 @@ namespace System
         public static Array GetValues(Type enumType)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             Contract.Ensures(Contract.Result<Array>() != null);
             Contract.EndContractBlock();
 
@@ -562,7 +562,7 @@ namespace System
         public static String GetName(Type enumType, Object value)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             Contract.EndContractBlock();
 
             return enumType.GetEnumName(value);
@@ -572,7 +572,7 @@ namespace System
         public static String[] GetNames(Type enumType)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             Contract.Ensures(Contract.Result<String[]>() != null);
             Contract.EndContractBlock();
 
@@ -589,7 +589,7 @@ namespace System
         public static Object ToObject(Type enumType, Object value)
         {
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             Contract.EndContractBlock();
 
             // Delegate rest of error checking to the other functions
@@ -638,7 +638,7 @@ namespace System
         public static bool IsDefined(Type enumType, Object value)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             Contract.EndContractBlock();
 
             return enumType.IsEnumDefined(value);
@@ -648,16 +648,16 @@ namespace System
         public static String Format(Type enumType, Object value, String format)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
 
             if (!enumType.IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
 
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
 
             if (format == null)
-                throw new ArgumentNullException("format");
+                throw new ArgumentNullException(nameof(format));
             Contract.EndContractBlock();
 
             RuntimeType rtType = enumType as RuntimeType;
@@ -975,7 +975,7 @@ namespace System
         [System.Security.SecuritySafeCritical]
         public Boolean HasFlag(Enum flag) {
             if (flag == null)
-                throw new ArgumentNullException("flag");
+                throw new ArgumentNullException(nameof(flag));
             Contract.EndContractBlock();
             
             if (!this.GetType().IsEquivalentTo(flag.GetType())) {
@@ -1145,7 +1145,7 @@ namespace System
         public static Object ToObject(Type enumType, sbyte value)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             if (!enumType.IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
             Contract.EndContractBlock();
@@ -1160,7 +1160,7 @@ namespace System
         public static Object ToObject(Type enumType, short value)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             if (!enumType.IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
             Contract.EndContractBlock();
@@ -1175,7 +1175,7 @@ namespace System
         public static Object ToObject(Type enumType, int value)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             if (!enumType.IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
             Contract.EndContractBlock();
@@ -1190,7 +1190,7 @@ namespace System
         public static Object ToObject(Type enumType, byte value)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             if (!enumType.IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
             Contract.EndContractBlock();
@@ -1206,7 +1206,7 @@ namespace System
         public static Object ToObject(Type enumType, ushort value)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             if (!enumType.IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
             Contract.EndContractBlock();
@@ -1222,7 +1222,7 @@ namespace System
         public static Object ToObject(Type enumType, uint value)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             if (!enumType.IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
             Contract.EndContractBlock();
@@ -1237,7 +1237,7 @@ namespace System
         public static Object ToObject(Type enumType, long value)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             if (!enumType.IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
             Contract.EndContractBlock();
@@ -1253,7 +1253,7 @@ namespace System
         public static Object ToObject(Type enumType, ulong value)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             if (!enumType.IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
             Contract.EndContractBlock();
@@ -1267,7 +1267,7 @@ namespace System
         private static Object ToObject(Type enumType, char value)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             if (!enumType.IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
             Contract.EndContractBlock();
@@ -1281,7 +1281,7 @@ namespace System
         private static Object ToObject(Type enumType, bool value)
         {
             if (enumType == null)
-                throw new ArgumentNullException("enumType");
+                throw new ArgumentNullException(nameof(enumType));
             if (!enumType.IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
             Contract.EndContractBlock();
index 199ce07..d9d500f 100644 (file)
@@ -403,7 +403,7 @@ namespace System {
         public static String ExpandEnvironmentVariables(String name)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             Contract.EndContractBlock();
 
             if (name.Length == 0) {
@@ -627,7 +627,7 @@ namespace System {
         public static String GetEnvironmentVariable(String variable)
         {
             if (variable == null)
-                throw new ArgumentNullException("variable");
+                throw new ArgumentNullException(nameof(variable));
             Contract.EndContractBlock();
 
             if (AppDomain.IsAppXModel() && !AppDomain.IsAppXDesignMode()) {
@@ -663,7 +663,7 @@ namespace System {
         {
             if (variable == null)
             {
-                throw new ArgumentNullException("variable");
+                throw new ArgumentNullException(nameof(variable));
             }
             Contract.EndContractBlock();
 
@@ -931,7 +931,7 @@ namespace System {
 
         private static void CheckEnvironmentVariableName(string variable) {
             if (variable == null) {
-                throw new ArgumentNullException("variable");
+                throw new ArgumentNullException(nameof(variable));
             }
 
             if( variable.Length == 0) {
index 3068785..07e34c2 100644 (file)
@@ -77,7 +77,7 @@ namespace System {
         protected Exception(SerializationInfo info, StreamingContext context) 
         {
             if (info==null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
     
             _className = info.GetString("ClassName");
@@ -549,7 +549,7 @@ namespace System {
         {
             if (info == null)
             {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
 
index ef56bcf..294b2c1 100644 (file)
@@ -67,7 +67,7 @@ namespace System
         {
             if (formattable == null)
             {
-                throw new ArgumentNullException("formattable");
+                throw new ArgumentNullException(nameof(formattable));
             }
 
             return formattable.ToString(Globalization.CultureInfo.InvariantCulture);
index 73c676d..7919dc1 100644 (file)
@@ -331,7 +331,7 @@ namespace System {
         [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
         public static void SuppressFinalize(Object obj) {
             if (obj == null)
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             Contract.EndContractBlock();
             _SuppressFinalize(obj);
         }
@@ -347,7 +347,7 @@ namespace System {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public static void ReRegisterForFinalize(Object obj) {
             if (obj == null)
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             Contract.EndContractBlock();
             _ReRegisterForFinalize(obj);
         }
index d6dfdc9..447754c 100644 (file)
@@ -192,7 +192,7 @@ namespace System.Globalization {
         [System.Runtime.InteropServices.ComVisible(false)]
         public static Calendar ReadOnly(Calendar calendar) 
         {
-            if (calendar == null)       { throw new ArgumentNullException("calendar"); }
+            if (calendar == null)       { throw new ArgumentNullException(nameof(calendar)); }
             Contract.EndContractBlock();
             if (calendar.IsReadOnly)    { return (calendar); }
             
index 6315195..faa0926 100644 (file)
@@ -326,7 +326,7 @@ namespace System.Globalization {
 
         public static double GetNumericValue(String s, int index) {
             if (s == null) {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
             if (index < 0 || index >= s.Length) {
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
@@ -361,7 +361,7 @@ namespace System.Globalization {
 
         public static int GetDecimalDigitValue(String s, int index) {
             if (s == null) {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
             if (index < 0 || index >= s.Length) {
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
@@ -398,7 +398,7 @@ namespace System.Globalization {
 
         public static int GetDigitValue(String s, int index) {
             if (s == null) {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
             if (index < 0 || index >= s.Length) {
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
@@ -415,7 +415,7 @@ namespace System.Globalization {
         public static UnicodeCategory GetUnicodeCategory(String s, int index)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
@@ -467,7 +467,7 @@ namespace System.Globalization {
 
         internal static BidiCategory GetBidiCategory(String s, int index) {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             if (((uint)index)>=((uint)s.Length)) {
                 throw new ArgumentOutOfRangeException("index");
             }
index ec33b18..5097de1 100644 (file)
@@ -135,7 +135,7 @@ namespace System.Globalization {
         public static CompareInfo GetCompareInfo(int culture, Assembly assembly){
             // Parameter checking.
             if (assembly == null) {
-                throw new ArgumentNullException("assembly");
+                throw new ArgumentNullException(nameof(assembly));
             }
             if (assembly!=typeof(Object).Module.Assembly) {
                 throw new ArgumentException(Environment.GetResourceString("Argument_OnlyMscorlib"));
@@ -161,7 +161,7 @@ namespace System.Globalization {
         // Assembly constructor should be deprecated, we don't act on the assembly information any more
         public static CompareInfo GetCompareInfo(String name, Assembly assembly){
             if (name == null || assembly == null) {
-                throw new ArgumentNullException(name == null ? "name" : "assembly");
+                throw new ArgumentNullException(name == null ? nameof(name) : nameof(assembly));
             }
             Contract.EndContractBlock();
 
@@ -209,7 +209,7 @@ namespace System.Globalization {
         {
             if (name == null)
             {
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             }
             Contract.EndContractBlock();
 
@@ -226,7 +226,7 @@ namespace System.Globalization {
         public static bool IsSortable(String text) {
             if (text == null) {
                 // A null param is invalid here.
-                throw new ArgumentNullException("text");
+                throw new ArgumentNullException(nameof(text));
             }
 
             if (0 == text.Length) {
@@ -552,7 +552,7 @@ namespace System.Globalization {
         public unsafe virtual bool IsPrefix(String source, String prefix, CompareOptions options)
         {
             if (source == null || prefix == null) {
-                throw new ArgumentNullException((source == null ? "source" : "prefix"),
+                throw new ArgumentNullException((source == null ? nameof(source) : nameof(prefix)),
                     Environment.GetResourceString("ArgumentNull_String"));
             }
             Contract.EndContractBlock();
@@ -607,7 +607,7 @@ namespace System.Globalization {
         public unsafe virtual bool IsSuffix(String source, String suffix, CompareOptions options)
         {
             if (source == null || suffix == null) {
-                throw new ArgumentNullException((source == null ? "source" : "suffix"),
+                throw new ArgumentNullException((source == null ? nameof(source) : nameof(suffix)),
                     Environment.GetResourceString("ArgumentNull_String"));
             }
             Contract.EndContractBlock();
@@ -661,7 +661,7 @@ namespace System.Globalization {
         public unsafe virtual int IndexOf(String source, char value)
         {
             if (source==null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             return IndexOf(source, value, 0, source.Length, CompareOptions.None);
@@ -671,7 +671,7 @@ namespace System.Globalization {
         public unsafe virtual int IndexOf(String source, String value)
         {
             if (source==null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             return IndexOf(source, value, 0, source.Length, CompareOptions.None);
@@ -681,7 +681,7 @@ namespace System.Globalization {
         public unsafe virtual int IndexOf(String source, char value, CompareOptions options)
         {
             if (source==null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             return IndexOf(source, value, 0, source.Length, options);
@@ -691,7 +691,7 @@ namespace System.Globalization {
         public unsafe virtual int IndexOf(String source, String value, CompareOptions options)
         {
             if (source==null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             return IndexOf(source, value, 0, source.Length, options);
@@ -701,7 +701,7 @@ namespace System.Globalization {
         public unsafe virtual int IndexOf(String source, char value, int startIndex)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             return IndexOf(source, value, startIndex, source.Length - startIndex, CompareOptions.None);
@@ -711,7 +711,7 @@ namespace System.Globalization {
         public unsafe virtual int IndexOf(String source, String value, int startIndex)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             return IndexOf(source, value, startIndex, source.Length - startIndex, CompareOptions.None);
@@ -721,7 +721,7 @@ namespace System.Globalization {
         public unsafe virtual int IndexOf(String source, char value, int startIndex, CompareOptions options)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             return IndexOf(source, value, startIndex, source.Length - startIndex, options);
@@ -731,7 +731,7 @@ namespace System.Globalization {
         public unsafe virtual int IndexOf(String source, String value, int startIndex, CompareOptions options)
         {
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             return IndexOf(source, value, startIndex, source.Length - startIndex, options);
@@ -754,7 +754,7 @@ namespace System.Globalization {
         {
             // Validate inputs
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
 
             if (startIndex < 0 || startIndex > source.Length)
                 throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_Index"));
@@ -787,9 +787,9 @@ namespace System.Globalization {
         {
             // Validate inputs
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
 
             if (startIndex > source.Length)
             {
@@ -851,7 +851,7 @@ namespace System.Globalization {
         public unsafe virtual int LastIndexOf(String source, char value)
         {
             if (source==null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             // Can't start at negative index, so make sure we check for the length == 0 case.
@@ -863,7 +863,7 @@ namespace System.Globalization {
         public virtual int LastIndexOf(String source, String value)
         {
             if (source==null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             // Can't start at negative index, so make sure we check for the length == 0 case.
@@ -875,7 +875,7 @@ namespace System.Globalization {
         public virtual int LastIndexOf(String source, char value, CompareOptions options)
         {
             if (source==null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             // Can't start at negative index, so make sure we check for the length == 0 case.
@@ -886,7 +886,7 @@ namespace System.Globalization {
         public unsafe virtual int LastIndexOf(String source, String value, CompareOptions options)
         {
             if (source==null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             // Can't start at negative index, so make sure we check for the length == 0 case.
@@ -936,7 +936,7 @@ namespace System.Globalization {
         {
             // Verify Arguments
             if (source==null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             Contract.EndContractBlock();
 
             // Validate CompareOptions
@@ -985,9 +985,9 @@ namespace System.Globalization {
         {
             // Verify Arguments
             if (source == null)
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             Contract.EndContractBlock();
 
             // Validate CompareOptions
@@ -1056,7 +1056,7 @@ namespace System.Globalization {
         [System.Security.SecuritySafeCritical]
         private SortKey CreateSortKey(String source, CompareOptions options)
         {
-            if (source==null) { throw new ArgumentNullException("source"); }
+            if (source==null) { throw new ArgumentNullException(nameof(source)); }
             Contract.EndContractBlock();
 
             // Mask used to check if we have the right flags.
@@ -1159,7 +1159,7 @@ namespace System.Globalization {
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
 
             if (options == CompareOptions.Ordinal)
@@ -1217,7 +1217,7 @@ namespace System.Globalization {
             //
             if(null == source)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
 
             if ((options & ValidHashCodeOfStringMaskOffFlags) != 0)
index d620d2d..8dabb0a 100644 (file)
@@ -323,7 +323,7 @@ namespace System.Globalization {
 
         public CultureInfo(String name, bool useUserOverride) {
             if (name==null) {
-                throw new ArgumentNullException("name",
+                throw new ArgumentNullException(nameof(name),
                     Environment.GetResourceString("ArgumentNull_String"));
             }
             Contract.EndContractBlock();
@@ -540,7 +540,7 @@ namespace System.Globalization {
         internal CultureInfo(String cultureName, String textAndCompareCultureName)
         {
             if (cultureName==null) {
-                throw new ArgumentNullException("cultureName",
+                throw new ArgumentNullException(nameof(cultureName),
                     Environment.GetResourceString("ArgumentNull_String"));
             }
             Contract.EndContractBlock();
@@ -701,7 +701,7 @@ namespace System.Globalization {
             set {
 #if FEATURE_APPX
                     if (value == null) {
-                        throw new ArgumentNullException("value");
+                        throw new ArgumentNullException(nameof(value));
                     }                    
 
                     if (AppDomain.IsAppXModel()) {
@@ -799,7 +799,7 @@ namespace System.Globalization {
             set {
 #if FEATURE_APPX
                     if (value == null) {
-                        throw new ArgumentNullException("value");
+                        throw new ArgumentNullException(nameof(value));
                     }                    
 
                     if (AppDomain.IsAppXModel()) {
@@ -1357,7 +1357,7 @@ namespace System.Globalization {
             }
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_Obj"));
                 }
                 Contract.EndContractBlock();
@@ -1393,7 +1393,7 @@ namespace System.Globalization {
 
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_Obj"));
                 }
                 Contract.EndContractBlock();
@@ -1595,7 +1595,7 @@ namespace System.Globalization {
 
         public static CultureInfo ReadOnly(CultureInfo ci) {
             if (ci == null) {
-                throw new ArgumentNullException("ci");
+                throw new ArgumentNullException(nameof(ci));
             }
             Contract.Ensures(Contract.Result<CultureInfo>() != null);
             Contract.EndContractBlock();
@@ -1849,7 +1849,7 @@ namespace System.Globalization {
             // Make sure we have a valid, non-zero length string as name
             if (name == null)
             {
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             }
             Contract.Ensures(Contract.Result<CultureInfo>() != null);
             Contract.EndContractBlock();
@@ -1871,12 +1871,12 @@ namespace System.Globalization {
             // Make sure we have a valid, non-zero length string as name
             if (null == name)
             {
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             }
 
             if (null == altName)
             {
-                throw new ArgumentNullException("altName");
+                throw new ArgumentNullException(nameof(altName));
             }
             Contract.Ensures(Contract.Result<CultureInfo>() != null);
             Contract.EndContractBlock();
index 0486cc9..9b5264f 100644 (file)
@@ -69,7 +69,7 @@ namespace System.Globalization {
         [System.Security.SecurityCritical]  // auto-generated_required
         public override void GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
             base.GetObjectData(info, context);
index 00c2d1f..8bf8460 100644 (file)
@@ -582,7 +582,7 @@ namespace System.Globalization {
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null)
                 {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -604,7 +604,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_Obj"));
                 }
                 Contract.EndContractBlock();
@@ -718,7 +718,7 @@ namespace System.Globalization {
 
         public  int GetEra(String eraName) {
             if (eraName == null) {
-                throw new ArgumentNullException("eraName",
+                throw new ArgumentNullException(nameof(eraName),
                     Environment.GetResourceString("ArgumentNull_String"));
             }
             Contract.EndContractBlock();
@@ -862,7 +862,7 @@ namespace System.Globalization {
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) 
                 {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -945,7 +945,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -977,7 +977,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -1016,7 +1016,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -1053,7 +1053,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -1084,7 +1084,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -1128,7 +1128,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null)
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_String"));
                 Contract.EndContractBlock();
 
@@ -1168,7 +1168,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -1308,7 +1308,7 @@ namespace System.Globalization {
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) 
                 {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -1349,7 +1349,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -1388,7 +1388,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_Array"));
                 }
                 if (value.Length != 7) {
@@ -1416,7 +1416,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_Array"));
                 }
                 if (value.Length != 7)
@@ -1441,7 +1441,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_Array"));
                 }
                 if (value.Length != 7)
@@ -1466,7 +1466,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_Array"));
                 }
                 if (value.Length != 13)
@@ -1492,7 +1492,7 @@ namespace System.Globalization {
                 if (IsReadOnly)
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null) {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_Array"));
                 }
                 if (value.Length != 13)
@@ -1977,7 +1977,7 @@ namespace System.Globalization {
 
         public static DateTimeFormatInfo ReadOnly(DateTimeFormatInfo dtfi) {
             if (dtfi == null) {
-                throw new ArgumentNullException("dtfi",
+                throw new ArgumentNullException(nameof(dtfi),
                     Environment.GetResourceString("ArgumentNull_Obj"));
             }
             Contract.EndContractBlock();
@@ -2038,7 +2038,7 @@ namespace System.Globalization {
             if (IsReadOnly)
                 throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
             if (patterns == null) {
-                throw new ArgumentNullException("patterns",
+                throw new ArgumentNullException(nameof(patterns),
                     Environment.GetResourceString("ArgumentNull_Array"));
             }
 
@@ -2109,7 +2109,7 @@ namespace System.Globalization {
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null)
                 {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_Array"));
                 }
                 if (value.Length != 13)
@@ -2137,7 +2137,7 @@ namespace System.Globalization {
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
                 if (value == null)
                 {
-                    throw new ArgumentNullException("value",
+                    throw new ArgumentNullException(nameof(value),
                         Environment.GetResourceString("ArgumentNull_Array"));
                 }
                 if (value.Length != 13)
index cdda9ea..d8f6310 100644 (file)
@@ -136,7 +136,7 @@ namespace System.Globalization
         internal static int GetCodePageFromName(String name)
         {   
             if (name==null) {
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             }
             Contract.EndContractBlock();
 
index 599a32a..d64dcd9 100644 (file)
@@ -125,7 +125,7 @@ namespace System.Globalization
 
         public String GetAscii(String unicode, int index)
         {
-            if (unicode==null) throw new ArgumentNullException("unicode");
+            if (unicode==null) throw new ArgumentNullException(nameof(unicode));
             Contract.EndContractBlock();
             return GetAscii(unicode, index, unicode.Length - index);
         }
@@ -133,7 +133,7 @@ namespace System.Globalization
         public String GetAscii(String unicode, int index, int count)
         {
             throw null;
-            /*if (unicode==null) throw new ArgumentNullException("unicode");
+            /*if (unicode==null) throw new ArgumentNullException(nameof(unicode));
             if (index < 0 || count < 0)
                 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count",
                       Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
@@ -249,14 +249,14 @@ namespace System.Globalization
 
         public String GetUnicode(String ascii, int index)
         {
-            if (ascii==null) throw new ArgumentNullException("ascii");
+            if (ascii==null) throw new ArgumentNullException(nameof(ascii));
             Contract.EndContractBlock();
             return GetUnicode(ascii, index, ascii.Length - index);
         }
 
         public String GetUnicode(String ascii, int index, int count)
         {
-            if (ascii==null) throw new ArgumentNullException("ascii");
+            if (ascii==null) throw new ArgumentNullException(nameof(ascii));
             if (index < 0 || count < 0)
                 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count",
                       Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
index fae91c2..9b8d6d8 100644 (file)
@@ -376,7 +376,7 @@ namespace System.Globalization {
             }
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("CurrencyGroupSizes",
+                    throw new ArgumentNullException(nameof(CurrencyGroupSizes),
                         Environment.GetResourceString("ArgumentNull_Obj"));
                 }
                 Contract.EndContractBlock();
@@ -397,7 +397,7 @@ namespace System.Globalization {
             }
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("NumberGroupSizes",
+                    throw new ArgumentNullException(nameof(NumberGroupSizes),
                         Environment.GetResourceString("ArgumentNull_Obj"));
                 }
                 Contract.EndContractBlock();
@@ -416,7 +416,7 @@ namespace System.Globalization {
             }
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("PercentGroupSizes",
+                    throw new ArgumentNullException(nameof(PercentGroupSizes),
                         Environment.GetResourceString("ArgumentNull_Obj"));
                 }
                 Contract.EndContractBlock();
@@ -443,7 +443,7 @@ namespace System.Globalization {
             get { return currencySymbol; }
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("CurrencySymbol",
+                    throw new ArgumentNullException(nameof(CurrencySymbol),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -475,7 +475,7 @@ namespace System.Globalization {
             }
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("NaNSymbol",
+                    throw new ArgumentNullException(nameof(NaNSymbol),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -577,7 +577,7 @@ namespace System.Globalization {
             }
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("NegativeInfinitySymbol",
+                    throw new ArgumentNullException(nameof(NegativeInfinitySymbol),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -591,7 +591,7 @@ namespace System.Globalization {
             get { return negativeSign; }
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("NegativeSign",
+                    throw new ArgumentNullException(nameof(NegativeSign),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -665,7 +665,7 @@ namespace System.Globalization {
             }
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("PositiveInfinitySymbol",
+                    throw new ArgumentNullException(nameof(PositiveInfinitySymbol),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -679,7 +679,7 @@ namespace System.Globalization {
             get { return positiveSign; }
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("PositiveSign",
+                    throw new ArgumentNullException(nameof(PositiveSign),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -734,7 +734,7 @@ namespace System.Globalization {
             }
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("PercentSymbol",
+                    throw new ArgumentNullException(nameof(PercentSymbol),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -748,7 +748,7 @@ namespace System.Globalization {
             get { return perMilleSymbol; }
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("PerMilleSymbol",
+                    throw new ArgumentNullException(nameof(PerMilleSymbol),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -788,7 +788,7 @@ namespace System.Globalization {
 
         public static NumberFormatInfo ReadOnly(NumberFormatInfo nfi) {
             if (nfi == null) {
-                throw new ArgumentNullException("nfi");
+                throw new ArgumentNullException(nameof(nfi));
             }
             Contract.EndContractBlock();
             if (nfi.IsReadOnly) {
index f06d63f..a1a4a54 100644 (file)
@@ -62,7 +62,7 @@ namespace System.Globalization {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public RegionInfo(String name) {
             if (name==null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
 
             if (name.Length == 0) //The InvariantCulture has no matching region
             { 
index e3308dc..62207c2 100644 (file)
@@ -119,7 +119,7 @@ namespace System.Globalization {
         public static int Compare(SortKey sortkey1, SortKey sortkey2) {
     
             if (sortkey1==null || sortkey2==null) {
-                throw new ArgumentNullException((sortkey1==null ? "sortkey1": "sortkey2"));
+                throw new ArgumentNullException((sortkey1==null ? nameof(sortkey1): nameof(sortkey2)));
             }
             Contract.EndContractBlock();
     
index b1151bd..b4af57d 100644 (file)
@@ -92,7 +92,7 @@ namespace System.Globalization {
             }
             set {
                 if (null == value) {
-                    throw new ArgumentNullException("String",
+                    throw new ArgumentNullException(nameof(String),
                         Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
@@ -268,7 +268,7 @@ namespace System.Globalization {
             // Validate parameters.
             //
             if (str==null) {
-                throw new ArgumentNullException("str");
+                throw new ArgumentNullException(nameof(str));
             }
             Contract.EndContractBlock();
         
@@ -297,7 +297,7 @@ namespace System.Globalization {
             //
             if (str==null) 
             {
-                throw new ArgumentNullException("str");
+                throw new ArgumentNullException(nameof(str));
             }
             Contract.EndContractBlock();
         
@@ -326,7 +326,7 @@ namespace System.Globalization {
         {
             if (str == null)
             {
-                throw new ArgumentNullException("str");
+                throw new ArgumentNullException(nameof(str));
             }
             Contract.EndContractBlock();
             
index 9b84486..4fa9f66 100644 (file)
@@ -462,7 +462,7 @@ namespace System.Globalization {
         [System.Runtime.InteropServices.ComVisible(false)]
         public static TextInfo ReadOnly(TextInfo textInfo) 
         {
-            if (textInfo == null)       { throw new ArgumentNullException("textInfo"); }
+            if (textInfo == null)       { throw new ArgumentNullException(nameof(textInfo)); }
             Contract.EndContractBlock();
             if (textInfo.IsReadOnly)    { return (textInfo); }
             
@@ -512,7 +512,7 @@ namespace System.Globalization {
             {
                 if (value == null) 
                 {
-                    throw new ArgumentNullException("value", Environment.GetResourceString("ArgumentNull_String"));
+                    throw new ArgumentNullException(nameof(value), Environment.GetResourceString("ArgumentNull_String"));
                 }
                 Contract.EndContractBlock();
                 VerifyWritable();
@@ -542,7 +542,7 @@ namespace System.Globalization {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public unsafe virtual String ToLower(String str) 
         {
-            if (str == null) { throw new ArgumentNullException("str"); }
+            if (str == null) { throw new ArgumentNullException(nameof(str)); }
             Contract.EndContractBlock();
 
             return InternalChangeCaseString(this.m_dataHandle, this.m_handleOrigin, this.m_textInfoName, str, false);
@@ -581,7 +581,7 @@ namespace System.Globalization {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public unsafe virtual String ToUpper(String str) 
         {
-            if (str == null) { throw new ArgumentNullException("str"); }
+            if (str == null) { throw new ArgumentNullException(nameof(str)); }
             Contract.EndContractBlock();
             return InternalChangeCaseString(this.m_dataHandle, this.m_handleOrigin, this.m_textInfoName, str, true);
         }
@@ -698,7 +698,7 @@ namespace System.Globalization {
         {
             if (str == null)  
             {
-                throw new ArgumentNullException("str");
+                throw new ArgumentNullException(nameof(str));
             }
             Contract.EndContractBlock();
             if (str.Length == 0) 
@@ -959,7 +959,7 @@ namespace System.Globalization {
             // Validate inputs
             if (str==null) 
             {
-                 throw new ArgumentNullException("str");
+                 throw new ArgumentNullException(nameof(str));
             }
             Contract.EndContractBlock();
 
index 1ccabeb..ce51199 100644 (file)
@@ -47,7 +47,7 @@ namespace System {
         public Guid(byte[] b)
         {
             if (b==null)
-                throw new ArgumentNullException("b");
+                throw new ArgumentNullException(nameof(b));
             if (b.Length != 16)
                 throw new ArgumentException(Environment.GetResourceString("Arg_GuidArrayCtor", "16"), "b");
             Contract.EndContractBlock();
@@ -87,7 +87,7 @@ namespace System {
         public Guid(int a, short b, short c, byte[] d)
         {
             if (d==null)
-                throw new ArgumentNullException("d");
+                throw new ArgumentNullException(nameof(d));
             // Check that array is not too big
             if(d.Length != 8)
                 throw new ArgumentException(Environment.GetResourceString("Arg_GuidArrayCtor", "8"), "d");
@@ -231,7 +231,7 @@ namespace System {
         public Guid(String g)
         {
             if (g==null) {
-                throw new ArgumentNullException("g");
+                throw new ArgumentNullException(nameof(g));
             }
             Contract.EndContractBlock();
             this = Guid.Empty;
@@ -250,7 +250,7 @@ namespace System {
         public static Guid Parse(String input)
         {
             if (input == null) {
-                throw new ArgumentNullException("input");
+                throw new ArgumentNullException(nameof(input));
             }
             Contract.EndContractBlock();
 
@@ -281,10 +281,10 @@ namespace System {
         public static Guid ParseExact(String input, String format)
         {
             if (input == null)
-                throw new ArgumentNullException("input");
+                throw new ArgumentNullException(nameof(input));
 
             if (format == null)
-                throw new ArgumentNullException("format");
+                throw new ArgumentNullException(nameof(format));
 
             if( format.Length != 1) {
                 // all acceptable format strings are of length 1
index 8accf0b..327227b 100644 (file)
@@ -48,10 +48,10 @@ namespace System.IO {
 
         public BinaryReader(Stream input, Encoding encoding, bool leaveOpen) {
             if (input==null) {
-                throw new ArgumentNullException("input");
+                throw new ArgumentNullException(nameof(input));
             }
             if (encoding==null) {
-                throw new ArgumentNullException("encoding");
+                throw new ArgumentNullException(nameof(encoding));
             }
             if (!input.CanRead)
                 throw new ArgumentException(Environment.GetResourceString("Argument_StreamNotReadable"));
@@ -297,7 +297,7 @@ namespace System.IO {
         [SecuritySafeCritical]
         public virtual int Read(char[] buffer, int index, int count) {
             if (buffer==null) {
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             }
             if (index < 0) {
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
@@ -502,7 +502,7 @@ namespace System.IO {
 
         public virtual int Read(byte[] buffer, int index, int count) {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
index c775cbc..3aa7e9b 100644 (file)
@@ -73,9 +73,9 @@ namespace System.IO {
         public BinaryWriter(Stream output, Encoding encoding, bool leaveOpen)
         {
             if (output==null)
-                throw new ArgumentNullException("output");
+                throw new ArgumentNullException(nameof(output));
             if (encoding==null)
-                throw new ArgumentNullException("encoding");
+                throw new ArgumentNullException(nameof(encoding));
             if (!output.CanWrite)
                 throw new ArgumentException(Environment.GetResourceString("Argument_StreamNotWritable"));
             Contract.EndContractBlock();
@@ -166,7 +166,7 @@ namespace System.IO {
         // 
         public virtual void Write(byte[] buffer) {
             if (buffer == null)
-                throw new ArgumentNullException("buffer");
+                throw new ArgumentNullException(nameof(buffer));
             Contract.EndContractBlock();
             OutStream.Write(buffer, 0, buffer.Length);
         }
@@ -207,7 +207,7 @@ namespace System.IO {
         public virtual void Write(char[] chars) 
         {
             if (chars == null)
-                throw new ArgumentNullException("chars");
+                throw new ArgumentNullException(nameof(chars));
             Contract.EndContractBlock();
 
             byte[] bytes = _encoding.GetBytes(chars, 0, chars.Length);
@@ -353,7 +353,7 @@ namespace System.IO {
         public unsafe virtual void Write(String value) 
         {
             if (value==null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             Contract.EndContractBlock();
 
             int len = _encoding.GetByteCount(value);
index be74538..3c4774b 100644 (file)
@@ -39,7 +39,7 @@ namespace System.IO {
         public static DirectoryInfo GetParent(String path)
         {
             if (path==null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
 
             if (path.Length==0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_PathEmpty"), "path");
@@ -56,7 +56,7 @@ namespace System.IO {
         [System.Security.SecuritySafeCritical]
         public static DirectoryInfo CreateDirectory(String path) {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_PathEmpty"));
             Contract.EndContractBlock();
@@ -68,7 +68,7 @@ namespace System.IO {
         internal static DirectoryInfo UnsafeCreateDirectory(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_PathEmpty"));
             Contract.EndContractBlock();
@@ -109,7 +109,7 @@ namespace System.IO {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public static DirectoryInfo CreateDirectory(String path, DirectorySecurity directorySecurity) {
             if (path==null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_PathEmpty"));
             Contract.EndContractBlock();
@@ -506,7 +506,7 @@ namespace System.IO {
         public static void SetAccessControl(String path, DirectorySecurity directorySecurity)
         {
             if (directorySecurity == null)
-                throw new ArgumentNullException("directorySecurity");
+                throw new ArgumentNullException(nameof(directorySecurity));
             Contract.EndContractBlock();
 
             String fullPath = Path.GetFullPathInternal(path);
@@ -518,7 +518,7 @@ namespace System.IO {
         public static String[] GetFiles(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.Ensures(Contract.Result<String[]>() != null);
             Contract.EndContractBlock();
 
@@ -530,9 +530,9 @@ namespace System.IO {
         public static String[] GetFiles(String path, String searchPattern)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             Contract.Ensures(Contract.Result<String[]>() != null);
             Contract.EndContractBlock();
 
@@ -544,9 +544,9 @@ namespace System.IO {
         public static String[] GetFiles(String path, String searchPattern, SearchOption searchOption)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                 throw new ArgumentOutOfRangeException("searchOption", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
             Contract.Ensures(Contract.Result<String[]>() != null);
@@ -580,7 +580,7 @@ namespace System.IO {
         public static String[] GetDirectories(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.Ensures(Contract.Result<String[]>() != null);
             Contract.EndContractBlock();
 
@@ -592,9 +592,9 @@ namespace System.IO {
         public static String[] GetDirectories(String path, String searchPattern)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             Contract.Ensures(Contract.Result<String[]>() != null);
             Contract.EndContractBlock();
 
@@ -606,9 +606,9 @@ namespace System.IO {
         public static String[] GetDirectories(String path, String searchPattern, SearchOption searchOption)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                 throw new ArgumentOutOfRangeException("searchOption", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
             Contract.Ensures(Contract.Result<String[]>() != null);
@@ -644,7 +644,7 @@ namespace System.IO {
         public static String[] GetFileSystemEntries(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.Ensures(Contract.Result<String[]>() != null);
             Contract.EndContractBlock();
 
@@ -656,9 +656,9 @@ namespace System.IO {
         public static String[] GetFileSystemEntries(String path, String searchPattern)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             Contract.Ensures(Contract.Result<String[]>() != null);
             Contract.EndContractBlock();
 
@@ -670,9 +670,9 @@ namespace System.IO {
         public static String[] GetFileSystemEntries(String path, String searchPattern, SearchOption searchOption)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                 throw new ArgumentOutOfRangeException("searchOption", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
             Contract.Ensures(Contract.Result<String[]>() != null);
@@ -734,7 +734,7 @@ namespace System.IO {
         public static IEnumerable<String> EnumerateDirectories(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
 
             return InternalEnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly);
@@ -743,9 +743,9 @@ namespace System.IO {
         public static IEnumerable<String> EnumerateDirectories(String path, String searchPattern)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             Contract.EndContractBlock();
 
             return InternalEnumerateDirectories(path, searchPattern, SearchOption.TopDirectoryOnly);
@@ -754,9 +754,9 @@ namespace System.IO {
         public static IEnumerable<String> EnumerateDirectories(String path, String searchPattern, SearchOption searchOption)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                 throw new ArgumentOutOfRangeException("searchOption", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
             Contract.EndContractBlock();
@@ -776,7 +776,7 @@ namespace System.IO {
         public static IEnumerable<String> EnumerateFiles(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.Ensures(Contract.Result<IEnumerable<String>>() != null);
             Contract.EndContractBlock();
 
@@ -786,9 +786,9 @@ namespace System.IO {
         public static IEnumerable<String> EnumerateFiles(String path, String searchPattern)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             Contract.Ensures(Contract.Result<IEnumerable<String>>() != null);
             Contract.EndContractBlock();
 
@@ -798,9 +798,9 @@ namespace System.IO {
         public static IEnumerable<String> EnumerateFiles(String path, String searchPattern, SearchOption searchOption)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                 throw new ArgumentOutOfRangeException("searchOption", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
             Contract.Ensures(Contract.Result<IEnumerable<String>>() != null);
@@ -822,7 +822,7 @@ namespace System.IO {
         public static IEnumerable<String> EnumerateFileSystemEntries(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.Ensures(Contract.Result<IEnumerable<String>>() != null);
             Contract.EndContractBlock();
 
@@ -832,9 +832,9 @@ namespace System.IO {
         public static IEnumerable<String> EnumerateFileSystemEntries(String path, String searchPattern)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             Contract.Ensures(Contract.Result<IEnumerable<String>>() != null);
             Contract.EndContractBlock();
 
@@ -844,9 +844,9 @@ namespace System.IO {
         public static IEnumerable<String> EnumerateFileSystemEntries(String path, String searchPattern, SearchOption searchOption)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                 throw new ArgumentOutOfRangeException("searchOption", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
             Contract.Ensures(Contract.Result<IEnumerable<String>>() != null);
@@ -917,7 +917,7 @@ namespace System.IO {
         [System.Security.SecuritySafeCritical]
         public static String GetDirectoryRoot(String path) {
             if (path==null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
             
             String fullPath = Path.GetFullPathInternal(path);
@@ -1087,12 +1087,12 @@ namespace System.IO {
         [System.Security.SecurityCritical]
         private static void InternalMove(String sourceDirName,String destDirName,bool checkHost) {
             if (sourceDirName==null)
-                throw new ArgumentNullException("sourceDirName");
+                throw new ArgumentNullException(nameof(sourceDirName));
             if (sourceDirName.Length==0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "sourceDirName");
             
             if (destDirName==null)
-                throw new ArgumentNullException("destDirName");
+                throw new ArgumentNullException(nameof(destDirName));
             if (destDirName.Length==0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "destDirName");
             Contract.EndContractBlock();
index f7b0709..59c2c90 100644 (file)
@@ -51,7 +51,7 @@ namespace System.IO {
         public static DirectoryInfo UnsafeCreateDirectoryInfo(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
 
             DirectoryInfo di = new DirectoryInfo();
@@ -64,7 +64,7 @@ namespace System.IO {
         public DirectoryInfo(String path)
         {
             if (path==null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
 
             Init(path, true);
@@ -167,7 +167,7 @@ namespace System.IO {
 #endif
         public DirectoryInfo CreateSubdirectory(String path) {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
 
             return CreateSubdirectory(path, null);
@@ -186,7 +186,7 @@ namespace System.IO {
         public DirectoryInfo CreateSubdirectory(String path, Object directorySecurity)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
 
             return CreateSubdirectoryHelper(path, directorySecurity);
@@ -280,7 +280,7 @@ namespace System.IO {
         public FileInfo[] GetFiles(String searchPattern)
         {
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             Contract.EndContractBlock();
 
             return InternalGetFiles(searchPattern, SearchOption.TopDirectoryOnly);
@@ -291,7 +291,7 @@ namespace System.IO {
         public FileInfo[] GetFiles(String searchPattern, SearchOption searchOption)
         {
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                 throw new ArgumentOutOfRangeException("searchOption", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
             Contract.EndContractBlock();
@@ -328,7 +328,7 @@ namespace System.IO {
         public FileSystemInfo[] GetFileSystemInfos(String searchPattern)
         {
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             Contract.EndContractBlock();
 
             return InternalGetFileSystemInfos(searchPattern, SearchOption.TopDirectoryOnly);
@@ -339,7 +339,7 @@ namespace System.IO {
         public FileSystemInfo[] GetFileSystemInfos(String searchPattern, SearchOption searchOption)
         {
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                 throw new ArgumentOutOfRangeException("searchOption", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
             Contract.EndContractBlock();
@@ -372,7 +372,7 @@ namespace System.IO {
         public DirectoryInfo[] GetDirectories(String searchPattern)
         {
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             Contract.EndContractBlock();
 
             return InternalGetDirectories(searchPattern, SearchOption.TopDirectoryOnly);
@@ -384,7 +384,7 @@ namespace System.IO {
         public DirectoryInfo[] GetDirectories(String searchPattern, SearchOption searchOption)
         {
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                 throw new ArgumentOutOfRangeException("searchOption", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
             Contract.EndContractBlock();
@@ -413,7 +413,7 @@ namespace System.IO {
         public IEnumerable<DirectoryInfo> EnumerateDirectories(String searchPattern)
         {
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             Contract.EndContractBlock();
 
             return InternalEnumerateDirectories(searchPattern, SearchOption.TopDirectoryOnly);
@@ -422,7 +422,7 @@ namespace System.IO {
         public IEnumerable<DirectoryInfo> EnumerateDirectories(String searchPattern, SearchOption searchOption)
         {
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                 throw new ArgumentOutOfRangeException("searchOption", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
             Contract.EndContractBlock();
@@ -446,7 +446,7 @@ namespace System.IO {
         public IEnumerable<FileInfo> EnumerateFiles(String searchPattern)
         {
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             Contract.EndContractBlock();
 
             return InternalEnumerateFiles(searchPattern, SearchOption.TopDirectoryOnly);
@@ -455,7 +455,7 @@ namespace System.IO {
         public IEnumerable<FileInfo> EnumerateFiles(String searchPattern, SearchOption searchOption)
         {
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                 throw new ArgumentOutOfRangeException("searchOption", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
             Contract.EndContractBlock();
@@ -479,7 +479,7 @@ namespace System.IO {
         public IEnumerable<FileSystemInfo> EnumerateFileSystemInfos(String searchPattern)
         {
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             Contract.EndContractBlock();
 
             return InternalEnumerateFileSystemInfos(searchPattern, SearchOption.TopDirectoryOnly);
@@ -488,7 +488,7 @@ namespace System.IO {
         public IEnumerable<FileSystemInfo> EnumerateFileSystemInfos(String searchPattern, SearchOption searchOption)
         {
             if (searchPattern == null)
-                throw new ArgumentNullException("searchPattern");
+                throw new ArgumentNullException(nameof(searchPattern));
             if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
                 throw new ArgumentOutOfRangeException("searchOption", Environment.GetResourceString("ArgumentOutOfRange_Enum"));
             Contract.EndContractBlock();
@@ -536,7 +536,7 @@ namespace System.IO {
         [System.Security.SecuritySafeCritical]
         public void MoveTo(String destDirName) {
             if (destDirName==null)
-                throw new ArgumentNullException("destDirName");
+                throw new ArgumentNullException(nameof(destDirName));
             if (destDirName.Length==0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "destDirName");
             Contract.EndContractBlock();
index be75e89..62eac42 100644 (file)
@@ -57,7 +57,7 @@ namespace System.IO
         public DriveInfo(String driveName) 
         {
             if (driveName == null)
-                throw new ArgumentNullException("driveName");
+                throw new ArgumentNullException(nameof(driveName));
             Contract.EndContractBlock();
             if (driveName.Length == 1)
                 _name = driveName + ":\\";
index cfcb469..78e4524 100644 (file)
@@ -41,7 +41,7 @@ namespace System.IO {
         public static StreamReader OpenText(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
             return new StreamReader(path);
         }
@@ -49,7 +49,7 @@ namespace System.IO {
         public static StreamWriter CreateText(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
             return new StreamWriter(path,false);
         }
@@ -57,7 +57,7 @@ namespace System.IO {
         public static StreamWriter AppendText(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
             return new StreamWriter(path,true);
         }
@@ -74,9 +74,9 @@ namespace System.IO {
         // 
         public static void Copy(String sourceFileName, String destFileName) {
             if (sourceFileName == null)
-                throw new ArgumentNullException("sourceFileName", Environment.GetResourceString("ArgumentNull_FileName"));
+                throw new ArgumentNullException(nameof(sourceFileName), Environment.GetResourceString("ArgumentNull_FileName"));
             if (destFileName == null)
-                throw new ArgumentNullException("destFileName", Environment.GetResourceString("ArgumentNull_FileName"));
+                throw new ArgumentNullException(nameof(destFileName), Environment.GetResourceString("ArgumentNull_FileName"));
             if (sourceFileName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "sourceFileName");
             if (destFileName.Length == 0)
@@ -97,9 +97,9 @@ namespace System.IO {
         // 
         public static void Copy(String sourceFileName, String destFileName, bool overwrite) {
             if (sourceFileName == null)
-                throw new ArgumentNullException("sourceFileName", Environment.GetResourceString("ArgumentNull_FileName"));
+                throw new ArgumentNullException(nameof(sourceFileName), Environment.GetResourceString("ArgumentNull_FileName"));
             if (destFileName == null)
-                throw new ArgumentNullException("destFileName", Environment.GetResourceString("ArgumentNull_FileName"));
+                throw new ArgumentNullException(nameof(destFileName), Environment.GetResourceString("ArgumentNull_FileName"));
             if (sourceFileName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "sourceFileName");
             if (destFileName.Length == 0)
@@ -112,9 +112,9 @@ namespace System.IO {
         [System.Security.SecurityCritical]
         internal static void UnsafeCopy(String sourceFileName, String destFileName, bool overwrite) {
             if (sourceFileName == null)
-                throw new ArgumentNullException("sourceFileName", Environment.GetResourceString("ArgumentNull_FileName"));
+                throw new ArgumentNullException(nameof(sourceFileName), Environment.GetResourceString("ArgumentNull_FileName"));
             if (destFileName == null)
-                throw new ArgumentNullException("destFileName", Environment.GetResourceString("ArgumentNull_FileName"));
+                throw new ArgumentNullException(nameof(destFileName), Environment.GetResourceString("ArgumentNull_FileName"));
             if (sourceFileName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "sourceFileName");
             if (destFileName.Length == 0)
@@ -225,7 +225,7 @@ namespace System.IO {
         [System.Security.SecuritySafeCritical]
         public static void Delete(String path) {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
             
             InternalDelete(path, true);
@@ -235,7 +235,7 @@ namespace System.IO {
         internal static void UnsafeDelete(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
 
             InternalDelete(path, false);
@@ -272,7 +272,7 @@ namespace System.IO {
         public static void Decrypt(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
 
             String fullPath = Path.GetFullPathInternal(path);
@@ -296,7 +296,7 @@ namespace System.IO {
         public static void Encrypt(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
 
             String fullPath = Path.GetFullPathInternal(path);
@@ -617,7 +617,7 @@ namespace System.IO {
         public static void SetAccessControl(String path, FileSecurity fileSecurity)
         {
             if (fileSecurity == null)
-                throw new ArgumentNullException("fileSecurity");
+                throw new ArgumentNullException(nameof(fileSecurity));
             Contract.EndContractBlock();
 
             String fullPath = Path.GetFullPathInternal(path);
@@ -640,7 +640,7 @@ namespace System.IO {
         public static String ReadAllText(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -652,9 +652,9 @@ namespace System.IO {
         public static String ReadAllText(String path, Encoding encoding)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (encoding == null)
-                throw new ArgumentNullException("encoding");
+                throw new ArgumentNullException(nameof(encoding));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -666,7 +666,7 @@ namespace System.IO {
         internal static String UnsafeReadAllText(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -689,7 +689,7 @@ namespace System.IO {
         public static void WriteAllText(String path, String contents)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -701,9 +701,9 @@ namespace System.IO {
         public static void WriteAllText(String path, String contents, Encoding encoding)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (encoding == null)
-                throw new ArgumentNullException("encoding");
+                throw new ArgumentNullException(nameof(encoding));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -715,7 +715,7 @@ namespace System.IO {
         internal static void UnsafeWriteAllText(String path, String contents)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -775,11 +775,11 @@ namespace System.IO {
         public static void WriteAllBytes(String path, byte[] bytes)
         {
             if (path == null)
-                throw new ArgumentNullException("path", Environment.GetResourceString("ArgumentNull_Path"));
+                throw new ArgumentNullException(nameof(path), Environment.GetResourceString("ArgumentNull_Path"));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             if (bytes == null)
-                throw new ArgumentNullException("bytes");
+                throw new ArgumentNullException(nameof(bytes));
             Contract.EndContractBlock();
 
             InternalWriteAllBytes(path, bytes, true);
@@ -789,11 +789,11 @@ namespace System.IO {
         internal static void UnsafeWriteAllBytes(String path, byte[] bytes)
         {
             if (path == null)
-                throw new ArgumentNullException("path", Environment.GetResourceString("ArgumentNull_Path"));
+                throw new ArgumentNullException(nameof(path), Environment.GetResourceString("ArgumentNull_Path"));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             if (bytes == null)
-                throw new ArgumentNullException("bytes");
+                throw new ArgumentNullException(nameof(bytes));
             Contract.EndContractBlock();
 
             InternalWriteAllBytes(path, bytes, false);
@@ -816,7 +816,7 @@ namespace System.IO {
         public static String[] ReadAllLines(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -827,9 +827,9 @@ namespace System.IO {
         public static String[] ReadAllLines(String path, Encoding encoding)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (encoding == null)
-                throw new ArgumentNullException("encoding");
+                throw new ArgumentNullException(nameof(encoding));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -856,7 +856,7 @@ namespace System.IO {
         public static IEnumerable<String> ReadLines(String path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"), "path");
             Contract.EndContractBlock();
@@ -867,9 +867,9 @@ namespace System.IO {
         public static IEnumerable<String> ReadLines(String path, Encoding encoding)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (encoding == null)
-                throw new ArgumentNullException("encoding");
+                throw new ArgumentNullException(nameof(encoding));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"), "path");
             Contract.EndContractBlock();
@@ -880,9 +880,9 @@ namespace System.IO {
         public static void WriteAllLines(String path, String[] contents)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (contents == null)
-                throw new ArgumentNullException("contents");
+                throw new ArgumentNullException(nameof(contents));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -893,11 +893,11 @@ namespace System.IO {
         public static void WriteAllLines(String path, String[] contents, Encoding encoding)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (contents == null)
-                throw new ArgumentNullException("contents");
+                throw new ArgumentNullException(nameof(contents));
             if (encoding == null)
-                throw new ArgumentNullException("encoding");
+                throw new ArgumentNullException(nameof(encoding));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -908,9 +908,9 @@ namespace System.IO {
         public static void WriteAllLines(String path, IEnumerable<String> contents)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (contents == null)
-                throw new ArgumentNullException("contents");
+                throw new ArgumentNullException(nameof(contents));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -921,11 +921,11 @@ namespace System.IO {
         public static void WriteAllLines(String path, IEnumerable<String> contents, Encoding encoding)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (contents == null)
-                throw new ArgumentNullException("contents");
+                throw new ArgumentNullException(nameof(contents));
             if (encoding == null)
-                throw new ArgumentNullException("encoding");
+                throw new ArgumentNullException(nameof(encoding));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -950,7 +950,7 @@ namespace System.IO {
         public static void AppendAllText(String path, String contents)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -961,9 +961,9 @@ namespace System.IO {
         public static void AppendAllText(String path, String contents, Encoding encoding)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (encoding == null)
-                throw new ArgumentNullException("encoding");
+                throw new ArgumentNullException(nameof(encoding));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -984,9 +984,9 @@ namespace System.IO {
         public static void AppendAllLines(String path, IEnumerable<String> contents)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (contents == null)
-                throw new ArgumentNullException("contents");
+                throw new ArgumentNullException(nameof(contents));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -997,11 +997,11 @@ namespace System.IO {
         public static void AppendAllLines(String path, IEnumerable<String> contents, Encoding encoding)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (contents == null)
-                throw new ArgumentNullException("contents");
+                throw new ArgumentNullException(nameof(contents));
             if (encoding == null)
-                throw new ArgumentNullException("encoding");
+                throw new ArgumentNullException(nameof(encoding));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -1030,9 +1030,9 @@ namespace System.IO {
         [System.Security.SecurityCritical]
         private static void InternalMove(String sourceFileName, String destFileName, bool checkHost) {
             if (sourceFileName == null)
-                throw new ArgumentNullException("sourceFileName", Environment.GetResourceString("ArgumentNull_FileName"));
+                throw new ArgumentNullException(nameof(sourceFileName), Environment.GetResourceString("ArgumentNull_FileName"));
             if (destFileName == null)
-                throw new ArgumentNullException("destFileName", Environment.GetResourceString("ArgumentNull_FileName"));
+                throw new ArgumentNullException(nameof(destFileName), Environment.GetResourceString("ArgumentNull_FileName"));
             if (sourceFileName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "sourceFileName");
             if (destFileName.Length == 0)
@@ -1067,9 +1067,9 @@ namespace System.IO {
         public static void Replace(String sourceFileName, String destinationFileName, String destinationBackupFileName)
         {
             if (sourceFileName == null)
-                throw new ArgumentNullException("sourceFileName");
+                throw new ArgumentNullException(nameof(sourceFileName));
             if (destinationFileName == null)
-                throw new ArgumentNullException("destinationFileName");
+                throw new ArgumentNullException(nameof(destinationFileName));
             Contract.EndContractBlock();
 
             InternalReplace(sourceFileName, destinationFileName, destinationBackupFileName, false);
@@ -1078,9 +1078,9 @@ namespace System.IO {
         public static void Replace(String sourceFileName, String destinationFileName, String destinationBackupFileName, bool ignoreMetadataErrors)
         {
             if (sourceFileName == null)
-                throw new ArgumentNullException("sourceFileName");
+                throw new ArgumentNullException(nameof(sourceFileName));
             if (destinationFileName == null)
-                throw new ArgumentNullException("destinationFileName");
+                throw new ArgumentNullException(nameof(destinationFileName));
             Contract.EndContractBlock();
 
             InternalReplace(sourceFileName, destinationFileName, destinationBackupFileName, ignoreMetadataErrors);
index 3ab1a51..073ff56 100644 (file)
@@ -50,7 +50,7 @@ namespace System.IO {
         public static FileInfo UnsafeCreateFileInfo(String fileName)
         {
             if (fileName == null)
-                throw new ArgumentNullException("fileName");
+                throw new ArgumentNullException(nameof(fileName));
             Contract.EndContractBlock();
 
             FileInfo fi = new FileInfo();
@@ -63,7 +63,7 @@ namespace System.IO {
         public FileInfo(String fileName)
         {
             if (fileName == null)
-                throw new ArgumentNullException("fileName");
+                throw new ArgumentNullException(nameof(fileName));
             Contract.EndContractBlock();
 
             Init(fileName, true);
@@ -232,7 +232,7 @@ namespace System.IO {
         // 
         public FileInfo CopyTo(String destFileName) {
             if (destFileName == null)
-                throw new ArgumentNullException("destFileName", Environment.GetResourceString("ArgumentNull_FileName"));
+                throw new ArgumentNullException(nameof(destFileName), Environment.GetResourceString("ArgumentNull_FileName"));
             if (destFileName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "destFileName");
             Contract.EndContractBlock();
@@ -253,7 +253,7 @@ namespace System.IO {
         // 
         public FileInfo CopyTo(String destFileName, bool overwrite) {
             if (destFileName == null)
-                throw new ArgumentNullException("destFileName", Environment.GetResourceString("ArgumentNull_FileName"));
+                throw new ArgumentNullException(nameof(destFileName), Environment.GetResourceString("ArgumentNull_FileName"));
             if (destFileName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "destFileName");
             Contract.EndContractBlock();
@@ -383,7 +383,7 @@ namespace System.IO {
         [System.Security.SecuritySafeCritical]
         public void MoveTo(String destFileName) {
             if (destFileName==null)
-                throw new ArgumentNullException("destFileName");
+                throw new ArgumentNullException(nameof(destFileName));
             if (destFileName.Length==0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "destFileName");
             Contract.EndContractBlock();
index 249848a..7913d0d 100644 (file)
@@ -44,7 +44,7 @@ namespace System.IO
         {
             if (path == null)
             {
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             }
             VerifyAccess(access);
             m_access = access;
index deef30c..f4187dc 100644 (file)
@@ -516,7 +516,7 @@ namespace System.IO {
         private void Init(String path, FileMode mode, FileAccess access, int rights, bool useRights, FileShare share, int bufferSize, FileOptions options, Win32Native.SECURITY_ATTRIBUTES secAttrs, String msgPath, bool bFromProxy, bool useLongPath, bool checkHost)
         {
             if (path == null)
-                throw new ArgumentNullException("path", Environment.GetResourceString("ArgumentNull_Path"));
+                throw new ArgumentNullException(nameof(path), Environment.GetResourceString("ArgumentNull_Path"));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             Contract.EndContractBlock();
@@ -1133,7 +1133,7 @@ namespace System.IO {
         public void SetAccessControl(FileSecurity fileSecurity)
         {
             if (fileSecurity == null)
-                throw new ArgumentNullException("fileSecurity");
+                throw new ArgumentNullException(nameof(fileSecurity));
             Contract.EndContractBlock();
 
             if (_handle.IsClosed) __Error.FileNotOpen();
@@ -1366,7 +1366,7 @@ namespace System.IO {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public override int Read([In, Out] byte[] array, int offset, int count) {
             if (array==null)
-                throw new ArgumentNullException("array", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(array), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -1619,7 +1619,7 @@ namespace System.IO {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public override void Write(byte[] array, int offset, int count) {
             if (array==null)
-                throw new ArgumentNullException("array", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(array), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -1735,7 +1735,7 @@ namespace System.IO {
         public override IAsyncResult BeginRead(byte[] array, int offset, int numBytes, AsyncCallback userCallback, Object stateObject)
         {
             if (array==null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (numBytes < 0)
@@ -1973,7 +1973,7 @@ namespace System.IO {
             // on our FileStreamAsyncResult.  One is from BeginReadCore,
             // while the other is from the BeginRead buffering wrapper.
             if (asyncResult==null)
-                throw new ArgumentNullException("asyncResult");
+                throw new ArgumentNullException(nameof(asyncResult));
             Contract.EndContractBlock();
 
             if (!_isAsync)
@@ -2031,7 +2031,7 @@ namespace System.IO {
         public override IAsyncResult BeginWrite(byte[] array, int offset, int numBytes, AsyncCallback userCallback, Object stateObject)
         {
             if (array==null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (numBytes < 0)
@@ -2202,7 +2202,7 @@ namespace System.IO {
         public unsafe override void EndWrite(IAsyncResult asyncResult)
         {
             if (asyncResult==null)
-                throw new ArgumentNullException("asyncResult");
+                throw new ArgumentNullException(nameof(asyncResult));
             Contract.EndContractBlock();
 
             if (!_isAsync) {
@@ -2427,7 +2427,7 @@ namespace System.IO {
         public override Task<int> ReadAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
         {
             if (buffer == null)
-                throw new ArgumentNullException("buffer");
+                throw new ArgumentNullException(nameof(buffer));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -2479,7 +2479,7 @@ namespace System.IO {
         public override Task WriteAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
         {
             if (buffer == null)
-                throw new ArgumentNullException("buffer");
+                throw new ArgumentNullException(nameof(buffer));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
index a35b87f..555b4fe 100644 (file)
@@ -61,7 +61,7 @@ namespace System.IO {
         protected FileSystemInfo(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
             
             // Must use V1 field names here, since V1 didn't implement 
index fa3b763..e10bde1 100644 (file)
@@ -79,7 +79,7 @@ namespace System.IO {
         }
         
         public MemoryStream(byte[] buffer, bool writable) {
-            if (buffer == null) throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+            if (buffer == null) throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             Contract.EndContractBlock();
             _buffer = buffer;
             _length = _capacity = buffer.Length;
@@ -99,7 +99,7 @@ namespace System.IO {
     
         public MemoryStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible) {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -326,7 +326,7 @@ namespace System.IO {
 
         public override int Read([In, Out] byte[] buffer, int offset, int count) {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -362,7 +362,7 @@ namespace System.IO {
         public override Task<int> ReadAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
         {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -550,7 +550,7 @@ namespace System.IO {
     
         public override void Write(byte[] buffer, int offset, int count) {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -595,7 +595,7 @@ namespace System.IO {
         public override Task WriteAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
         {
             if (buffer == null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -646,7 +646,7 @@ namespace System.IO {
         // Writes this MemoryStream to another stream.
         public virtual void WriteTo(Stream stream) {
             if (stream==null)
-                throw new ArgumentNullException("stream", Environment.GetResourceString("ArgumentNull_Stream"));
+                throw new ArgumentNullException(nameof(stream), Environment.GetResourceString("ArgumentNull_Stream"));
             Contract.EndContractBlock();
 
             if (!_isOpen) __Error.StreamIsClosed();
index 0a28d67..64f3c27 100644 (file)
@@ -358,7 +358,7 @@ namespace System.IO {
         internal static string GetFullPathInternal(string path)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             Contract.EndContractBlock();
 
             string newPath = NormalizePath(path, fullCheck: true);
@@ -1212,7 +1212,7 @@ namespace System.IO {
 
         public static String Combine(String path1, String path2) {
             if (path1==null || path2==null)
-                throw new ArgumentNullException((path1==null) ? "path1" : "path2");
+                throw new ArgumentNullException((path1==null) ? nameof(path1) : nameof(path2));
             Contract.EndContractBlock();
             CheckInvalidPathChars(path1);
             CheckInvalidPathChars(path2);
@@ -1222,7 +1222,7 @@ namespace System.IO {
 
         public static String Combine(String path1, String path2, String path3) {
             if (path1 == null || path2 == null || path3 == null)
-                throw new ArgumentNullException((path1 == null) ? "path1" : (path2 == null) ? "path2" : "path3");
+                throw new ArgumentNullException((path1 == null) ? nameof(path1) : (path2 == null) ? nameof(path2) : nameof(path3));
             Contract.EndContractBlock();
             CheckInvalidPathChars(path1);
             CheckInvalidPathChars(path2);
@@ -1233,7 +1233,7 @@ namespace System.IO {
 
         public static String Combine(String path1, String path2, String path3, String path4) {
             if (path1 == null || path2 == null || path3 == null || path4 == null)
-                throw new ArgumentNullException((path1 == null) ? "path1" : (path2 == null) ? "path2" : (path3 == null) ? "path3" : "path4");
+                throw new ArgumentNullException((path1 == null) ? nameof(path1) : (path2 == null) ? nameof(path2) : (path3 == null) ? nameof(path3) : nameof(path4));
             Contract.EndContractBlock();
             CheckInvalidPathChars(path1);
             CheckInvalidPathChars(path2);
@@ -1245,7 +1245,7 @@ namespace System.IO {
 
         public static String Combine(params String[] paths) {
             if (paths == null) {
-                throw new ArgumentNullException("paths");
+                throw new ArgumentNullException(nameof(paths));
             }
             Contract.EndContractBlock();
 
@@ -1257,7 +1257,7 @@ namespace System.IO {
 
             for (int i = 0; i < paths.Length; i++) {
                 if (paths[i] == null) {
-                    throw new ArgumentNullException("paths");
+                    throw new ArgumentNullException(nameof(paths));
                 }
 
                 if (paths[i].Length  == 0) {
@@ -1404,7 +1404,7 @@ namespace System.IO {
         internal static void CheckInvalidPathChars(String path, bool checkAdditional = false)
         {
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
 
             if (PathInternal.HasIllegalCharacters(path, checkAdditional))
                 throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPathChars"));
@@ -1412,7 +1412,7 @@ namespace System.IO {
 
         internal static String InternalCombine(String path1, String path2) {
             if (path1==null || path2==null)
-                throw new ArgumentNullException((path1==null) ? "path1" : "path2");
+                throw new ArgumentNullException((path1==null) ? nameof(path1) : nameof(path2));
             Contract.EndContractBlock();
             CheckInvalidPathChars(path1);
             CheckInvalidPathChars(path2);
index 738bb0c..084fe0c 100644 (file)
@@ -357,7 +357,7 @@ namespace System.IO {
         public virtual int EndRead(IAsyncResult asyncResult)
         {
             if (asyncResult == null)
-                throw new ArgumentNullException("asyncResult");
+                throw new ArgumentNullException(nameof(asyncResult));
             Contract.Ensures(Contract.Result<int>() >= 0);
             Contract.EndContractBlock();
 
@@ -549,7 +549,7 @@ namespace System.IO {
         public virtual void EndWrite(IAsyncResult asyncResult)
         {
             if (asyncResult==null)
-                throw new ArgumentNullException("asyncResult");
+                throw new ArgumentNullException(nameof(asyncResult));
             Contract.EndContractBlock();
 
             var writeTask = _activeReadWriteTask;
@@ -773,7 +773,7 @@ namespace System.IO {
         public static Stream Synchronized(Stream stream) 
         {
             if (stream==null)
-                throw new ArgumentNullException("stream");
+                throw new ArgumentNullException(nameof(stream));
             Contract.Ensures(Contract.Result<Stream>() != null);
             Contract.EndContractBlock();
             if (stream is SyncStream)
@@ -926,7 +926,7 @@ namespace System.IO {
             public override int EndRead(IAsyncResult asyncResult)
             {
                 if (asyncResult == null)
-                    throw new ArgumentNullException("asyncResult");
+                    throw new ArgumentNullException(nameof(asyncResult));
                 Contract.EndContractBlock();
 
                 return BlockingEndRead(asyncResult);
@@ -943,7 +943,7 @@ namespace System.IO {
             public override void EndWrite(IAsyncResult asyncResult)
             {
                 if (asyncResult == null)
-                    throw new ArgumentNullException("asyncResult");
+                    throw new ArgumentNullException(nameof(asyncResult));
                 Contract.EndContractBlock();
 
                 BlockingEndWrite(asyncResult);
@@ -1089,7 +1089,7 @@ namespace System.IO {
             internal SyncStream(Stream stream)
             {
                 if (stream == null)
-                    throw new ArgumentNullException("stream");
+                    throw new ArgumentNullException(nameof(stream));
                 Contract.EndContractBlock();
                 _stream = stream;
             }
@@ -1226,7 +1226,7 @@ namespace System.IO {
             public override int EndRead(IAsyncResult asyncResult)
             {
                 if (asyncResult == null)
-                    throw new ArgumentNullException("asyncResult");
+                    throw new ArgumentNullException(nameof(asyncResult));
                 Contract.Ensures(Contract.Result<int>() >= 0);
                 Contract.EndContractBlock();
 
@@ -1280,7 +1280,7 @@ namespace System.IO {
             public override void EndWrite(IAsyncResult asyncResult)
             {
                 if (asyncResult == null)
-                    throw new ArgumentNullException("asyncResult");
+                    throw new ArgumentNullException(nameof(asyncResult));
                 Contract.EndContractBlock();
 
                 lock(_stream)
index 549733b..3ed1ab5 100644 (file)
@@ -161,7 +161,7 @@ namespace System.IO
         public StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen)
         {
             if (stream == null || encoding == null)
-                throw new ArgumentNullException((stream == null ? "stream" : "encoding"));
+                throw new ArgumentNullException((stream == null ? nameof(stream) : nameof(encoding)));
             if (!stream.CanRead)
                 throw new ArgumentException(Environment.GetResourceString("Argument_StreamNotReadable"));
             if (bufferSize <= 0)
@@ -199,7 +199,7 @@ namespace System.IO
             // or we'll create a FileStream on disk and we won't close it until
             // the finalizer runs, causing problems for applications.
             if (path==null || encoding==null)
-                throw new ArgumentNullException((path==null ? "path" : "encoding"));
+                throw new ArgumentNullException((path==null ? nameof(path) : nameof(encoding)));
             if (path.Length==0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             if (bufferSize <= 0)
@@ -358,7 +358,7 @@ namespace System.IO
         public override int Read([In, Out] char[] buffer, int index, int count)
         {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0 || count < 0)
                 throw new ArgumentOutOfRangeException((index < 0 ? "index" : "count"), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (buffer.Length - index < count)
@@ -416,7 +416,7 @@ namespace System.IO
         public override int ReadBlock([In, Out] char[] buffer, int index, int count)
         {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0 || count < 0)
                 throw new ArgumentOutOfRangeException((index < 0 ? "index" : "count"), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (buffer.Length - index < count)
@@ -898,7 +898,7 @@ namespace System.IO
         public override Task<int> ReadAsync(char[] buffer, int index, int count)
         {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0 || count < 0)
                 throw new ArgumentOutOfRangeException((index < 0 ? "index" : "count"), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (buffer.Length - index < count)
@@ -1086,7 +1086,7 @@ namespace System.IO
         public override Task<int> ReadBlockAsync(char[] buffer, int index, int count)
         {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0 || count < 0)
                 throw new ArgumentOutOfRangeException((index < 0 ? "index" : "count"), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (buffer.Length - index < count)
index 65613bb..6aee4cf 100644 (file)
@@ -133,7 +133,7 @@ namespace System.IO
             : base(null) // Ask for CurrentCulture all the time
         {
             if (stream == null || encoding == null)
-                throw new ArgumentNullException((stream == null ? "stream" : "encoding"));
+                throw new ArgumentNullException((stream == null ? nameof(stream) : nameof(encoding)));
             if (!stream.CanWrite)
                 throw new ArgumentException(Environment.GetResourceString("Argument_StreamNotWritable"));
             if (bufferSize <= 0) throw new ArgumentOutOfRangeException("bufferSize", Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
@@ -163,9 +163,9 @@ namespace System.IO
             : base(null)
         { // Ask for CurrentCulture all the time
             if (path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
             if (encoding == null)
-                throw new ArgumentNullException("encoding");
+                throw new ArgumentNullException(nameof(encoding));
             if (path.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
             if (bufferSize <= 0) throw new ArgumentOutOfRangeException("bufferSize", Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
@@ -365,7 +365,7 @@ namespace System.IO
 
         public override void Write(char[] buffer, int index, int count) {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -566,7 +566,7 @@ namespace System.IO
         public override Task WriteAsync(char[] buffer, int index, int count)
         {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -723,7 +723,7 @@ namespace System.IO
         public override Task WriteLineAsync(char[] buffer, int index, int count)
         {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
index b8cacde..384ffc1 100644 (file)
@@ -97,7 +97,7 @@ namespace System.IO {
         public virtual int Read([In, Out] char[] buffer, int index, int count) 
         {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -202,7 +202,7 @@ namespace System.IO {
         public virtual Task<int> ReadAsync(char[] buffer, int index, int count)
         {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0 || count < 0)
                 throw new ArgumentOutOfRangeException((index < 0 ? "index" : "count"), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (buffer.Length - index < count)
@@ -233,7 +233,7 @@ namespace System.IO {
         public virtual Task<int> ReadBlockAsync(char[] buffer, int index, int count)
         {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0 || count < 0)
                 throw new ArgumentOutOfRangeException((index < 0 ? "index" : "count"), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (buffer.Length - index < count)
@@ -267,7 +267,7 @@ namespace System.IO {
         public static TextReader Synchronized(TextReader reader) 
         {
             if (reader==null)
-                throw new ArgumentNullException("reader");
+                throw new ArgumentNullException(nameof(reader));
             Contract.Ensures(Contract.Result<TextReader>() != null);
             Contract.EndContractBlock();
 
@@ -379,7 +379,7 @@ namespace System.IO {
             public override Task<int> ReadBlockAsync(char[] buffer, int index, int count)
             {
                 if (buffer==null)
-                    throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                    throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
                 if (index < 0 || count < 0)
                     throw new ArgumentOutOfRangeException((index < 0 ? "index" : "count"), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
                 if (buffer.Length - index < count)
@@ -395,7 +395,7 @@ namespace System.IO {
             public override Task<int> ReadAsync(char[] buffer, int index, int count)
             {
                 if (buffer==null)
-                    throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                    throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
                 if (index < 0 || count < 0)
                     throw new ArgumentOutOfRangeException((index < 0 ? "index" : "count"), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
                 if (buffer.Length - index < count)
index b923106..5a60ed6 100644 (file)
@@ -127,7 +127,7 @@ namespace System.IO {
         [HostProtection(Synchronization=true)]
         public static TextWriter Synchronized(TextWriter writer) {
             if (writer==null)
-                throw new ArgumentNullException("writer");
+                throw new ArgumentNullException(nameof(writer));
             Contract.Ensures(Contract.Result<TextWriter>() != null);
             Contract.EndContractBlock();
 
@@ -158,7 +158,7 @@ namespace System.IO {
         //
         public virtual void Write(char[] buffer, int index, int count) {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
index 12cb025..09b37fc 100644 (file)
@@ -62,7 +62,7 @@ namespace System.IO {
 #pragma warning restore 618
         protected void Initialize(SafeBuffer buffer, Int64 offset, Int64 capacity, FileAccess access) {
             if (buffer == null) {
-                throw new ArgumentNullException("buffer");
+                throw new ArgumentNullException(nameof(buffer));
             }
             if (offset < 0) {
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
@@ -624,7 +624,7 @@ namespace System.IO {
         [System.Security.SecurityCritical]  // auto-generated_required
         public int ReadArray<T>(Int64 position, T[] array, Int32 offset, Int32 count) where T : struct {
             if (array == null) {
-                throw new ArgumentNullException("array", "Buffer cannot be null.");
+                throw new ArgumentNullException(nameof(array), "Buffer cannot be null.");
             }
             if (offset < 0) {
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
@@ -1136,7 +1136,7 @@ namespace System.IO {
         [System.Security.SecurityCritical]  // auto-generated_required
         public void WriteArray<T>(Int64 position, T[] array, Int32 offset, Int32 count) where T : struct {
             if (array == null) {
-                throw new ArgumentNullException("array", "Buffer cannot be null.");
+                throw new ArgumentNullException(nameof(array), "Buffer cannot be null.");
             }
             if (offset < 0) {
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
index df4df3b..20a7c2d 100644 (file)
@@ -135,7 +135,7 @@ namespace System.IO {
         [System.Security.SecurityCritical]  // auto-generated
         internal void Initialize(SafeBuffer buffer, long offset, long length, FileAccess access, bool skipSecurityCheck) {
             if (buffer == null) {
-                throw new ArgumentNullException("buffer");
+                throw new ArgumentNullException(nameof(buffer));
             }
             if (offset < 0) {
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
@@ -219,7 +219,7 @@ namespace System.IO {
         internal unsafe void Initialize(byte* pointer, long length, long capacity, FileAccess access, bool skipSecurityCheck) 
         {
             if (pointer == null)
-                throw new ArgumentNullException("pointer");
+                throw new ArgumentNullException(nameof(pointer));
             if (length < 0 || capacity < 0)
                 throw new ArgumentOutOfRangeException((length < 0) ? "length" : "capacity", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (length > capacity)
@@ -381,7 +381,7 @@ namespace System.IO {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public override int Read([In, Out] byte[] buffer, int offset, int count) {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -444,7 +444,7 @@ namespace System.IO {
         [ComVisible(false)]
         public override Task<Int32> ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) {        
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -566,7 +566,7 @@ namespace System.IO {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public override void Write(byte[] buffer, int offset, int count) {
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -646,7 +646,7 @@ namespace System.IO {
         public override Task WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) { 
         
             if (buffer==null)
-                throw new ArgumentNullException("buffer", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (offset < 0)
                 throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
index 5727eed..c77d051 100644 (file)
@@ -127,7 +127,7 @@ namespace System.IO {
         // Writes this MemoryStream to another stream.
         public unsafe override void WriteTo(Stream stream) {
             if (stream==null)
-                throw new ArgumentNullException("stream", Environment.GetResourceString("ArgumentNull_Stream"));
+                throw new ArgumentNullException(nameof(stream), Environment.GetResourceString("ArgumentNull_Stream"));
             Contract.EndContractBlock();
 
             if (!_unmanagedStream._isOpen) __Error.StreamIsClosed();
@@ -151,7 +151,7 @@ namespace System.IO {
 
             // The parameter checks must be in sync with the base version:
             if (destination == null)
-                throw new ArgumentNullException("destination");
+                throw new ArgumentNullException(nameof(destination));
             
             if (bufferSize <= 0)
                 throw new ArgumentOutOfRangeException("bufferSize", Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
index c7eea36..b7674af 100644 (file)
@@ -87,7 +87,7 @@ namespace System {
         [System.Security.SecurityCritical]
         unsafe void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
 #if BIT64
index 883979e..f60cfd8 100644 (file)
@@ -207,7 +207,7 @@ namespace System
         public Lazy(Func<T> valueFactory, LazyThreadSafetyMode mode)
         {
             if (valueFactory == null)
-                throw new ArgumentNullException("valueFactory");
+                throw new ArgumentNullException(nameof(valueFactory));
 
             m_threadSafeObj = GetObjectFromMode(mode);
             m_valueFactory = valueFactory;
index 201aa75..8b6a843 100644 (file)
@@ -234,7 +234,7 @@ namespace System {
         internal static bool CanCastToXmlTypeHelper(RuntimeType castType, MarshalByRefObject o)
         {
             if (castType == null)
-                throw new ArgumentNullException("castType");
+                throw new ArgumentNullException(nameof(castType));
         
             Contract.EndContractBlock();
             // MarshalByRefObject's can only be casted to MarshalByRefObject's or interfaces.
index 30ce5b8..07d516d 100644 (file)
@@ -85,7 +85,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated_required
         public override void GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
             base.GetObjectData(info, context);
index a3d455a..d108f92 100644 (file)
@@ -60,7 +60,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated_required
         public override void GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
             base.GetObjectData(info, context);
index 2091e20..8a22c8e 100644 (file)
@@ -130,7 +130,7 @@ namespace System
         // Otherwise, returns the underlying type of the Nullable type
         public static Type GetUnderlyingType(Type nullableType) {
             if((object)nullableType == null) {
-                throw new ArgumentNullException("nullableType");
+                throw new ArgumentNullException(nameof(nullableType));
             }
             Contract.EndContractBlock();
             Type result = null;
index 3c1215d..52bb03e 100644 (file)
@@ -652,7 +652,7 @@ namespace System {
         [System.Security.SecuritySafeCritical]  // auto-generated
         internal unsafe static Double ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) {
             if (value == null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
 
             Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes];
@@ -933,7 +933,7 @@ namespace System {
         [System.Security.SecuritySafeCritical]  // auto-generated
         internal unsafe static Single ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt) {
             if (value == null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
 
             Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes];
@@ -1014,7 +1014,7 @@ namespace System {
         private unsafe static void StringToNumber(String str, NumberStyles options, ref NumberBuffer number, NumberFormatInfo info, Boolean parseDecimal) {
     
             if (str == null) {
-                throw new ArgumentNullException("String");
+                throw new ArgumentNullException(nameof(String));
             }
             Contract.EndContractBlock();
             Contract.Assert(info != null, "");
index 6955310..26c1b3a 100644 (file)
@@ -42,7 +42,7 @@ namespace System {
             }
 
             if ((Object) version == null)
-                throw new ArgumentNullException("version");
+                throw new ArgumentNullException(nameof(version));
             Contract.EndContractBlock();
 
             _platform = platform;
@@ -74,7 +74,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated_required
         public void GetObjectData(SerializationInfo info, StreamingContext context) {
             if( info == null ) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
 
index 8800c03..a8b48fd 100644 (file)
@@ -63,7 +63,7 @@ namespace System
         /// <exception cref="System.ArgumentNullException">The <paramref name="handler"/> is null (Nothing in Visual Basic).</exception>
         public Progress(Action<T> handler) : this()
         {
-            if (handler == null) throw new ArgumentNullException("handler");
+            if (handler == null) throw new ArgumentNullException(nameof(handler));
             m_handler = handler;
         }
 
index 4059b4c..dd5ce87 100644 (file)
@@ -240,7 +240,7 @@ namespace System {
       **Exceptions: None
       ==============================================================================*/
       public virtual void NextBytes(byte [] buffer){
-        if (buffer==null) throw new ArgumentNullException("buffer");
+        if (buffer==null) throw new ArgumentNullException(nameof(buffer));
         Contract.EndContractBlock();
         for (int i=0; i<buffer.Length; i++) {
           buffer[i]=(byte)(InternalSample()%(Byte.MaxValue+1)); 
index 36bf351..04ef706 100644 (file)
@@ -70,7 +70,7 @@ namespace System.Reflection
         public static Assembly GetAssembly(Type type)
         {
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             Contract.EndContractBlock();
 
             Module m = type.Module;
@@ -113,7 +113,7 @@ namespace System.Reflection
         public static Assembly LoadFrom(String assemblyFile)
         {
             if(assemblyFile == null) 
-                throw new ArgumentNullException("assemblyFile");
+                throw new ArgumentNullException(nameof(assemblyFile));
             string fullPath = Path.GetFullPathInternal(assemblyFile);
             return AssemblyLoadContext.Default.LoadFromAssemblyPath(fullPath);
         }
@@ -405,7 +405,7 @@ namespace System.Reflection
         public static Assembly LoadWithPartialName(String partialName)
         {
             if(partialName == null)
-                throw new ArgumentNullException("partialName");
+                throw new ArgumentNullException(nameof(partialName));
             return Load(partialName);
         }
 
@@ -483,7 +483,7 @@ namespace System.Reflection
 
 #if FEATURE_CORECLR
             if(rawAssembly == null)
-                throw new ArgumentNullException("rawAssembly");
+                throw new ArgumentNullException(nameof(rawAssembly));
             AssemblyLoadContext alc = new FileLoadAssemblyLoadContext();
             MemoryStream assemblyStream = new MemoryStream(rawAssembly);
             MemoryStream symbolStream = (rawSymbolStore!=null)?new MemoryStream(rawSymbolStore):null;
@@ -582,7 +582,7 @@ namespace System.Reflection
 #if FEATURE_CORECLR
             Assembly result = null;
             if(path == null)
-                throw new ArgumentNullException("path");
+                throw new ArgumentNullException(nameof(path));
 
             if (Path.IsRelative(path))
             {
@@ -1473,7 +1473,7 @@ namespace System.Reflection
         {
             // throw on null strings regardless of the value of "throwOnError"
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
 
             RuntimeType type = null;
             Object keepAlive = null;
@@ -1605,7 +1605,7 @@ namespace System.Reflection
         public override void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info==null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
 
             Contract.EndContractBlock();
 
@@ -1633,7 +1633,7 @@ namespace System.Reflection
         public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -1647,7 +1647,7 @@ namespace System.Reflection
         public override bool IsDefined(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -1674,7 +1674,7 @@ namespace System.Reflection
                                                          ref StackCrawlMark stackMark)
         {
             if (assemblyFile == null)
-                throw new ArgumentNullException("assemblyFile");
+                throw new ArgumentNullException(nameof(assemblyFile));
 
             Contract.EndContractBlock();
 
@@ -1730,7 +1730,7 @@ namespace System.Reflection
             out RuntimeAssembly assemblyFromResolveEvent)
         {
             if (assemblyString == null)
-                throw new ArgumentNullException("assemblyString");
+                throw new ArgumentNullException(nameof(assemblyString));
             Contract.EndContractBlock();
 
             if ((assemblyString.Length == 0) ||
@@ -1777,7 +1777,7 @@ namespace System.Reflection
         {
        
             if (assemblyRef == null)
-                throw new ArgumentNullException("assemblyRef");
+                throw new ArgumentNullException(nameof(assemblyRef));
             Contract.EndContractBlock();
 
             if (assemblyRef.CodeBase != null)
@@ -2106,7 +2106,7 @@ namespace System.Reflection
         internal static RuntimeAssembly InternalLoadFromStream(Stream assemblyStream, Stream pdbStream, ref StackCrawlMark stackMark)
         {
             if (assemblyStream  == null)
-                throw new ArgumentNullException("assemblyStream");
+                throw new ArgumentNullException(nameof(assemblyStream));
 
             if (assemblyStream.GetType()!=typeof(UnmanagedMemoryStream))
                 throw new NotSupportedException();
@@ -2413,7 +2413,7 @@ namespace System.Reflection
             StringBuilder sb = new StringBuilder();
             if(type == null) {
                 if (name == null)
-                    throw new ArgumentNullException("type");
+                    throw new ArgumentNullException(nameof(type));
             }
             else {
                 String nameSpace = type.Namespace;
@@ -2777,7 +2777,7 @@ namespace System.Reflection
                                                        ref StackCrawlMark stackMark)
         {
             if (culture == null)
-                throw new ArgumentNullException("culture");
+                throw new ArgumentNullException(nameof(culture));
             Contract.EndContractBlock();
 
 
index 9552555..b2e44b0 100644 (file)
@@ -190,7 +190,7 @@ namespace System.Reflection {
         public AssemblyFileVersionAttribute(String version)
         {
             if (version == null)
-                throw new ArgumentNullException("version");
+                throw new ArgumentNullException(nameof(version));
             Contract.EndContractBlock();
             _version = version;
         }
index 051f3b5..4c3d5aa 100644 (file)
@@ -193,7 +193,7 @@ namespace System.Reflection {
         static public AssemblyName GetAssemblyName(String assemblyFile)
         {
             if(assemblyFile == null)
-                throw new ArgumentNullException("assemblyFile");
+                throw new ArgumentNullException(nameof(assemblyFile));
             Contract.EndContractBlock();
 
             // Assembly.GetNameInternal() will not demand path discovery 
@@ -299,7 +299,7 @@ namespace System.Reflection {
         public void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             //Allocate the serialization info and serialize our static data.
@@ -364,7 +364,7 @@ namespace System.Reflection {
         public AssemblyName(String assemblyName)
         {
             if (assemblyName == null)
-                throw new ArgumentNullException("assemblyName");
+                throw new ArgumentNullException(nameof(assemblyName));
             Contract.EndContractBlock();
             if ((assemblyName.Length == 0) ||
                 (assemblyName[0] == '\0'))
index 7811244..cb3e434 100644 (file)
@@ -397,7 +397,7 @@ namespace System.Reflection
         public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -412,7 +412,7 @@ namespace System.Reflection
         public override bool IsDefined(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -532,7 +532,7 @@ namespace System.Reflection
         internal static void CheckCanCreateInstance(Type declaringType, bool isVarArg)
         {
             if (declaringType == null)
-                throw new ArgumentNullException("declaringType");
+                throw new ArgumentNullException(nameof(declaringType));
             Contract.EndContractBlock();
             
             // ctor is ReflectOnly
@@ -765,7 +765,7 @@ namespace System.Reflection
         public void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
             MemberInfoSerializationHolder.GetSerializationInfo(
                 info,
index 1a605ac..c290ec6 100644 (file)
@@ -29,7 +29,7 @@ namespace System.Reflection
         public static IList<CustomAttributeData> GetCustomAttributes(MemberInfo target)
         {
             if (target == null)
-                throw new ArgumentNullException("target");
+                throw new ArgumentNullException(nameof(target));
 
             return target.GetCustomAttributesData();
         }
@@ -37,7 +37,7 @@ namespace System.Reflection
         public static IList<CustomAttributeData> GetCustomAttributes(Module target)
         {
             if (target == null)
-                throw new ArgumentNullException("target");
+                throw new ArgumentNullException(nameof(target));
             Contract.EndContractBlock();
 
             return target.GetCustomAttributesData();
@@ -46,7 +46,7 @@ namespace System.Reflection
         public static IList<CustomAttributeData> GetCustomAttributes(Assembly target)
         {
             if (target == null)
-                throw new ArgumentNullException("target");
+                throw new ArgumentNullException(nameof(target));
             Contract.EndContractBlock();
 
             return target.GetCustomAttributesData();
@@ -55,7 +55,7 @@ namespace System.Reflection
         public static IList<CustomAttributeData> GetCustomAttributes(ParameterInfo target)
         {
             if (target == null)
-                throw new ArgumentNullException("target");
+                throw new ArgumentNullException(nameof(target));
             Contract.EndContractBlock();
 
             return target.GetCustomAttributesData();
@@ -611,7 +611,7 @@ namespace System.Reflection
         public CustomAttributeNamedArgument(MemberInfo memberInfo, object value)
         {
             if (memberInfo == null)
-                throw new ArgumentNullException("memberInfo");
+                throw new ArgumentNullException(nameof(memberInfo));
 
             Type type = null;
             FieldInfo field = memberInfo as FieldInfo;
@@ -631,7 +631,7 @@ namespace System.Reflection
         public CustomAttributeNamedArgument(MemberInfo memberInfo, CustomAttributeTypedArgument typedArgument)
         {
             if (memberInfo == null)
-                throw new ArgumentNullException("memberInfo");
+                throw new ArgumentNullException(nameof(memberInfo));
 
             m_memberInfo = memberInfo;
             m_value = typedArgument;
@@ -820,7 +820,7 @@ namespace System.Reflection
         {
             // value can be null.
             if (argumentType == null)
-                throw new ArgumentNullException("argumentType");
+                throw new ArgumentNullException(nameof(argumentType));
 
             m_value = (value == null) ? null : CanonicalizeValue(value);
             m_argumentType = argumentType;
@@ -830,7 +830,7 @@ namespace System.Reflection
         {
             // value cannot be null.
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
 
             m_value = CanonicalizeValue(value);
             m_argumentType = value.GetType();
@@ -1031,7 +1031,7 @@ namespace System.Reflection
             RuntimeModule customAttributeModule)
         {
             if (customAttributeModule == null)
-                throw new ArgumentNullException("customAttributeModule");
+                throw new ArgumentNullException(nameof(customAttributeModule));
             Contract.EndContractBlock();
 
             Contract.Assert(customAttributeCtorParameters != null);
@@ -1083,7 +1083,7 @@ namespace System.Reflection
         public CustomAttributeNamedParameter(string argumentName, CustomAttributeEncoding fieldOrProperty, CustomAttributeType type)
         {
             if (argumentName == null)
-                throw new ArgumentNullException("argumentName");
+                throw new ArgumentNullException(nameof(argumentName));
             Contract.EndContractBlock();
 
             m_argumentName = argumentName;
index b9e35dc..142f898 100644 (file)
@@ -303,7 +303,7 @@ namespace System.Reflection.Emit
                                  SecurityContextSource securityContextSource)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
 
             if (access != AssemblyBuilderAccess.Run
 #if !FEATURE_CORECLR
@@ -623,7 +623,7 @@ namespace System.Reflection.Emit
             ref StackCrawlMark stackMark)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
             if (name[0] == '\0')
@@ -832,14 +832,14 @@ namespace System.Reflection.Emit
             ref    StackCrawlMark stackMark)    // stack crawl mark used to find caller
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
             if (name[0] == '\0')
                 throw new ArgumentException(Environment.GetResourceString("Argument_InvalidName"), "name");
 
             if (fileName == null)
-                throw new ArgumentNullException("fileName");
+                throw new ArgumentNullException(nameof(fileName));
             if (fileName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "fileName");
             if (!String.Equals(fileName, Path.GetFileName(fileName)))
@@ -1008,11 +1008,11 @@ namespace System.Reflection.Emit
             ResourceAttributes attribute)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), name);
             if (fileName == null)
-                throw new ArgumentNullException("fileName");
+                throw new ArgumentNullException(nameof(fileName));
             if (fileName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "fileName");
             if (!String.Equals(fileName, Path.GetFileName(fileName)))
@@ -1084,11 +1084,11 @@ namespace System.Reflection.Emit
             ResourceAttributes attribute)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), name);
             if (fileName == null)
-                throw new ArgumentNullException("fileName");
+                throw new ArgumentNullException(nameof(fileName));
             if (fileName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), fileName);
             if (!String.Equals(fileName, Path.GetFileName(fileName)))
@@ -1437,7 +1437,7 @@ namespace System.Reflection.Emit
         public void DefineUnmanagedResource(Byte[] resource)
         {
             if (resource == null)
-                throw new ArgumentNullException("resource");
+                throw new ArgumentNullException(nameof(resource));
             Contract.EndContractBlock();
 
             lock(SyncRoot)
@@ -1461,7 +1461,7 @@ namespace System.Reflection.Emit
         public void DefineUnmanagedResource(String resourceFileName)
         {
             if (resourceFileName == null)
-                throw new ArgumentNullException("resourceFileName");
+                throw new ArgumentNullException(nameof(resourceFileName));
             Contract.EndContractBlock();
 
             lock(SyncRoot)
@@ -1520,7 +1520,7 @@ namespace System.Reflection.Emit
             String      name)                   // the name of module for the look up
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
             Contract.EndContractBlock();
@@ -1571,7 +1571,7 @@ namespace System.Reflection.Emit
         {
 
             if (entryMethod == null)
-                throw new ArgumentNullException("entryMethod");
+                throw new ArgumentNullException(nameof(entryMethod));
             Contract.EndContractBlock();
 
             BCLDebug.Log("DYNIL", "## DYNIL LOGGING: AssemblyBuilder.SetEntryPoint");
@@ -1609,9 +1609,9 @@ namespace System.Reflection.Emit
         public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
         {
             if (con == null)
-                throw new ArgumentNullException("con");
+                throw new ArgumentNullException(nameof(con));
             if (binaryAttribute == null)
-                throw new ArgumentNullException("binaryAttribute");
+                throw new ArgumentNullException(nameof(binaryAttribute));
             Contract.EndContractBlock();
     
             lock(SyncRoot)
@@ -1647,7 +1647,7 @@ namespace System.Reflection.Emit
         {
             if (customBuilder == null)
             {
-                throw new ArgumentNullException("customBuilder");
+                throw new ArgumentNullException(nameof(customBuilder));
             }
             Contract.EndContractBlock();
 
@@ -1710,7 +1710,7 @@ namespace System.Reflection.Emit
             PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
         {
             if (assemblyFileName == null)
-                throw new ArgumentNullException("assemblyFileName");
+                throw new ArgumentNullException(nameof(assemblyFileName));
             if (assemblyFileName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), "assemblyFileName");
             if (!String.Equals(assemblyFileName, Path.GetFileName(assemblyFileName)))
index e5062d3..56e2e92 100644 (file)
@@ -223,7 +223,7 @@ namespace System.Reflection.Emit
         public void AddDeclarativeSecurity(SecurityAction action, PermissionSet pset)
         {
             if (pset == null)
-                throw new ArgumentNullException("pset");
+                throw new ArgumentNullException(nameof(pset));
 
 #pragma warning disable 618
             if (!Enum.IsDefined(typeof(SecurityAction), action) ||
index 81ad5f3..3ef44a5 100644 (file)
@@ -109,17 +109,17 @@ namespace System.Reflection.Emit {
                                                  FieldInfo[] namedFields, Object[] fieldValues)
         {
             if (con == null)
-                throw new ArgumentNullException("con");
+                throw new ArgumentNullException(nameof(con));
             if (constructorArgs == null)
-                throw new ArgumentNullException("constructorArgs");
+                throw new ArgumentNullException(nameof(constructorArgs));
             if (namedProperties == null)
-                throw new ArgumentNullException("namedProperties");
+                throw new ArgumentNullException(nameof(namedProperties));
             if (propertyValues == null)
-                throw new ArgumentNullException("propertyValues");
+                throw new ArgumentNullException(nameof(propertyValues));
             if (namedFields == null)
-                throw new ArgumentNullException("namedFields");
+                throw new ArgumentNullException(nameof(namedFields));
             if (fieldValues == null)
-                throw new ArgumentNullException("fieldValues");
+                throw new ArgumentNullException(nameof(fieldValues));
             if (namedProperties.Length != propertyValues.Length)
                 throw new ArgumentException(Environment.GetResourceString("Arg_ArrayLengthsDiffer"), "namedProperties, propertyValues");
             if (namedFields.Length != fieldValues.Length)
index a229f3f..356c53f 100644 (file)
@@ -61,7 +61,7 @@ namespace System.Reflection.Emit
         {
             LocalBuilder localBuilder;
             if (localType == null)
-                throw new ArgumentNullException("localType");
+                throw new ArgumentNullException(nameof(localType));
             Contract.EndContractBlock();
 
             RuntimeType rtType = localType as RuntimeType;
@@ -90,7 +90,7 @@ namespace System.Reflection.Emit
         public override void Emit(OpCode opcode, MethodInfo meth)
         {
             if (meth == null)
-                throw new ArgumentNullException("meth");
+                throw new ArgumentNullException(nameof(meth));
             Contract.EndContractBlock();
 
             int stackchange = 0;
@@ -147,7 +147,7 @@ namespace System.Reflection.Emit
         public override void Emit(OpCode opcode, ConstructorInfo con)
         {
             if (con == null)
-                throw new ArgumentNullException("con");
+                throw new ArgumentNullException(nameof(con));
             Contract.EndContractBlock();
 
             RuntimeConstructorInfo rtConstructor = con as RuntimeConstructorInfo;
@@ -175,7 +175,7 @@ namespace System.Reflection.Emit
         public override void Emit(OpCode opcode, Type type)
         {
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             Contract.EndContractBlock();
 
             RuntimeType rtType = type as RuntimeType;
@@ -192,7 +192,7 @@ namespace System.Reflection.Emit
         public override void Emit(OpCode opcode, FieldInfo field)
         {
             if (field == null)
-                throw new ArgumentNullException("field");
+                throw new ArgumentNullException(nameof(field));
             Contract.EndContractBlock();
 
             RuntimeFieldInfo runtimeField = field as RuntimeFieldInfo;
@@ -213,7 +213,7 @@ namespace System.Reflection.Emit
         public override void Emit(OpCode opcode, String str)
         {
             if (str == null)
-                throw new ArgumentNullException("str");
+                throw new ArgumentNullException(nameof(str));
             Contract.EndContractBlock();
 
             int tempVal = GetTokenForString(str);
@@ -310,7 +310,7 @@ namespace System.Reflection.Emit
         public override void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[] optionalParameterTypes)
         {
             if (methodInfo == null)
-                throw new ArgumentNullException("methodInfo");
+                throw new ArgumentNullException(nameof(methodInfo));
 
             if (!(opcode.Equals(OpCodes.Call) || opcode.Equals(OpCodes.Callvirt) || opcode.Equals(OpCodes.Newobj)))
                 throw new ArgumentException(Environment.GetResourceString("Argument_NotMethodCallOpcode"), "opcode");
@@ -350,7 +350,7 @@ namespace System.Reflection.Emit
         public override void Emit(OpCode opcode, SignatureHelper signature)
         {
             if (signature == null)
-                throw new ArgumentNullException("signature");
+                throw new ArgumentNullException(nameof(signature));
             Contract.EndContractBlock();
 
             int stackchange = 0;
@@ -420,7 +420,7 @@ namespace System.Reflection.Emit
             {
                 // execute this branch if previous clause is Catch or Fault
                 if (exceptionType == null)
-                    throw new ArgumentNullException("exceptionType");
+                    throw new ArgumentNullException(nameof(exceptionType));
 
                 if (rtType == null)
                     throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
@@ -1071,7 +1071,7 @@ namespace System.Reflection.Emit
                 throw new ArgumentOutOfRangeException("codeSize", Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
 
             if (codeSize > 0 && code == null)
-                throw new ArgumentNullException("code");
+                throw new ArgumentNullException(nameof(code));
             Contract.EndContractBlock();
 
             m_code = new byte[codeSize];
@@ -1097,7 +1097,7 @@ namespace System.Reflection.Emit
                 throw new ArgumentOutOfRangeException("exceptionsSize", Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
 
             if (exceptionsSize > 0 && exceptions == null)
-                throw new ArgumentNullException("exceptions");
+                throw new ArgumentNullException(nameof(exceptions));
             Contract.EndContractBlock();
 
             m_exceptions = new byte[exceptionsSize];
@@ -1122,7 +1122,7 @@ namespace System.Reflection.Emit
                 throw new ArgumentOutOfRangeException("signatureSize", Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
 
             if (signatureSize > 0 && localSignature == null)
-                throw new ArgumentNullException("localSignature");
+                throw new ArgumentNullException(nameof(localSignature));
             Contract.EndContractBlock();
 
             m_localSignature = new byte[signatureSize];
index 501d65e..6183340 100644 (file)
@@ -419,7 +419,7 @@ namespace System.Reflection.Emit
             m_methodHandle = null;
 
             if (name == null) 
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
 
 #if FEATURE_APPX
             if (AppDomain.ProfileAPICheck)
@@ -439,7 +439,7 @@ namespace System.Reflection.Emit
         private void PerformSecurityCheck(Module m, ref StackCrawlMark stackMark, bool skipVisibility)
         {
             if (m == null) 
-                throw new ArgumentNullException("m");
+                throw new ArgumentNullException(nameof(m));
             Contract.EndContractBlock();
 #if !FEATURE_CORECLR
 
@@ -485,7 +485,7 @@ namespace System.Reflection.Emit
         private void PerformSecurityCheck(Type owner, ref StackCrawlMark stackMark, bool skipVisibility)
         {
             if (owner == null)
-                throw new ArgumentNullException("owner");
+                throw new ArgumentNullException(nameof(owner));
 #if !FEATURE_CORECLR
 
             RuntimeType rtOwner = owner as RuntimeType;
@@ -493,7 +493,7 @@ namespace System.Reflection.Emit
                 rtOwner = owner.UnderlyingSystemType as RuntimeType;
 
             if (rtOwner == null)
-                throw new ArgumentNullException("owner", Environment.GetResourceString("Argument_MustBeRuntimeType"));
+                throw new ArgumentNullException(nameof(owner), Environment.GetResourceString("Argument_MustBeRuntimeType"));
 
             // get the type the call is coming from
             RuntimeType callingType = RuntimeMethodHandle.GetCallerType(ref stackMark);
@@ -947,7 +947,7 @@ namespace System.Reflection.Emit
 
             public override Object[] GetCustomAttributes(Type attributeType, bool inherit) {
                 if (attributeType == null)
-                    throw new ArgumentNullException("attributeType");
+                    throw new ArgumentNullException(nameof(attributeType));
                 Contract.EndContractBlock();
 
                 if (attributeType.IsAssignableFrom(typeof(MethodImplAttribute))) 
@@ -963,7 +963,7 @@ namespace System.Reflection.Emit
             
             public override bool IsDefined(Type attributeType, bool inherit) {
                 if (attributeType == null)
-                    throw new ArgumentNullException("attributeType");
+                    throw new ArgumentNullException(nameof(attributeType));
                 Contract.EndContractBlock();
 
                 if (attributeType.IsAssignableFrom(typeof(MethodImplAttribute))) 
index 42a5252..60289a1 100644 (file)
@@ -63,7 +63,7 @@ namespace System.Reflection.Emit {
         {
             if (mdBuilder == null)
             {
-                throw new ArgumentNullException("mdBuilder");
+                throw new ArgumentNullException(nameof(mdBuilder));
             }
             Contract.EndContractBlock();
 
@@ -110,9 +110,9 @@ namespace System.Reflection.Emit {
         public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
         {
             if (con == null)
-                throw new ArgumentNullException("con");
+                throw new ArgumentNullException(nameof(con));
             if (binaryAttribute == null)
-                throw new ArgumentNullException("binaryAttribute");
+                throw new ArgumentNullException(nameof(binaryAttribute));
             Contract.EndContractBlock();
             m_type.ThrowIfCreated();
 
@@ -130,7 +130,7 @@ namespace System.Reflection.Emit {
         {
             if (customBuilder == null)
             {
-                throw new ArgumentNullException("customBuilder");
+                throw new ArgumentNullException(nameof(customBuilder));
             }
             Contract.EndContractBlock();
             m_type.ThrowIfCreated();
index 0f2de5b..ced823a 100644 (file)
@@ -34,7 +34,7 @@ namespace System.Reflection.Emit
             Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
         {
             if (fieldName == null)
-                throw new ArgumentNullException("fieldName");
+                throw new ArgumentNullException(nameof(fieldName));
 
             if (fieldName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "fieldName");
@@ -43,7 +43,7 @@ namespace System.Reflection.Emit
                 throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "fieldName");
 
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
 
             if (type == typeof(void))
                 throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldType"));
@@ -198,7 +198,7 @@ namespace System.Reflection.Emit
         public void SetMarshal(UnmanagedMarshal unmanagedMarshal)
         {
             if (unmanagedMarshal == null)
-                throw new ArgumentNullException("unmanagedMarshal");
+                throw new ArgumentNullException(nameof(unmanagedMarshal));
             Contract.EndContractBlock();
 
             m_typeBuilder.ThrowIfCreated();
@@ -226,10 +226,10 @@ namespace System.Reflection.Emit
         public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
         {
             if (con == null)
-                throw new ArgumentNullException("con");
+                throw new ArgumentNullException(nameof(con));
 
             if (binaryAttribute == null)
-                throw new ArgumentNullException("binaryAttribute");
+                throw new ArgumentNullException(nameof(binaryAttribute));
             Contract.EndContractBlock();
 
             ModuleBuilder module = m_typeBuilder.Module as ModuleBuilder;
@@ -244,7 +244,7 @@ namespace System.Reflection.Emit
         public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
         {
             if (customBuilder == null)
-                throw new ArgumentNullException("customBuilder");
+                throw new ArgumentNullException(nameof(customBuilder));
             Contract.EndContractBlock();
 
             m_typeBuilder.ThrowIfCreated();
index 6c4a7c8..4579b9e 100644 (file)
@@ -475,7 +475,7 @@ namespace System.Reflection.Emit
         public virtual void Emit(OpCode opcode, MethodInfo meth)
         {
             if (meth == null)
-                throw new ArgumentNullException("meth");
+                throw new ArgumentNullException(nameof(meth));
             Contract.EndContractBlock();
 
             if (opcode.Equals(OpCodes.Call) || opcode.Equals(OpCodes.Callvirt) || opcode.Equals(OpCodes.Newobj))
@@ -596,7 +596,7 @@ namespace System.Reflection.Emit
         public virtual void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[] optionalParameterTypes)
         {
             if (methodInfo == null)
-                throw new ArgumentNullException("methodInfo");
+                throw new ArgumentNullException(nameof(methodInfo));
 
             if (!(opcode.Equals(OpCodes.Call) || opcode.Equals(OpCodes.Callvirt) || opcode.Equals(OpCodes.Newobj)))
                 throw new ArgumentException(Environment.GetResourceString("Argument_NotMethodCallOpcode"), "opcode");
@@ -633,7 +633,7 @@ namespace System.Reflection.Emit
         public virtual void Emit(OpCode opcode, SignatureHelper signature)
         {
             if (signature == null)
-                throw new ArgumentNullException("signature");
+                throw new ArgumentNullException(nameof(signature));
             Contract.EndContractBlock();
 
             int stackchange = 0;
@@ -670,7 +670,7 @@ namespace System.Reflection.Emit
         public virtual void Emit(OpCode opcode, ConstructorInfo con)
         {
             if (con == null)
-                throw new ArgumentNullException("con");
+                throw new ArgumentNullException(nameof(con));
             Contract.EndContractBlock();
 
             int stackchange = 0;
@@ -804,7 +804,7 @@ namespace System.Reflection.Emit
         public virtual void Emit(OpCode opcode, Label[] labels)
         {
             if (labels == null)
-                throw new ArgumentNullException("labels");
+                throw new ArgumentNullException(nameof(labels));
             Contract.EndContractBlock();
 
             // Emitting a switch table
@@ -853,7 +853,7 @@ namespace System.Reflection.Emit
 
             if (local == null)
             {
-                throw new ArgumentNullException("local");
+                throw new ArgumentNullException(nameof(local));
             }
             Contract.EndContractBlock();
             int tempVal = local.GetLocalIndex();
@@ -1050,7 +1050,7 @@ namespace System.Reflection.Emit
             } else {
                 // execute this branch if previous clause is Catch or Fault
                 if (exceptionType==null) {
-                    throw new ArgumentNullException("exceptionType");
+                    throw new ArgumentNullException(nameof(exceptionType));
                 }
 
                 Label endLabel = current.GetEndLabel();
@@ -1152,7 +1152,7 @@ namespace System.Reflection.Emit
             // Emits the il to throw an exception
 
             if (excType==null) {
-                throw new ArgumentNullException("excType");
+                throw new ArgumentNullException(nameof(excType));
             }
 
             if (!excType.IsSubclassOf(typeof(Exception)) && excType!=typeof(Exception)) {
@@ -1230,7 +1230,7 @@ namespace System.Reflection.Emit
 
             if (fld == null)
             {
-                throw new ArgumentNullException("fld");
+                throw new ArgumentNullException(nameof(fld));
             }
             Contract.EndContractBlock();
             
@@ -1282,7 +1282,7 @@ namespace System.Reflection.Emit
             }
 
             if (localType==null) {
-                throw new ArgumentNullException("localType");
+                throw new ArgumentNullException(nameof(localType));
             }
 
             if (methodBuilder.m_bIsBaked) {
@@ -1303,7 +1303,7 @@ namespace System.Reflection.Emit
             // for the current active lexical scope.
 
             if (usingNamespace == null)
-                throw new ArgumentNullException("usingNamespace");
+                throw new ArgumentNullException(nameof(usingNamespace));
 
             if (usingNamespace.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "usingNamespace");
index 56f820c..14cde6d 100644 (file)
@@ -90,7 +90,7 @@ namespace System.Reflection.Emit
             ModuleBuilder mod, TypeBuilder type, bool bIsGlobalMethod)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
 
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
@@ -99,7 +99,7 @@ namespace System.Reflection.Emit
                 throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "name");
 
             if (mod == null)
-                throw new ArgumentNullException("mod");
+                throw new ArgumentNullException(nameof(mod));
             Contract.EndContractBlock();
 
             if (parameterTypes != null)
@@ -107,7 +107,7 @@ namespace System.Reflection.Emit
                 foreach(Type t in parameterTypes)
                 {
                     if (t == null)
-                        throw new ArgumentNullException("parameterTypes");
+                        throw new ArgumentNullException(nameof(parameterTypes));
                 }
             }
 
@@ -203,7 +203,7 @@ namespace System.Reflection.Emit
             // queries this instance to get all of the information which it needs.
             if (il == null)
             {
-                throw new ArgumentNullException("il");
+                throw new ArgumentNullException(nameof(il));
             }
             Contract.EndContractBlock();
 
@@ -705,7 +705,7 @@ namespace System.Reflection.Emit
         public GenericTypeParameterBuilder[] DefineGenericParameters (params string[] names)
         {
             if (names == null)
-                throw new ArgumentNullException("names");
+                throw new ArgumentNullException(nameof(names));
 
             if (names.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Arg_EmptyArray"), "names");
@@ -716,7 +716,7 @@ namespace System.Reflection.Emit
 
             for (int i = 0; i < names.Length; i ++)
                 if (names[i] == null)
-                    throw new ArgumentNullException("names");
+                    throw new ArgumentNullException(nameof(names));
 
             if (m_tkMethod.Token != 0)
                 throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_MethodBuilderBaked"));
@@ -932,7 +932,7 @@ namespace System.Reflection.Emit
         public void AddDeclarativeSecurity(SecurityAction action, PermissionSet pset)
         {
             if (pset == null)
-                throw new ArgumentNullException("pset");
+                throw new ArgumentNullException(nameof(pset));
             Contract.EndContractBlock();
 
             ThrowIfGeneric ();
@@ -971,7 +971,7 @@ namespace System.Reflection.Emit
         {
             if (il == null)
             {
-                throw new ArgumentNullException("il", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(nameof(il), Environment.GetResourceString("ArgumentNull_Array"));
             }
             if (maxStack < 0)
             {
@@ -1187,9 +1187,9 @@ namespace System.Reflection.Emit
         public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
         {
             if (con == null)
-                throw new ArgumentNullException("con");
+                throw new ArgumentNullException(nameof(con));
             if (binaryAttribute == null)
-                throw new ArgumentNullException("binaryAttribute");
+                throw new ArgumentNullException(nameof(binaryAttribute));
             Contract.EndContractBlock();
 
             ThrowIfGeneric();
@@ -1207,7 +1207,7 @@ namespace System.Reflection.Emit
         public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
         {
             if (customBuilder == null)
-                throw new ArgumentNullException("customBuilder");
+                throw new ArgumentNullException(nameof(customBuilder));
             Contract.EndContractBlock();
 
             ThrowIfGeneric();
index ec75d6d..af5136b 100644 (file)
@@ -487,7 +487,7 @@ namespace System.Reflection.Emit
             // Helper to get constructor token. If usingRef is true, we will never use the def token
 
             if (con == null)
-                throw new ArgumentNullException("con");
+                throw new ArgumentNullException(nameof(con));
             Contract.EndContractBlock();
 
             int tr;
@@ -1271,7 +1271,7 @@ namespace System.Reflection.Emit
                 throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer"));
 
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
             Contract.Ensures(Contract.Result<IResourceWriter>() != null);
@@ -1299,10 +1299,10 @@ namespace System.Reflection.Emit
         public void DefineManifestResource(String name, Stream stream, ResourceAttributes attribute)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             
             if (stream == null)
-                throw new ArgumentNullException("stream");
+                throw new ArgumentNullException(nameof(stream));
             Contract.EndContractBlock();
 
             // Define embedded managed resource to be stored in this module
@@ -1321,7 +1321,7 @@ namespace System.Reflection.Emit
            Contract.EndContractBlock();
 
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
         
@@ -1353,7 +1353,7 @@ namespace System.Reflection.Emit
         internal void DefineUnmanagedResourceInternalNoLock(Byte[] resource)
         {
             if (resource == null)
-                throw new ArgumentNullException("resource");
+                throw new ArgumentNullException(nameof(resource));
             Contract.EndContractBlock();
 
             if (m_moduleData.m_strResourceFileName != null || m_moduleData.m_resourceBytes != null)
@@ -1376,7 +1376,7 @@ namespace System.Reflection.Emit
         internal void DefineUnmanagedResourceFileInternalNoLock(String resourceFileName)
         {
             if (resourceFileName == null)
-                throw new ArgumentNullException("resourceFileName");
+                throw new ArgumentNullException(nameof(resourceFileName));
             Contract.EndContractBlock();
 
             if (m_moduleData.m_resourceBytes != null || m_moduleData.m_strResourceFileName != null)
@@ -1441,7 +1441,7 @@ namespace System.Reflection.Emit
                 throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_GlobalsHaveBeenCreated"));
         
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
 
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
@@ -1636,7 +1636,7 @@ namespace System.Reflection.Emit
         private TypeToken GetTypeTokenWorkerNoLock(Type type, bool getGenericDefinition)
         {
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             Contract.EndContractBlock();
 
             CheckContext(type);
@@ -1769,7 +1769,7 @@ namespace System.Reflection.Emit
             // Return a MemberRef token if MethodInfo is not defined in this module. Or 
             // return the MethodDef token. 
             if (method == null)
-                throw new ArgumentNullException("method");
+                throw new ArgumentNullException(nameof(method));
             Contract.EndContractBlock();
 
             int tr;
@@ -1878,7 +1878,7 @@ namespace System.Reflection.Emit
         {
             if (constructor == null)
             {
-                throw new ArgumentNullException("constructor");
+                throw new ArgumentNullException(nameof(constructor));
             }
 
             lock (SyncRoot)
@@ -1893,7 +1893,7 @@ namespace System.Reflection.Emit
         {
             if (method == null)
             {
-                throw new ArgumentNullException("method");
+                throw new ArgumentNullException(nameof(method));
             }
 
             // useMethodDef flag only affects the result if we pass in a generic method definition. 
@@ -1992,10 +1992,10 @@ namespace System.Reflection.Emit
             Type returnType, Type[] parameterTypes)
         {
             if (arrayClass == null)
-                throw new ArgumentNullException("arrayClass");
+                throw new ArgumentNullException(nameof(arrayClass));
 
             if (methodName == null)
-                throw new ArgumentNullException("methodName");
+                throw new ArgumentNullException(nameof(methodName));
 
             if (methodName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "methodName");
@@ -2151,7 +2151,7 @@ namespace System.Reflection.Emit
         {
             if (str == null)
             {
-                throw new ArgumentNullException("str");
+                throw new ArgumentNullException(nameof(str));
             }
             Contract.EndContractBlock();
 
@@ -2168,7 +2168,7 @@ namespace System.Reflection.Emit
 
             if (sigHelper == null)
             {
-                throw new ArgumentNullException("sigHelper");
+                throw new ArgumentNullException(nameof(sigHelper));
             }
             Contract.EndContractBlock();
 
@@ -2183,7 +2183,7 @@ namespace System.Reflection.Emit
         public SignatureToken GetSignatureToken(byte[] sigBytes, int sigLength)
         {
             if (sigBytes == null)
-                throw new ArgumentNullException("sigBytes");
+                throw new ArgumentNullException(nameof(sigBytes));
             Contract.EndContractBlock();
 
             byte[] localSigBytes = new byte[sigBytes.Length];
@@ -2205,9 +2205,9 @@ namespace System.Reflection.Emit
         public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
         {
             if (con == null)
-                throw new ArgumentNullException("con");
+                throw new ArgumentNullException(nameof(con));
             if (binaryAttribute == null)
-                throw new ArgumentNullException("binaryAttribute");
+                throw new ArgumentNullException(nameof(binaryAttribute));
             Contract.EndContractBlock();
             
             TypeBuilder.DefineCustomAttribute(
@@ -2223,7 +2223,7 @@ namespace System.Reflection.Emit
         {
             if (customBuilder == null)
             {
-                throw new ArgumentNullException("customBuilder");
+                throw new ArgumentNullException(nameof(customBuilder));
             }
             Contract.EndContractBlock();
 
@@ -2271,7 +2271,7 @@ namespace System.Reflection.Emit
         {
             // url cannot be null but can be an empty string 
             if (url == null)
-                throw new ArgumentNullException("url");
+                throw new ArgumentNullException(nameof(url));
             Contract.EndContractBlock();
 
             lock(SyncRoot)
@@ -2316,7 +2316,7 @@ namespace System.Reflection.Emit
 
             if (entryPoint == null)
             {
-                throw new ArgumentNullException("entryPoint");
+                throw new ArgumentNullException(nameof(entryPoint));
             }
             Contract.EndContractBlock();
         
index 693e2d3..615cbb8 100644 (file)
@@ -31,7 +31,7 @@ namespace System.Reflection.Emit {
         {
             if (unmanagedMarshal == null)
             {
-                throw new ArgumentNullException("unmanagedMarshal");
+                throw new ArgumentNullException(nameof(unmanagedMarshal));
             }
             Contract.EndContractBlock();
             
@@ -61,9 +61,9 @@ namespace System.Reflection.Emit {
         public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
         {
             if (con == null)
-                throw new ArgumentNullException("con");
+                throw new ArgumentNullException(nameof(con));
             if (binaryAttribute == null)
-                throw new ArgumentNullException("binaryAttribute");
+                throw new ArgumentNullException(nameof(binaryAttribute));
             Contract.EndContractBlock();
 
             TypeBuilder.DefineCustomAttribute(
@@ -80,7 +80,7 @@ namespace System.Reflection.Emit {
         {
             if (customBuilder == null)
             {
-                throw new ArgumentNullException("customBuilder");
+                throw new ArgumentNullException(nameof(customBuilder));
             }
             Contract.EndContractBlock();
             customBuilder.CreateCustomAttribute((ModuleBuilder) (m_methodBuilder .GetModule()), m_pdToken.Token);
index 5ac69f2..0900ba5 100644 (file)
@@ -47,7 +47,7 @@ namespace System.Reflection.Emit {
             TypeBuilder         containingType) // the containing type
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
             if (name[0] == '\0')
@@ -108,7 +108,7 @@ namespace System.Reflection.Emit {
         {
             if (mdBuilder == null)
             {
-                throw new ArgumentNullException("mdBuilder");
+                throw new ArgumentNullException(nameof(mdBuilder));
             }
 
             m_containingType.ThrowIfCreated();
@@ -150,9 +150,9 @@ namespace System.Reflection.Emit {
         public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
         {
             if (con == null)
-                throw new ArgumentNullException("con");
+                throw new ArgumentNullException(nameof(con));
             if (binaryAttribute == null)
-                throw new ArgumentNullException("binaryAttribute");
+                throw new ArgumentNullException(nameof(binaryAttribute));
             
             m_containingType.ThrowIfCreated();
             TypeBuilder.DefineCustomAttribute(
@@ -169,7 +169,7 @@ namespace System.Reflection.Emit {
         {
             if (customBuilder == null)
             {
-                throw new ArgumentNullException("customBuilder");
+                throw new ArgumentNullException(nameof(customBuilder));
             }
             m_containingType.ThrowIfCreated();
             customBuilder.CreateCustomAttribute(m_moduleBuilder, m_prToken.Token);
index 35e8cc7..102cbc9 100644 (file)
@@ -199,7 +199,7 @@ namespace System.Reflection.Emit
                 throw new ArgumentNullException("module");
 
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
 
             return new SignatureHelper(mod, type);
         }
@@ -315,7 +315,7 @@ namespace System.Reflection.Emit
                     Type t = optionalCustomModifiers[i];
 
                     if (t == null)
-                        throw new ArgumentNullException("optionalCustomModifiers");
+                        throw new ArgumentNullException(nameof(optionalCustomModifiers));
 
                     if (t.HasElementType)
                         throw new ArgumentException(Environment.GetResourceString("Argument_ArraysInvalid"), "optionalCustomModifiers");
@@ -338,7 +338,7 @@ namespace System.Reflection.Emit
                     Type t = requiredCustomModifiers[i];
 
                     if (t == null)
-                        throw new ArgumentNullException("requiredCustomModifiers");
+                        throw new ArgumentNullException(nameof(requiredCustomModifiers));
 
                     if (t.HasElementType)
                         throw new ArgumentException(Environment.GetResourceString("Argument_ArraysInvalid"), "requiredCustomModifiers");
@@ -826,7 +826,7 @@ namespace System.Reflection.Emit
         public void AddArgument(Type argument, bool pinned)
         {
             if (argument == null)
-                throw new ArgumentNullException("argument");
+                throw new ArgumentNullException(nameof(argument));
 
             IncrementArgCounts();
             AddOneArgTypeHelper(argument, pinned);
@@ -858,7 +858,7 @@ namespace System.Reflection.Emit
                 throw new ArgumentException(Environment.GetResourceString("Argument_SigIsFinalized"));
     
             if (argument == null)
-                throw new ArgumentNullException("argument");
+                throw new ArgumentNullException(nameof(argument));
 
             IncrementArgCounts();
     
index 633a2bf..84ece90 100644 (file)
@@ -234,7 +234,7 @@ namespace System.Reflection.Emit
         internal void SetElementType(Type baseType)
         {
             if (baseType == null)
-                throw new ArgumentNullException("baseType");
+                throw new ArgumentNullException(nameof(baseType));
             Contract.EndContractBlock();
 
             m_baseType = baseType;
index c50806a..009d379 100644 (file)
@@ -56,10 +56,10 @@ namespace System.Reflection.Emit {
             public CustAttr(ConstructorInfo con, byte[] binaryAttribute)
             {
                 if (con == null)
-                    throw new ArgumentNullException("con");
+                    throw new ArgumentNullException(nameof(con));
 
                 if (binaryAttribute == null)
-                    throw new ArgumentNullException("binaryAttribute");
+                    throw new ArgumentNullException(nameof(binaryAttribute));
                 Contract.EndContractBlock();
 
                 m_con = con;
@@ -69,7 +69,7 @@ namespace System.Reflection.Emit {
             public CustAttr(CustomAttributeBuilder customBuilder)
             {
                 if (customBuilder == null)
-                    throw new ArgumentNullException("customBuilder");
+                    throw new ArgumentNullException(nameof(customBuilder));
                 Contract.EndContractBlock();
 
                 m_customBuilder = customBuilder;
@@ -595,7 +595,7 @@ namespace System.Reflection.Emit {
             PackingSize iPackingSize, int iTypeSize, TypeBuilder enclosingType)
         {
             if (fullname == null)
-                throw new ArgumentNullException("fullname");
+                throw new ArgumentNullException(nameof(fullname));
 
             if (fullname.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "fullname");
@@ -632,7 +632,7 @@ namespace System.Reflection.Emit {
                     if (interfaces[i] == null)
                     {
                         // cannot contain null in the interface list
-                        throw new ArgumentNullException("interfaces");
+                        throw new ArgumentNullException(nameof(interfaces));
                     }
                 }
                 interfaceTokens = new int[interfaces.Length + 1];
@@ -741,19 +741,19 @@ namespace System.Reflection.Emit {
             CallingConvention nativeCallConv, CharSet nativeCharSet)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
 
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
 
             if (dllName == null)
-                throw new ArgumentNullException("dllName");
+                throw new ArgumentNullException(nameof(dllName));
 
             if (dllName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "dllName");
 
             if (importName == null)
-                throw new ArgumentNullException("importName");
+                throw new ArgumentNullException(nameof(importName));
 
             if (importName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "importName");
@@ -840,7 +840,7 @@ namespace System.Reflection.Emit {
             TypeAttributes typeAttributes;
 
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
 
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
@@ -1508,7 +1508,7 @@ namespace System.Reflection.Emit {
                 throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
 
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -1526,7 +1526,7 @@ namespace System.Reflection.Emit {
                 throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
 
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -1559,7 +1559,7 @@ namespace System.Reflection.Emit {
         public GenericTypeParameterBuilder[] DefineGenericParameters(params string[] names)
         {
             if (names == null)
-                throw new ArgumentNullException("names");
+                throw new ArgumentNullException(nameof(names));
 
             if (names.Length == 0)
                 throw new ArgumentException();
@@ -1567,7 +1567,7 @@ namespace System.Reflection.Emit {
            
             for (int i = 0; i < names.Length; i ++)
                 if (names[i] == null)
-                    throw new ArgumentNullException("names");
+                    throw new ArgumentNullException(nameof(names));
 
             if (m_inst != null)
                 throw new InvalidOperationException();
@@ -1614,10 +1614,10 @@ namespace System.Reflection.Emit {
         private void DefineMethodOverrideNoLock(MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration)
         {
             if (methodInfoBody == null)
-                throw new ArgumentNullException("methodInfoBody");
+                throw new ArgumentNullException(nameof(methodInfoBody));
 
             if (methodInfoDeclaration == null)
-                throw new ArgumentNullException("methodInfoDeclaration");
+                throw new ArgumentNullException(nameof(methodInfoDeclaration));
             Contract.EndContractBlock();
 
             ThrowIfCreated();
@@ -1683,7 +1683,7 @@ namespace System.Reflection.Emit {
             Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
 
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
@@ -2077,7 +2077,7 @@ namespace System.Reflection.Emit {
         private FieldBuilder DefineInitializedDataNoLock(String name, byte[] data, FieldAttributes attributes)
         {
             if (data == null)
-                throw new ArgumentNullException("data");
+                throw new ArgumentNullException(nameof(data));
             Contract.EndContractBlock();
 
             // This method will define an initialized Data in .sdata.
@@ -2151,7 +2151,7 @@ namespace System.Reflection.Emit {
             Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
             Contract.EndContractBlock();
@@ -2208,7 +2208,7 @@ namespace System.Reflection.Emit {
         private EventBuilder DefineEventNoLock(String name, EventAttributes attributes, Type eventtype)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
             if (name[0] == '\0')
@@ -2504,7 +2504,7 @@ namespace System.Reflection.Emit {
         {
             if (interfaceType == null)
             {
-                throw new ArgumentNullException("interfaceType");
+                throw new ArgumentNullException(nameof(interfaceType));
             }
             Contract.EndContractBlock();
 
@@ -2532,7 +2532,7 @@ namespace System.Reflection.Emit {
         private void AddDeclarativeSecurityNoLock(SecurityAction action, PermissionSet pset)
         {
             if (pset == null)
-                throw new ArgumentNullException("pset");
+                throw new ArgumentNullException(nameof(pset));
 
 #pragma warning disable 618
             if (!Enum.IsDefined(typeof(SecurityAction), action) ||
@@ -2583,10 +2583,10 @@ public TypeToken TypeToken
         public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
         {
             if (con == null)
-                throw new ArgumentNullException("con");
+                throw new ArgumentNullException(nameof(con));
 
             if (binaryAttribute == null)
-                throw new ArgumentNullException("binaryAttribute");
+                throw new ArgumentNullException(nameof(binaryAttribute));
             Contract.EndContractBlock();
 
             TypeBuilder.DefineCustomAttribute(m_module, m_tdType.Token, ((ModuleBuilder)m_module).GetConstructorToken(con).Token,
@@ -2597,7 +2597,7 @@ public TypeToken TypeToken
         public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
         {
             if (customBuilder == null)
-                throw new ArgumentNullException("customBuilder");
+                throw new ArgumentNullException(nameof(customBuilder));
             Contract.EndContractBlock();
 
             customBuilder.CreateCustomAttribute((ModuleBuilder)m_module, m_tdType.Token);
index 13b98b6..3bae585 100644 (file)
@@ -28,13 +28,13 @@ namespace System.Reflection.Emit
                 throw new InvalidOperationException();
 
             if (typeArguments == null)
-                throw new ArgumentNullException("typeArguments");
+                throw new ArgumentNullException(nameof(typeArguments));
             Contract.EndContractBlock();
 
             foreach (Type t in typeArguments)
             {
                 if (t == null)
-                    throw new ArgumentNullException("typeArguments");                    
+                    throw new ArgumentNullException(nameof(typeArguments));                    
             }
             
             return new TypeBuilderInstantiation(type, typeArguments);
index 3fd1951..5781006 100644 (file)
@@ -305,7 +305,7 @@ namespace System.Reflection
         public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -320,7 +320,7 @@ namespace System.Reflection
         public override bool IsDefined(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -377,7 +377,7 @@ namespace System.Reflection
         public void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             MemberInfoSerializationHolder.GetSerializationInfo(
index c6a44d4..5a0e8bb 100644 (file)
@@ -325,7 +325,7 @@ namespace System.Reflection
         public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -340,7 +340,7 @@ namespace System.Reflection
         public override bool IsDefined(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -366,7 +366,7 @@ namespace System.Reflection
         public void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
             MemberInfoSerializationHolder.GetSerializationInfo(
                 info,
index ce2630a..a7e4151 100644 (file)
@@ -21,7 +21,7 @@ namespace System.Reflection
     {
            public static TypeInfo GetTypeInfo(this Type type){
             if(type == null){
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             }
             var rcType=(IReflectableType)type;
             if(rcType==null){
index c1b4ee5..ac524bd 100644 (file)
@@ -31,7 +31,7 @@ namespace System.Reflection
             Type[] genericArguments)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             String assemblyName = reflectedClass.Module.Assembly.FullName;
@@ -65,7 +65,7 @@ namespace System.Reflection
         internal MemberInfoSerializationHolder(SerializationInfo info, StreamingContext context) 
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             String assemblyName = info.GetString("AssemblyName");
index dd5d69b..7df9529 100644 (file)
@@ -29,7 +29,7 @@ namespace System.Reflection.Metadata
         {
             if (assembly == null)
             {
-                throw new ArgumentNullException("assembly");
+                throw new ArgumentNullException(nameof(assembly));
             }
 
             blob = null;
index 2d827ba..5ae68cd 100644 (file)
@@ -479,7 +479,7 @@ namespace System.Reflection
         public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -493,7 +493,7 @@ namespace System.Reflection
         public override bool IsDefined(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -898,7 +898,7 @@ namespace System.Reflection
         {
             // Validate the parameters.
             if (delegateType == null)
-                throw new ArgumentNullException("delegateType");
+                throw new ArgumentNullException(nameof(delegateType));
             Contract.EndContractBlock();
 
             RuntimeType rtType = delegateType as RuntimeType;
@@ -924,7 +924,7 @@ namespace System.Reflection
         public override MethodInfo MakeGenericMethod(params Type[] methodInstantiation)
         {
           if (methodInstantiation == null)
-                throw new ArgumentNullException("methodInstantiation");
+                throw new ArgumentNullException(nameof(methodInstantiation));
           Contract.EndContractBlock();
 
             RuntimeType[] methodInstantionRuntimeType = new RuntimeType[methodInstantiation.Length];
@@ -1036,7 +1036,7 @@ namespace System.Reflection
         public void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             if (m_reflectedTypeCache.IsGlobal)
index 8289193..8d93e1e 100644 (file)
@@ -28,7 +28,7 @@ namespace System.Reflection
         void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             UnitySerializationHolder.GetUnitySerializationInfo(info, this);
index 34705a4..d992dbd 100644 (file)
@@ -432,16 +432,16 @@ namespace System.Reflection
             String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
 
             if (types == null)
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             Contract.EndContractBlock();
 
             for (int i = 0; i < types.Length; i++)
             {
                 if (types[i] == null)
-                    throw new ArgumentNullException("types");
+                    throw new ArgumentNullException(nameof(types));
             }
 
             return GetMethodImpl(name, bindingAttr, binder, callConvention, types, modifiers);
@@ -450,16 +450,16 @@ namespace System.Reflection
         public MethodInfo GetMethod(String name, Type[] types)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
 
             if (types == null)
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             Contract.EndContractBlock();
 
             for (int i = 0; i < types.Length; i++)
             {
                 if (types[i] == null)
-                    throw new ArgumentNullException("types");
+                    throw new ArgumentNullException(nameof(types));
             }
 
             return GetMethodImpl(name, Module.DefaultLookup, null, CallingConventions.Any, types, null);
@@ -468,7 +468,7 @@ namespace System.Reflection
         public MethodInfo GetMethod(String name)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             Contract.EndContractBlock();
 
             return GetMethodImpl(name, Module.DefaultLookup, null, CallingConventions.Any,
@@ -1001,7 +1001,7 @@ namespace System.Reflection
         public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -1016,7 +1016,7 @@ namespace System.Reflection
         public override bool IsDefined(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -1039,7 +1039,7 @@ namespace System.Reflection
         {
             if (info == null)
             {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
             UnitySerializationHolder.GetUnitySerializationInfo(info, UnitySerializationHolder.ModuleUnity, this.ScopeName, this.GetRuntimeAssembly());
@@ -1051,7 +1051,7 @@ namespace System.Reflection
         {
             // throw on null strings regardless of the value of "throwOnError"
             if (className == null)
-                throw new ArgumentNullException("className");
+                throw new ArgumentNullException(nameof(className));
 
             RuntimeType retType = null;
             Object keepAlive = null;
@@ -1145,7 +1145,7 @@ namespace System.Reflection
         public override FieldInfo GetField(String name, BindingFlags bindingAttr)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
 
             if (RuntimeType == null)
                 return null;
index 63c6330..df71517 100644 (file)
@@ -157,7 +157,7 @@ namespace System.Reflection
         public virtual Object[] GetCustomAttributes(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             return EmptyArray<Object>.Value;
@@ -166,7 +166,7 @@ namespace System.Reflection
         public virtual bool IsDefined(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             return false;
@@ -403,7 +403,7 @@ namespace System.Reflection
         public void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             // We could be serializing for consumption by a pre-Whidbey
@@ -728,7 +728,7 @@ namespace System.Reflection
         public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             if (MdToken.IsNullToken(m_tkParamDef))
@@ -746,7 +746,7 @@ namespace System.Reflection
         public override bool IsDefined(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             if (MdToken.IsNullToken(m_tkParamDef))
index 8105208..0b28fcb 100644 (file)
@@ -41,7 +41,7 @@ namespace System.Reflection {
         [System.Security.SecurityCritical]  // auto-generated
         public static unsafe Object Box(void *ptr,Type type) {
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             if (!type.IsPointer)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBePointer"),"ptr");
             Contract.EndContractBlock();
index 3e451b1..2768b39 100644 (file)
@@ -332,7 +332,7 @@ namespace System.Reflection
         public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -347,7 +347,7 @@ namespace System.Reflection
         public override bool IsDefined(Type attributeType, bool inherit)
         {
             if (attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -634,7 +634,7 @@ namespace System.Reflection
         public void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             MemberInfoSerializationHolder.GetSerializationInfo(
index f9bfa87..34f6921 100644 (file)
@@ -28,7 +28,7 @@ namespace System.Reflection
         public virtual TypeInfo GetTypeForObject(object value)
         {
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
 
             return MapType(value.GetType().GetTypeInfo());
         }
index 9b55c26..37c93eb 100644 (file)
@@ -68,7 +68,7 @@ namespace System.Reflection {
         [System.Security.SecurityCritical]  // auto-generated_required
         public override void GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
             base.GetObjectData(info, context);
index b4ef9b9..00ab975 100644 (file)
@@ -72,7 +72,7 @@ namespace System.Reflection
 
         public static InterfaceMapping GetRuntimeInterfaceMap(this TypeInfo typeInfo, Type interfaceType)
         {
-            if (typeInfo == null) throw new ArgumentNullException("typeInfo");
+            if (typeInfo == null) throw new ArgumentNullException(nameof(typeInfo));
             if (!(typeInfo is RuntimeType)) throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
 
             return typeInfo.GetInterfaceMap(interfaceType);
@@ -80,7 +80,7 @@ namespace System.Reflection
 
         public static MethodInfo GetMethodInfo(this Delegate del)
         {
-            if (del == null) throw new ArgumentNullException("del");
+            if (del == null) throw new ArgumentNullException(nameof(del));
 
             return del.Method;
         }
index 0d69a65..f9fbb63 100644 (file)
@@ -48,7 +48,7 @@ namespace System.Reflection
         public StrongNameKeyPair(FileStream keyPairFile)
         {
             if (keyPairFile == null)
-                throw new ArgumentNullException("keyPairFile");
+                throw new ArgumentNullException(nameof(keyPairFile));
             Contract.EndContractBlock();
 
             int length = (int)keyPairFile.Length;
@@ -67,7 +67,7 @@ namespace System.Reflection
         public StrongNameKeyPair(byte[] keyPairArray)
         {
             if (keyPairArray == null)
-                throw new ArgumentNullException("keyPairArray");
+                throw new ArgumentNullException(nameof(keyPairArray));
             Contract.EndContractBlock();
 
             _keyPairArray = new byte[keyPairArray.Length];
@@ -96,7 +96,7 @@ namespace System.Reflection
         public StrongNameKeyPair(String keyPairContainer)
         {
             if (keyPairContainer == null)
-                throw new ArgumentNullException("keyPairContainer");
+                throw new ArgumentNullException(nameof(keyPairContainer));
             Contract.EndContractBlock();
 
             _keyPairContainer = keyPairContainer;
index cad4a42..e94cfa2 100644 (file)
@@ -31,7 +31,7 @@ namespace System.Reflection {
         
         public TypeDelegator(Type delegatingType) {
             if (delegatingType == null)
-                throw new ArgumentNullException("delegatingType");
+                throw new ArgumentNullException(nameof(delegatingType));
             Contract.EndContractBlock();
                 
             typeImpl = delegatingType;
index 8235d60..b5f845a 100644 (file)
@@ -36,9 +36,9 @@ namespace System.Resources {
         public LooselyLinkedResourceReference(String looselyLinkedResourceName, String typeName)
         {
             if (looselyLinkedResourceName == null)
-                throw new ArgumentNullException("looselyLinkedResourceName");
+                throw new ArgumentNullException(nameof(looselyLinkedResourceName));
             if (typeName == null)
-                throw new ArgumentNullException("typeName");
+                throw new ArgumentNullException(nameof(typeName));
             if (looselyLinkedResourceName.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "looselyLinkedResourceName");
             if (typeName.Length == 0)
@@ -60,7 +60,7 @@ namespace System.Resources {
         public Object Resolve(Assembly assembly)
         {
             if (assembly == null)
-                throw new ArgumentNullException("assembly");
+                throw new ArgumentNullException(nameof(assembly));
             Contract.EndContractBlock();
 
             Stream data = assembly.GetManifestResourceStream(_manifestResourceName);
index 560cd5f..6517a56 100644 (file)
@@ -35,7 +35,7 @@ namespace System.Resources {
         public NeutralResourcesLanguageAttribute(String cultureName)
         {
             if (cultureName == null)
-                throw new ArgumentNullException("cultureName");
+                throw new ArgumentNullException(nameof(cultureName));
             Contract.EndContractBlock();
 
             _culture = cultureName;
@@ -45,7 +45,7 @@ namespace System.Resources {
         public NeutralResourcesLanguageAttribute(String cultureName, UltimateResourceFallbackLocation location)
         {
             if (cultureName == null)
-                throw new ArgumentNullException("cultureName");
+                throw new ArgumentNullException(nameof(cultureName));
             if (!Enum.IsDefined(typeof(UltimateResourceFallbackLocation), location))
                 throw new ArgumentException(Environment.GetResourceString("Arg_InvalidNeutralResourcesLanguage_FallbackLoc", location));
             Contract.EndContractBlock();
index b088e7f..5a36ea5 100644 (file)
@@ -292,9 +292,9 @@ namespace System.Resources {
         // 
         private ResourceManager(String baseName, String resourceDir, Type usingResourceSet) {
             if (null==baseName)
-                throw new ArgumentNullException("baseName");
+                throw new ArgumentNullException(nameof(baseName));
             if (null==resourceDir)
-                throw new ArgumentNullException("resourceDir");
+                throw new ArgumentNullException(nameof(resourceDir));
             Contract.EndContractBlock();
 
 #if !FEATURE_CORECLR
@@ -337,10 +337,10 @@ namespace System.Resources {
         public ResourceManager(String baseName, Assembly assembly)
         {
             if (null==baseName)
-                throw new ArgumentNullException("baseName");
+                throw new ArgumentNullException(nameof(baseName));
 
             if (null==assembly)
-                throw new ArgumentNullException("assembly");
+                throw new ArgumentNullException(nameof(assembly));
             Contract.EndContractBlock();
 
             if (!(assembly is RuntimeAssembly))
@@ -368,9 +368,9 @@ namespace System.Resources {
         public ResourceManager(String baseName, Assembly assembly, Type usingResourceSet)
         {
             if (null==baseName)
-                throw new ArgumentNullException("baseName");
+                throw new ArgumentNullException(nameof(baseName));
             if (null==assembly)
-                throw new ArgumentNullException("assembly");
+                throw new ArgumentNullException(nameof(assembly));
             Contract.EndContractBlock();
 
 #if !FEATURE_CORECLR
@@ -404,7 +404,7 @@ namespace System.Resources {
         public ResourceManager(Type resourceSource)
         {
             if (null==resourceSource)
-                throw new ArgumentNullException("resourceSource");
+                throw new ArgumentNullException(nameof(resourceSource));
             Contract.EndContractBlock();
 
             if (!(resourceSource is RuntimeType))
@@ -681,7 +681,7 @@ namespace System.Resources {
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable
         public virtual ResourceSet GetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents) {
             if (null==culture)
-                throw new ArgumentNullException("culture");
+                throw new ArgumentNullException(nameof(culture));
             Contract.EndContractBlock();
 
             Dictionary<String,ResourceSet> localResourceSets = _resourceSets;
@@ -846,7 +846,7 @@ namespace System.Resources {
         {
             // Ensure that the assembly reference is not null
             if (a == null) {
-                throw new ArgumentNullException("a", Environment.GetResourceString("ArgumentNull_Assembly"));
+                throw new ArgumentNullException(nameof(a), Environment.GetResourceString("ArgumentNull_Assembly"));
             }
             Contract.EndContractBlock();
 
@@ -1225,7 +1225,7 @@ namespace System.Resources {
         // 
         public virtual String GetString(String name, CultureInfo culture) {
             if (null==name)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             Contract.EndContractBlock();
 
 #if FEATURE_APPX
@@ -1342,7 +1342,7 @@ namespace System.Resources {
         private Object GetObject(String name, CultureInfo culture, bool wrapUnmanagedMemStream)
         {
             if (null==name)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             Contract.EndContractBlock();
 
 #if FEATURE_APPX
@@ -1586,7 +1586,7 @@ namespace System.Resources {
             {
                 if (rm == null)
                 {
-                    throw new ArgumentNullException("rm");
+                    throw new ArgumentNullException(nameof(rm));
                 }
                 _rm = rm;
             }
index a269d5c..64b0f0b 100644 (file)
@@ -176,7 +176,7 @@ namespace System.Resources {
         public ResourceReader(Stream stream)
         {
             if (stream==null)
-                throw new ArgumentNullException("stream");
+                throw new ArgumentNullException(nameof(stream));
             if (!stream.CanRead)
                 throw new ArgumentException(Environment.GetResourceString("Argument_StreamNotReadable"));
             Contract.EndContractBlock();
@@ -1165,7 +1165,7 @@ namespace System.Resources {
         public void GetResourceData(String resourceName, out String resourceType, out byte[] resourceData)
         {
             if (resourceName == null)
-                throw new ArgumentNullException("resourceName");
+                throw new ArgumentNullException(nameof(resourceName));
             Contract.EndContractBlock();
             if (_resCache == null)
                 throw new InvalidOperationException(Environment.GetResourceString("ResourceReaderIsClosed"));
index ccaba23..314cb8d 100644 (file)
@@ -111,7 +111,7 @@ namespace System.Resources {
         public ResourceSet(IResourceReader reader)
         {
             if (reader == null)
-                throw new ArgumentNullException("reader");
+                throw new ArgumentNullException(nameof(reader));
             Contract.EndContractBlock();
             Reader = reader;
             CommonInit();
@@ -122,7 +122,7 @@ namespace System.Resources {
         public ResourceSet(IResourceReader reader, Assembly assembly)
         {
             if (reader == null)
-                throw new ArgumentNullException("reader");
+                throw new ArgumentNullException(nameof(reader));
             Contract.EndContractBlock();
             Reader = reader;
             CommonInit();
@@ -293,7 +293,7 @@ namespace System.Resources {
         private Object GetObjectInternal(String name)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             Contract.EndContractBlock();
 
             Hashtable copyOfTable = Table;  // Avoid a race with Dispose
index 6b512bc..7c7414c 100644 (file)
@@ -285,7 +285,7 @@ namespace System.Resources {
         private Object GetObject(String key, bool ignoreCase, bool isString)
         {
             if (key==null)
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
             if (Reader == null || _resCache == null)
                 throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_ResourceSet"));
             Contract.EndContractBlock();
index f72e810..3272790 100644 (file)
@@ -27,7 +27,7 @@ namespace System.Resources {
         public SatelliteContractVersionAttribute(String version)
         {
             if (version == null)
-                throw new ArgumentNullException("version");
+                throw new ArgumentNullException(nameof(version));
             Contract.EndContractBlock();
             _version = version;
         }
index 037576f..2267a71 100644 (file)
@@ -1869,7 +1869,7 @@ namespace System
             ref StackCrawlMark stackMark)
         {
             if (typeName == null)
-                throw new ArgumentNullException("typeName");
+                throw new ArgumentNullException(nameof(typeName));
             Contract.EndContractBlock();
 
             return RuntimeTypeHandle.GetTypeByName(
@@ -2921,7 +2921,7 @@ namespace System
                 throw new InvalidOperationException(Environment.GetResourceString("Arg_GenericParameter"));
         
             if ((object)ifaceType == null)
-                throw new ArgumentNullException("ifaceType");
+                throw new ArgumentNullException(nameof(ifaceType));
             Contract.EndContractBlock();
 
             RuntimeType ifaceRtType = ifaceType as RuntimeType;
@@ -3446,7 +3446,7 @@ namespace System
         public override bool IsSubclassOf(Type type) 
         {
             if ((object)type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             Contract.EndContractBlock();
             RuntimeType rtType = type as RuntimeType;
             if (rtType == null)
@@ -3862,7 +3862,7 @@ namespace System
         public override bool IsEnumDefined(object value)
         {
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             Contract.EndContractBlock();
 
             // Check if both of them are of the same type
@@ -3909,7 +3909,7 @@ namespace System
         public override string GetEnumName(object value)
         {
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             Contract.EndContractBlock();
 
             Type valueType = value.GetType();
@@ -3943,7 +3943,7 @@ namespace System
         public override Type MakeGenericType(Type[] instantiation)
         {
             if (instantiation == null)
-                throw new ArgumentNullException("instantiation");
+                throw new ArgumentNullException(nameof(instantiation));
             Contract.EndContractBlock();
 
             RuntimeType[] instantiationRuntimeType = new RuntimeType[instantiation.Length];
@@ -4319,7 +4319,7 @@ namespace System
                 {
                     #region Non-TransparentProxy case
                     if (name == null)
-                        throw new ArgumentNullException("name");
+                        throw new ArgumentNullException(nameof(name));
 
                     bool[] isByRef = modifiers == null ? null : modifiers[0].IsByRefArray;
                     
@@ -4373,7 +4373,7 @@ namespace System
 
             #region Name
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
                 
             if (name.Length == 0 || name.Equals(@"[DISPID=0]")) 
             {
@@ -4409,7 +4409,7 @@ namespace System
                     Contract.Assert(IsSetField);
 
                     if (providedArgs == null) 
-                        throw new ArgumentNullException("providedArgs");
+                        throw new ArgumentNullException(nameof(providedArgs));
 
                     if ((bindingFlags & BindingFlags.GetProperty) != 0)
                         // "Can not specify both SetField and GetProperty."
@@ -4756,7 +4756,7 @@ namespace System
         public void GetObjectData(SerializationInfo info, StreamingContext context) 
         {
             if (info==null) 
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             UnitySerializationHolder.GetUnitySerializationInfo(info, this);
@@ -4774,7 +4774,7 @@ namespace System
         public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
         {
             if ((object)attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
@@ -4789,7 +4789,7 @@ namespace System
         public override bool IsDefined(Type attributeType, bool inherit)
         {
             if ((object)attributeType == null)
-                throw new ArgumentNullException("attributeType");
+                throw new ArgumentNullException(nameof(attributeType));
             Contract.EndContractBlock();
 
             RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
index 0585060..11f5327 100644 (file)
@@ -66,7 +66,7 @@ namespace System.Runtime.CompilerServices
             // See comment on AsyncMethodBuilderCore.Start
             // AsyncMethodBuilderCore.Start(ref stateMachine);
 
-            if (stateMachine == null) throw new ArgumentNullException("stateMachine");
+            if (stateMachine == null) throw new ArgumentNullException(nameof(stateMachine));
             Contract.EndContractBlock();
 
             // Run the MoveNext method within a copy-on-write ExecutionContext scope.
@@ -200,7 +200,7 @@ namespace System.Runtime.CompilerServices
         /// <exception cref="System.InvalidOperationException">The builder is not initialized.</exception>
         public void SetException(Exception exception)
         {
-            if (exception == null) throw new ArgumentNullException("exception");
+            if (exception == null) throw new ArgumentNullException(nameof(exception));
             Contract.EndContractBlock();
 
             if (AsyncCausalityTracer.LoggingOn)
@@ -301,7 +301,7 @@ namespace System.Runtime.CompilerServices
             // See comment on AsyncMethodBuilderCore.Start
             // AsyncMethodBuilderCore.Start(ref stateMachine);
 
-            if (stateMachine == null) throw new ArgumentNullException("stateMachine");
+            if (stateMachine == null) throw new ArgumentNullException(nameof(stateMachine));
             Contract.EndContractBlock();
 
             // Run the MoveNext method within a copy-on-write ExecutionContext scope.
@@ -457,7 +457,7 @@ namespace System.Runtime.CompilerServices
             // See comment on AsyncMethodBuilderCore.Start
             // AsyncMethodBuilderCore.Start(ref stateMachine);
 
-            if (stateMachine == null) throw new ArgumentNullException("stateMachine");
+            if (stateMachine == null) throw new ArgumentNullException(nameof(stateMachine));
             Contract.EndContractBlock();
 
             // Run the MoveNext method within a copy-on-write ExecutionContext scope.
@@ -650,7 +650,7 @@ namespace System.Runtime.CompilerServices
         /// <exception cref="System.InvalidOperationException">The task has already completed.</exception>
         public void SetException(Exception exception)
         {
-            if (exception == null) throw new ArgumentNullException("exception");
+            if (exception == null) throw new ArgumentNullException(nameof(exception));
             Contract.EndContractBlock();
 
 
@@ -859,7 +859,7 @@ namespace System.Runtime.CompilerServices
         internal static void Start<TStateMachine>(ref TStateMachine stateMachine)
             where TStateMachine : IAsyncStateMachine
         {
-            if (stateMachine == null) throw new ArgumentNullException("stateMachine");
+            if (stateMachine == null) throw new ArgumentNullException(nameof(stateMachine));
             Contract.EndContractBlock();
 
             // Run the MoveNext method within a copy-on-write ExecutionContext scope.
@@ -887,7 +887,7 @@ namespace System.Runtime.CompilerServices
         /// <exception cref="System.InvalidOperationException">The builder is incorrectly initialized.</exception>
         public void SetStateMachine(IAsyncStateMachine stateMachine)
         {
-            if (stateMachine == null) throw new ArgumentNullException("stateMachine");
+            if (stateMachine == null) throw new ArgumentNullException(nameof(stateMachine));
             Contract.EndContractBlock();
             if (m_stateMachine != null) throw new InvalidOperationException(Environment.GetResourceString("AsyncMethodBuilder_InstanceNotInitialized"));
             m_stateMachine = stateMachine;
index 21d6772..5531e4a 100644 (file)
@@ -231,7 +231,7 @@ namespace System.Runtime.CompilerServices
 
             if (createValueCallback == null)
             {
-                throw new ArgumentNullException("createValueCallback");
+                throw new ArgumentNullException(nameof(createValueCallback));
             }
 
             TValue existingValue;
index aee3bc2..4b99a8a 100644 (file)
@@ -26,12 +26,12 @@ namespace System.Runtime.CompilerServices
         {
             if (format == null)
             {
-                throw new ArgumentNullException("format");
+                throw new ArgumentNullException(nameof(format));
             }
 
             if (arguments == null)
             {
-                throw new ArgumentNullException("arguments");
+                throw new ArgumentNullException(nameof(arguments));
             }
 
             return new ConcreteFormattableString(format, arguments);
index 2751d61..8eb7435 100644 (file)
@@ -36,7 +36,7 @@ namespace System.Runtime.CompilerServices {
         [System.Security.SecurityCritical]  // auto-generated_required
         public override void GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
             base.GetObjectData(info, context);
index ea6bb96..874895f 100644 (file)
@@ -205,7 +205,7 @@ namespace System.Runtime.CompilerServices
         [SecurityCritical]
         internal static void OnCompletedInternal(Task task, Action continuation, bool continueOnCapturedContext, bool flowExecutionContext)
         {
-            if (continuation == null) throw new ArgumentNullException("continuation");
+            if (continuation == null) throw new ArgumentNullException(nameof(continuation));
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
 
             // If TaskWait* ETW events are enabled, trace a beginning event for this await
index db04eb9..2de9c1f 100644 (file)
@@ -17,7 +17,7 @@ namespace System.Runtime.CompilerServices
 
         public TypeDependencyAttribute (string typeName)        
         {
-            if(typeName == null) throw new ArgumentNullException("typeName");
+            if(typeName == null) throw new ArgumentNullException(nameof(typeName));
             Contract.EndContractBlock();
             this.typeName = typeName;
         }
index c1656dc..671d1f0 100644 (file)
@@ -20,7 +20,7 @@ namespace System.Runtime.CompilerServices
         {
             if (String.IsNullOrEmpty(assemblyFullName))
             {
-                throw new ArgumentNullException("assemblyFullName");
+                throw new ArgumentNullException(nameof(assemblyFullName));
             }
             this.assemblyFullName = assemblyFullName;    
         }
index b29b39c..dec3388 100644 (file)
@@ -81,7 +81,7 @@ namespace System.Runtime.CompilerServices
             private static void QueueContinuation(Action continuation, bool flowContext)
             {
                 // Validate arguments
-                if (continuation == null) throw new ArgumentNullException("continuation");
+                if (continuation == null) throw new ArgumentNullException(nameof(continuation));
                 Contract.EndContractBlock();
 
                 if (TplEtwProvider.Log.IsEnabled())
index 7251d90..905f12d 100644 (file)
@@ -101,7 +101,7 @@ namespace System.Runtime.ExceptionServices {
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source", Environment.GetResourceString("ArgumentNull_Obj"));
+                throw new ArgumentNullException(nameof(source), Environment.GetResourceString("ArgumentNull_Obj"));
             }
             
             return new ExceptionDispatchInfo(source);
index 7497c24..8742b9b 100644 (file)
@@ -141,7 +141,7 @@ namespace System.Runtime.InteropServices
         unsafe public static String PtrToStringAnsi(IntPtr ptr, int len)
         {
             if (ptr == IntPtr.Zero)
-                throw new ArgumentNullException("ptr");
+                throw new ArgumentNullException(nameof(ptr));
             if (len < 0)
                 throw new ArgumentException("len");
 
@@ -152,7 +152,7 @@ namespace System.Runtime.InteropServices
         unsafe public static String PtrToStringUni(IntPtr ptr, int len)
         {
             if (ptr == IntPtr.Zero)
-                throw new ArgumentNullException("ptr");
+                throw new ArgumentNullException(nameof(ptr));
             if (len < 0)
                 throw new ArgumentException("len");
 
@@ -227,7 +227,7 @@ namespace System.Runtime.InteropServices
         public static int SizeOf(Object structure)
         {
             if (structure == null)
-                throw new ArgumentNullException("structure");
+                throw new ArgumentNullException(nameof(structure));
             // we never had a check for generics here
             Contract.EndContractBlock();
 
@@ -243,7 +243,7 @@ namespace System.Runtime.InteropServices
         public static int SizeOf(Type t)
         {
             if (t == null)
-                throw new ArgumentNullException("t");
+                throw new ArgumentNullException(nameof(t));
             if (!(t is RuntimeType))
                 throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), "t");
             if (t.IsGenericType)
@@ -302,7 +302,7 @@ namespace System.Runtime.InteropServices
         public static IntPtr OffsetOf(Type t, String fieldName)
         {
             if (t == null)
-                throw new ArgumentNullException("t");
+                throw new ArgumentNullException(nameof(t));
             Contract.EndContractBlock();
             
             FieldInfo f = t.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
@@ -915,7 +915,7 @@ namespace System.Runtime.InteropServices
         public static void Prelink(MethodInfo m)
         {
             if (m == null) 
-                throw new ArgumentNullException("m");
+                throw new ArgumentNullException(nameof(m));
             Contract.EndContractBlock();
 
             RuntimeMethodInfo rmi = m as RuntimeMethodInfo;
@@ -934,7 +934,7 @@ namespace System.Runtime.InteropServices
         public static void PrelinkAll(Type c)
         {
             if (c == null)
-                throw new ArgumentNullException("c");
+                throw new ArgumentNullException(nameof(c));
             Contract.EndContractBlock();
 
             MethodInfo[] mi = c.GetMethods();
@@ -954,7 +954,7 @@ namespace System.Runtime.InteropServices
         public static int NumParamBytes(MethodInfo m)
         {
             if (m == null) 
-                throw new ArgumentNullException("m");
+                throw new ArgumentNullException(nameof(m));
             Contract.EndContractBlock();
 
             RuntimeMethodInfo rmi = m as RuntimeMethodInfo;
@@ -1027,7 +1027,7 @@ namespace System.Runtime.InteropServices
             if (ptr == IntPtr.Zero) return null;
 
             if (structureType == null)
-                throw new ArgumentNullException("structureType");
+                throw new ArgumentNullException(nameof(structureType));
 
             if (structureType.IsGenericType)
                 throw new ArgumentException(Environment.GetResourceString("Argument_NeedNonGenericType"), "structureType");
@@ -1082,7 +1082,7 @@ namespace System.Runtime.InteropServices
         public static IntPtr GetHINSTANCE(Module m)
         {
             if (m == null)
-                throw new ArgumentNullException("m");
+                throw new ArgumentNullException(nameof(m));
             Contract.EndContractBlock();
 
             RuntimeModule rtModule = m as RuntimeModule;
@@ -1094,7 +1094,7 @@ namespace System.Runtime.InteropServices
             }
 
             if (rtModule == null)
-                throw new ArgumentNullException("m",Environment.GetResourceString("Argument_MustBeRuntimeModule"));
+                throw new ArgumentNullException(nameof(m),Environment.GetResourceString("Argument_MustBeRuntimeModule"));
 
             return GetHINSTANCE(rtModule.GetNativeHandle());
         }    
@@ -1358,7 +1358,7 @@ namespace System.Runtime.InteropServices
         public static String GetTypeLibName(ITypeLib typelib)
         {
             if (typelib == null)
-                throw new ArgumentNullException("typelib");
+                throw new ArgumentNullException(nameof(typelib));
             Contract.EndContractBlock();
             
             String strTypeLibName = null;
@@ -1379,7 +1379,7 @@ namespace System.Runtime.InteropServices
         internal static String GetTypeLibNameInternal(ITypeLib typelib)
         {
             if (typelib == null)
-                throw new ArgumentNullException("typelib");
+                throw new ArgumentNullException(nameof(typelib));
             Contract.EndContractBlock();
 
             // Try GUID_ManagedName first
@@ -1484,7 +1484,7 @@ namespace System.Runtime.InteropServices
         public static Guid GetTypeLibGuidForAssembly(Assembly asm)
         {
             if (asm == null)
-                throw new ArgumentNullException("asm");
+                throw new ArgumentNullException(nameof(asm));
             Contract.EndContractBlock();
 
             RuntimeAssembly rtAssembly = asm as RuntimeAssembly;
@@ -1510,7 +1510,7 @@ namespace System.Runtime.InteropServices
         public static void GetTypeLibVersionForAssembly(Assembly inputAssembly, out int majorVersion, out int minorVersion) 
         {
             if (inputAssembly == null)
-                throw new ArgumentNullException("inputAssembly");
+                throw new ArgumentNullException(nameof(inputAssembly));
             Contract.EndContractBlock();
 
             RuntimeAssembly rtAssembly = inputAssembly as RuntimeAssembly;
@@ -1537,7 +1537,7 @@ namespace System.Runtime.InteropServices
         public static String GetTypeInfoName(ITypeInfo typeInfo)
         {
             if (typeInfo == null)
-                throw new ArgumentNullException("typeInfo");
+                throw new ArgumentNullException(nameof(typeInfo));
             Contract.EndContractBlock();
             
             String strTypeLibName = null;
@@ -1558,7 +1558,7 @@ namespace System.Runtime.InteropServices
         internal static String GetTypeInfoNameInternal(ITypeInfo typeInfo, out bool hasManagedName)
         {
             if (typeInfo == null)
-                throw new ArgumentNullException("typeInfo");
+                throw new ArgumentNullException(nameof(typeInfo));
             Contract.EndContractBlock();
             
             // Try ManagedNameGuid first
@@ -2069,7 +2069,7 @@ namespace System.Runtime.InteropServices
         public static Int32 FinalReleaseComObject(Object o)
         {
             if (o == null)
-                throw new ArgumentNullException("o");
+                throw new ArgumentNullException(nameof(o));
             Contract.EndContractBlock();
 
             __ComObject co = null;
@@ -2104,9 +2104,9 @@ namespace System.Runtime.InteropServices
 #else        
             // Validate that the arguments aren't null.
             if (obj == null)
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             if (key == null)
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
             Contract.EndContractBlock();
 
             __ComObject comObj = null;
@@ -2145,9 +2145,9 @@ namespace System.Runtime.InteropServices
 #else          
             // Validate that the arguments aren't null. The data can validly be null.
             if (obj == null)
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             if (key == null)
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
             Contract.EndContractBlock();
 
             __ComObject comObj = null;
@@ -2182,7 +2182,7 @@ namespace System.Runtime.InteropServices
         {
             // Validate the arguments.
             if (t == null)
-                throw new ArgumentNullException("t");
+                throw new ArgumentNullException(nameof(t));
             if (!t.IsCOMObject)
                 throw new ArgumentException(Environment.GetResourceString("Argument_TypeNotComObject"), "t");
             if (t.IsGenericType)
@@ -2342,7 +2342,7 @@ namespace System.Runtime.InteropServices
         public static int GetComSlotForMethodInfo(MemberInfo m)
         {
             if (m== null) 
-                throw new ArgumentNullException("m");
+                throw new ArgumentNullException(nameof(m));
 
             if (!(m is RuntimeMethodInfo))
                 throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), "m");
@@ -2396,7 +2396,7 @@ namespace System.Runtime.InteropServices
             throw new PlatformNotSupportedException();
 #else
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             if (type.IsImport)
                 throw new ArgumentException(Environment.GetResourceString("Argument_TypeMustNotBeComImport"), "type");
             if (type.IsGenericType)
@@ -2644,10 +2644,10 @@ namespace System.Runtime.InteropServices
         {
             // Validate the parameters
             if (ptr == IntPtr.Zero)
-                throw new ArgumentNullException("ptr");
+                throw new ArgumentNullException(nameof(ptr));
             
             if (t == null)
-                throw new ArgumentNullException("t");
+                throw new ArgumentNullException(nameof(t));
             Contract.EndContractBlock();
             
             if ((t as RuntimeType) == null)
@@ -2676,7 +2676,7 @@ namespace System.Runtime.InteropServices
         public static IntPtr GetFunctionPointerForDelegate(Delegate d)
         {
             if (d == null)
-                throw new ArgumentNullException("d");
+                throw new ArgumentNullException(nameof(d));
             Contract.EndContractBlock();
 
             return GetFunctionPointerForDelegateInternal(d);
@@ -2697,7 +2697,7 @@ namespace System.Runtime.InteropServices
         [System.Security.SecurityCritical]  // auto-generated_required
         public static IntPtr SecureStringToBSTR(SecureString s) {
             if( s == null) {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
             Contract.EndContractBlock();
             
@@ -2708,7 +2708,7 @@ namespace System.Runtime.InteropServices
         [System.Security.SecurityCritical]  // auto-generated_required
         public static IntPtr SecureStringToCoTaskMemAnsi(SecureString s) {
             if( s == null) {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
             Contract.EndContractBlock();
 
@@ -2720,7 +2720,7 @@ namespace System.Runtime.InteropServices
         {
             if (s == null)
             {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
             Contract.EndContractBlock();
 
@@ -2764,7 +2764,7 @@ namespace System.Runtime.InteropServices
         [System.Security.SecurityCritical]  // auto-generated_required
         public static IntPtr SecureStringToGlobalAllocAnsi(SecureString s) {
             if( s == null) {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
             Contract.EndContractBlock();
 
@@ -2774,7 +2774,7 @@ namespace System.Runtime.InteropServices
         [System.Security.SecurityCritical]  // auto-generated_required
         public static IntPtr SecureStringToGlobalAllocUnicode(SecureString s) {
             if( s == null) {
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             }
             Contract.EndContractBlock();
 
index 7d3670d..6ae36d8 100644 (file)
@@ -96,7 +96,7 @@ namespace System.Runtime.InteropServices {
         {
             // Validate the arguments.
             if (assembly == null)
-                throw new ArgumentNullException("assembly");
+                throw new ArgumentNullException(nameof(assembly));
 
             if (assembly.ReflectionOnly)
                 throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_AsmLoadedForReflectionOnly"));
@@ -159,7 +159,7 @@ namespace System.Runtime.InteropServices {
         {
             // Validate the arguments.
             if (assembly == null)
-                throw new ArgumentNullException("assembly");
+                throw new ArgumentNullException(nameof(assembly));
 
             if (assembly.ReflectionOnly)
                 throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_AsmLoadedForReflectionOnly"));
@@ -219,7 +219,7 @@ namespace System.Runtime.InteropServices {
         {
             // Validate the arguments.
             if (assembly == null)
-                throw new ArgumentNullException("assembly");
+                throw new ArgumentNullException(nameof(assembly));
             Contract.EndContractBlock();
 
             if (!(assembly is RuntimeAssembly))
@@ -257,7 +257,7 @@ namespace System.Runtime.InteropServices {
         {
 #if FEATURE_COMINTEROP_MANAGED_ACTIVATION
             if(type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             Contract.EndContractBlock();
             if((type as RuntimeType) == null)
                 throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"),"type");
@@ -313,7 +313,7 @@ namespace System.Runtime.InteropServices {
         {
 #if FEATURE_COMINTEROP_MANAGED_ACTIVATION
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             Contract.EndContractBlock();
             if ((type as RuntimeType) == null)
                 throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"),"type");
index a659daf..58600f7 100644 (file)
@@ -245,7 +245,7 @@ using System.Diagnostics.Contracts;
             where T : struct
         {
             if (array == null)
-                throw new ArgumentNullException("array", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(array), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
@@ -317,7 +317,7 @@ using System.Diagnostics.Contracts;
             where T : struct
         {
             if (array == null)
-                throw new ArgumentNullException("array", Environment.GetResourceString("ArgumentNull_Buffer"));
+                throw new ArgumentNullException(nameof(array), Environment.GetResourceString("ArgumentNull_Buffer"));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             if (count < 0)
index 15b1b6a..0d6eba5 100644 (file)
@@ -174,7 +174,7 @@ namespace System.Runtime.InteropServices
         [System.Security.SecuritySafeCritical]
         public bool StartsWith(string value)
         {
-            if (value == null) throw new ArgumentNullException("value");
+            if (value == null) throw new ArgumentNullException(nameof(value));
             if (_length < (uint)value.Length) return false;
             return SubstringEquals(value, startIndex: 0, count: value.Length);
         }
@@ -249,7 +249,7 @@ namespace System.Runtime.InteropServices
         /// </exception>
         public void Append(StringBuffer value, uint startIndex = 0)
         {
-            if (value == null) throw new ArgumentNullException("value");
+            if (value == null) throw new ArgumentNullException(nameof(value));
             if (value.Length == 0) return;
             value.CopyTo(
                 bufferIndex: startIndex,
@@ -271,7 +271,7 @@ namespace System.Runtime.InteropServices
         /// </exception>
         public void Append(StringBuffer value, uint startIndex, uint count)
         {
-            if (value == null) throw new ArgumentNullException("value");
+            if (value == null) throw new ArgumentNullException(nameof(value));
             if (count == 0) return;
             value.CopyTo(
                 bufferIndex: startIndex,
@@ -292,7 +292,7 @@ namespace System.Runtime.InteropServices
         [System.Security.SecuritySafeCritical]
         public unsafe void CopyTo(uint bufferIndex, StringBuffer destination, uint destinationIndex, uint count)
         {
-            if (destination == null) throw new ArgumentNullException("destination");
+            if (destination == null) throw new ArgumentNullException(nameof(destination));
             if (destinationIndex > destination._length) throw new ArgumentOutOfRangeException("destinationIndex");
             if (bufferIndex >= _length) throw new ArgumentOutOfRangeException("bufferIndex");
             if (_length < checked(bufferIndex + count)) throw new ArgumentOutOfRangeException("count");
@@ -320,7 +320,7 @@ namespace System.Runtime.InteropServices
         [System.Security.SecuritySafeCritical]
         public unsafe void CopyFrom(uint bufferIndex, string source, int sourceIndex = 0, int count = -1)
         {
-            if (source == null) throw new ArgumentNullException("source");
+            if (source == null) throw new ArgumentNullException(nameof(source));
             if (bufferIndex > _length) throw new ArgumentOutOfRangeException("bufferIndex");
             if (sourceIndex < 0 || sourceIndex >= source.Length) throw new ArgumentOutOfRangeException("sourceIndex");
             if (count == -1) count = source.Length - sourceIndex;
index e6b148a..04ae95b 100644 (file)
@@ -88,11 +88,11 @@ namespace System.Runtime.InteropServices {
         {
             // Validate the arguments.
             if (typeLib == null)
-                throw new ArgumentNullException("typeLib");
+                throw new ArgumentNullException(nameof(typeLib));
             if (asmFileName == null)
-                throw new ArgumentNullException("asmFileName");         
+                throw new ArgumentNullException(nameof(asmFileName));         
             if (notifySink == null)
-                throw new ArgumentNullException("notifySink");
+                throw new ArgumentNullException(nameof(notifySink));
             if (String.Empty.Equals(asmFileName))
                 throw new ArgumentException(Environment.GetResourceString("Arg_InvalidFileName"), "asmFileName");
             if (asmFileName.Length > Path.MaxPath)
index 5574f3c..2917755 100644 (file)
@@ -67,7 +67,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal void CopyTo(Array array, int arrayIndex)
         {
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
 
             // ICollection expects the destination array to be single-dimensional.
             if (array.Rank != 1)
index af1381c..a5abb4f 100644 (file)
@@ -45,7 +45,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal ConstantSplittableMap(IReadOnlyDictionary<TKey, TValue> data)
         {
             if (data == null)
-                throw new ArgumentNullException("data");
+                throw new ArgumentNullException(nameof(data));
             Contract.EndContractBlock();
 
             this.firstItemIndex = 0;
@@ -56,7 +56,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal ConstantSplittableMap(IMapView<TKey, TValue> data)
         {
             if (data == null)
-                throw new ArgumentNullException("data");
+                throw new ArgumentNullException(nameof(data));
 
             if (((UInt32)Int32.MaxValue) < data.Size)
             {
index 04fe1bf..85ebd71 100644 (file)
@@ -29,7 +29,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public CustomPropertyImpl(PropertyInfo propertyInfo)
         {
             if (propertyInfo == null)
-                throw new ArgumentNullException("propertyInfo");
+                throw new ArgumentNullException(nameof(propertyInfo));
 
             m_property = propertyInfo;
         }
index c1586ee..d48ddcb 100644 (file)
@@ -18,7 +18,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public DictionaryKeyCollection(IDictionary<TKey, TValue> dictionary)
         {
             if (dictionary == null)
-                throw new ArgumentNullException("dictionary");
+                throw new ArgumentNullException(nameof(dictionary));
 
             this.dictionary = dictionary;
         }
@@ -26,7 +26,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public void CopyTo(TKey[] array, int index)
         {
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index");
             if (array.Length <= index && this.Count > 0)
@@ -90,7 +90,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public DictionaryKeyEnumerator(IDictionary<TKey, TValue> dictionary)
         {
             if (dictionary == null)
-                throw new ArgumentNullException("dictionary");
+                throw new ArgumentNullException(nameof(dictionary));
 
             this.dictionary = dictionary;
             this.enumeration = dictionary.GetEnumerator();
index 03e897a..739e244 100644 (file)
@@ -21,7 +21,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime {
         public DictionaryValueCollection(IDictionary<TKey, TValue> dictionary)
         {
             if (dictionary == null)
-                throw new ArgumentNullException("dictionary");
+                throw new ArgumentNullException(nameof(dictionary));
 
             this.dictionary = dictionary;
         }
@@ -29,7 +29,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime {
         public void CopyTo(TValue[] array, int index)
         {
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index");
             if (array.Length <= index && this.Count > 0)
@@ -97,7 +97,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime {
         public DictionaryValueEnumerator(IDictionary<TKey, TValue> dictionary)
         {
             if (dictionary == null)
-                throw new ArgumentNullException("dictionary");
+                throw new ArgumentNullException(nameof(dictionary));
 
             this.dictionary = dictionary;
             this.enumeration = dictionary.GetEnumerator();
index 3600a3a..b4f04d6 100644 (file)
@@ -36,7 +36,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal V Indexer_Get<K, V>(K key)
         {
             if (key == null)
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
             Contract.EndContractBlock();
 
             IMapView<K, V> _this = JitHelpers.UnsafeCast<IMapView<K, V>>(this);
@@ -67,7 +67,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal bool ContainsKey<K, V>(K key)
         {
             if (key == null)
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
 
             IMapView<K, V> _this = JitHelpers.UnsafeCast<IMapView<K, V>>(this);
             return _this.HasKey(key);
@@ -78,7 +78,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal bool TryGetValue<K, V>(K key, out V value)
         {
             if (key == null)
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
 
             IMapView<K, V> _this = JitHelpers.UnsafeCast<IMapView<K, V>>(this);
 
@@ -137,7 +137,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public ReadOnlyDictionaryKeyCollection(IReadOnlyDictionary<TKey, TValue> dictionary)
         {
             if (dictionary == null)
-                throw new ArgumentNullException("dictionary");
+                throw new ArgumentNullException(nameof(dictionary));
 
             this.dictionary = dictionary;
         }
@@ -146,7 +146,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public void CopyTo(TKey[] array, int index)
         {
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index");
             if (array.Length <= index && this.Count > 0)
@@ -192,7 +192,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public ReadOnlyDictionaryKeyEnumerator(IReadOnlyDictionary<TKey, TValue> dictionary)
         {
             if (dictionary == null)
-                throw new ArgumentNullException("dictionary");
+                throw new ArgumentNullException(nameof(dictionary));
 
             this.dictionary = dictionary;
             this.enumeration = dictionary.GetEnumerator();
@@ -232,7 +232,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public ReadOnlyDictionaryValueCollection(IReadOnlyDictionary<TKey, TValue> dictionary)
         {
             if (dictionary == null)
-                throw new ArgumentNullException("dictionary");
+                throw new ArgumentNullException(nameof(dictionary));
 
             this.dictionary = dictionary;
         }
@@ -241,7 +241,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public void CopyTo(TValue[] array, int index)
         {
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             if (index < 0)
                 throw new ArgumentOutOfRangeException("index");
             if (array.Length <= index && this.Count > 0)
@@ -291,7 +291,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public ReadOnlyDictionaryValueEnumerator(IReadOnlyDictionary<TKey, TValue> dictionary)
         {
             if (dictionary == null)
-                throw new ArgumentNullException("dictionary");
+                throw new ArgumentNullException(nameof(dictionary));
 
             this.dictionary = dictionary;
             this.enumeration = dictionary.GetEnumerator();
index f760576..3becad9 100644 (file)
@@ -25,7 +25,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal ListToBindableVectorViewAdapter(IList list)
         {
             if (list == null)
-                throw new ArgumentNullException("list");
+                throw new ArgumentNullException(nameof(list));
 
             Contract.EndContractBlock();
 
index 3e93428..8221f6a 100644 (file)
@@ -37,7 +37,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal ManagedActivationFactory(Type type)
         {
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
 
             // Check whether the type is "exported to WinRT", i.e. it is declared in a managed .winmd and is decorated
             // with at least one ActivatableAttribute or StaticAttribute.
index 395bef9..6e62de2 100644 (file)
@@ -139,7 +139,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal void CopyTo<K, V>(KeyValuePair<K, V>[] array, int arrayIndex)
         {
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
 
             if (arrayIndex < 0)
                 throw new ArgumentOutOfRangeException("arrayIndex");
index d7897ce..d032937 100644 (file)
@@ -34,7 +34,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal V Indexer_Get<K, V>(K key)
         {
             if (key == null)
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
 
             Contract.EndContractBlock();
 
@@ -47,7 +47,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal void Indexer_Set<K, V>(K key, V value)
         {
             if (key == null)
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
 
             Contract.EndContractBlock();
 
@@ -79,7 +79,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal bool ContainsKey<K, V>(K key)
         {
             if (key == null)
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
 
             IMap<K, V> _this = JitHelpers.UnsafeCast<IMap<K, V>>(this);
             return _this.HasKey(key);
@@ -90,7 +90,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal void Add<K, V>(K key, V value)
         {
             if (key == null)
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
 
             if (ContainsKey<K, V>(key))
                 throw new ArgumentException(Environment.GetResourceString("Argument_AddingDuplicate"));
@@ -106,7 +106,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal bool Remove<K, V>(K key)
         {
             if (key == null)
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
 
             IMap<K, V> _this = JitHelpers.UnsafeCast<IMap<K, V>>(this);
             if (!_this.HasKey(key))
@@ -132,7 +132,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal bool TryGetValue<K, V>(K key, out V value)
         {
             if (key == null)
-                throw new ArgumentNullException("key");
+                throw new ArgumentNullException(nameof(key));
 
             IMap<K, V> _this = JitHelpers.UnsafeCast<IMap<K, V>>(this);
             if (!_this.HasKey(key))
index 5eeb0af..e695977 100644 (file)
@@ -82,7 +82,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         internal void CopyTo<T>(T[] array, int arrayIndex)
         {
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
 
             if (arrayIndex < 0)
                 throw new ArgumentOutOfRangeException("arrayIndex");
index 038efd5..5b04329 100644 (file)
@@ -29,9 +29,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
                                               T handler)
         {
             if (addMethod == null)
-                throw new ArgumentNullException("addMethod");
+                throw new ArgumentNullException(nameof(addMethod));
             if (removeMethod == null)
-                throw new ArgumentNullException("removeMethod");
+                throw new ArgumentNullException(nameof(removeMethod));
             Contract.EndContractBlock();
 
             // Managed code allows adding a null event handler, the effect is a no-op.  To match this behavior
@@ -58,7 +58,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public static void RemoveEventHandler<T>(Action<EventRegistrationToken> removeMethod, T handler)
         {
             if (removeMethod == null)
-                throw new ArgumentNullException("removeMethod");
+                throw new ArgumentNullException(nameof(removeMethod));
             Contract.EndContractBlock();
 
             // Managed code allows removing a null event handler, the effect is a no-op.  To match this behavior
@@ -83,7 +83,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public static void RemoveAllEventHandlers(Action<EventRegistrationToken> removeMethod)
         {
             if (removeMethod == null)
-                throw new ArgumentNullException("removeMethod");
+                throw new ArgumentNullException(nameof(removeMethod));
             Contract.EndContractBlock();
 
             // Delegate to managed event registration implementation or native event registration implementation
@@ -1272,7 +1272,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public static IActivationFactory GetActivationFactory(Type type)
         {
             if (type == null)
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
 
             if (type.IsWindowsRuntimeObject && type.IsImport)
             {
@@ -1298,7 +1298,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
                 throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_WinRT"));
 
             if (s == null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
 
             unsafe
             {
index e2ad203..642c4b2 100644 (file)
@@ -30,7 +30,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         public static IEnumerable<string> ResolveNamespace(string namespaceName, string windowsSdkFilePath, IEnumerable<string> packageGraphFilePaths)
         {
             if (namespaceName == null)
-                throw new ArgumentNullException("namespaceName");
+                throw new ArgumentNullException(nameof(namespaceName));
             Contract.EndContractBlock();
 
             string[] packageGraphFilePathsArray = null;
index 2c07325..3a8a626 100644 (file)
@@ -101,7 +101,7 @@ namespace System.Runtime.Loader
         {
             if (assemblyPath == null)
             {
-                throw new ArgumentNullException("assemblyPath");
+                throw new ArgumentNullException(nameof(assemblyPath));
             }
 
             if (Path.IsRelative(assemblyPath))
@@ -118,7 +118,7 @@ namespace System.Runtime.Loader
         {
             if (nativeImagePath == null)
             {
-                throw new ArgumentNullException("nativeImagePath");
+                throw new ArgumentNullException(nameof(nativeImagePath));
             }
 
             if (Path.IsRelative(nativeImagePath))
@@ -147,7 +147,7 @@ namespace System.Runtime.Loader
         {
             if (assembly == null)
             {
-                throw new ArgumentNullException("assembly");
+                throw new ArgumentNullException(nameof(assembly));
             }
             
             int iAssemblyStreamLength = (int)assembly.Length;
@@ -302,7 +302,7 @@ namespace System.Runtime.Loader
         {
             if (unmanagedDllPath == null)
             {
-                throw new ArgumentNullException("unmanagedDllPath");
+                throw new ArgumentNullException(nameof(unmanagedDllPath));
             }
             if (unmanagedDllPath.Length == 0)
             {
@@ -366,7 +366,7 @@ namespace System.Runtime.Loader
         {
             if (context == null)
             {
-                throw new ArgumentNullException("context");
+                throw new ArgumentNullException(nameof(context));
             }
             
             // Try to override the default assembly load context
@@ -389,7 +389,7 @@ namespace System.Runtime.Loader
         {
             if (assemblyPath == null)
             {
-                throw new ArgumentNullException("assemblyPath");
+                throw new ArgumentNullException(nameof(assemblyPath));
             }
             
             String fullPath = Path.GetFullPathInternal(assemblyPath);
@@ -405,7 +405,7 @@ namespace System.Runtime.Loader
         {
             if (assembly == null)
             {
-                throw new ArgumentNullException("assembly");
+                throw new ArgumentNullException(nameof(assembly));
             }
             
             AssemblyLoadContext loadContextForAssembly = null;
index 7df221c..b710ed0 100644 (file)
@@ -25,7 +25,7 @@ namespace System.Runtime.Serialization {
 
         public Object Convert(Object value, Type type) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ChangeType(value, type, CultureInfo.InvariantCulture);
@@ -33,7 +33,7 @@ namespace System.Runtime.Serialization {
 
         public Object Convert(Object value, TypeCode typeCode) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ChangeType(value, typeCode, CultureInfo.InvariantCulture);
@@ -41,7 +41,7 @@ namespace System.Runtime.Serialization {
 
         public bool ToBoolean(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToBoolean(value, CultureInfo.InvariantCulture);
@@ -49,7 +49,7 @@ namespace System.Runtime.Serialization {
 
         public char   ToChar(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToChar(value, CultureInfo.InvariantCulture);
@@ -58,7 +58,7 @@ namespace System.Runtime.Serialization {
         [CLSCompliant(false)]
         public sbyte  ToSByte(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToSByte(value, CultureInfo.InvariantCulture);
@@ -66,7 +66,7 @@ namespace System.Runtime.Serialization {
 
         public byte   ToByte(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToByte(value, CultureInfo.InvariantCulture);
@@ -74,7 +74,7 @@ namespace System.Runtime.Serialization {
 
         public short  ToInt16(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToInt16(value, CultureInfo.InvariantCulture);
@@ -83,7 +83,7 @@ namespace System.Runtime.Serialization {
         [CLSCompliant(false)]
         public ushort ToUInt16(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToUInt16(value, CultureInfo.InvariantCulture);
@@ -91,7 +91,7 @@ namespace System.Runtime.Serialization {
 
         public int    ToInt32(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToInt32(value, CultureInfo.InvariantCulture);
@@ -100,7 +100,7 @@ namespace System.Runtime.Serialization {
         [CLSCompliant(false)]
         public uint   ToUInt32(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToUInt32(value, CultureInfo.InvariantCulture);
@@ -108,7 +108,7 @@ namespace System.Runtime.Serialization {
 
         public long   ToInt64(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToInt64(value, CultureInfo.InvariantCulture);
@@ -117,7 +117,7 @@ namespace System.Runtime.Serialization {
         [CLSCompliant(false)]
         public ulong  ToUInt64(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToUInt64(value, CultureInfo.InvariantCulture);
@@ -125,7 +125,7 @@ namespace System.Runtime.Serialization {
 
         public float  ToSingle(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToSingle(value, CultureInfo.InvariantCulture);
@@ -133,7 +133,7 @@ namespace System.Runtime.Serialization {
 
         public double ToDouble(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToDouble(value, CultureInfo.InvariantCulture);
@@ -141,7 +141,7 @@ namespace System.Runtime.Serialization {
 
         public Decimal ToDecimal(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToDecimal(value, CultureInfo.InvariantCulture);
@@ -149,7 +149,7 @@ namespace System.Runtime.Serialization {
 
         public DateTime ToDateTime(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToDateTime(value, CultureInfo.InvariantCulture);
@@ -157,7 +157,7 @@ namespace System.Runtime.Serialization {
 
         public String   ToString(Object value) {
             if (value==null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return System.Convert.ToString(value, CultureInfo.InvariantCulture);
index c6f27b5..82fb362 100644 (file)
@@ -199,7 +199,7 @@ namespace System.Runtime.Serialization {
             MemberInfo[] members;
     
             if ((object)type==null) {
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             }
             Contract.EndContractBlock();
 
@@ -257,7 +257,7 @@ namespace System.Runtime.Serialization {
         [System.Security.SecurityCritical]  // auto-generated_required
         public static Object GetUninitializedObject(Type type) {
             if ((object)type == null) {
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             }
             Contract.EndContractBlock();
     
@@ -271,7 +271,7 @@ namespace System.Runtime.Serialization {
         [System.Security.SecurityCritical]  // auto-generated_required
         public static Object GetSafeUninitializedObject(Type type) {
              if ((object)type == null) {
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             }
              Contract.EndContractBlock();
     
@@ -348,15 +348,15 @@ namespace System.Runtime.Serialization {
         [System.Security.SecurityCritical]  // auto-generated_required
         public static Object PopulateObjectMembers(Object obj, MemberInfo[] members, Object[] data) {
             if (obj==null) {
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             }
 
             if (members==null) {
-                throw new ArgumentNullException("members");
+                throw new ArgumentNullException(nameof(members));
             }
 
             if (data==null) {
-                throw new ArgumentNullException("data");
+                throw new ArgumentNullException(nameof(data));
             }
 
             if (members.Length!=data.Length) {
@@ -372,7 +372,7 @@ namespace System.Runtime.Serialization {
                 mi = members[i];
     
                 if (mi==null) {
-                    throw new ArgumentNullException("members", Environment.GetResourceString("ArgumentNull_NullMember", i));
+                    throw new ArgumentNullException(nameof(members), Environment.GetResourceString("ArgumentNull_NullMember", i));
                 }
         
                 //If we find an empty, it means that the value was never set during deserialization.
@@ -404,11 +404,11 @@ namespace System.Runtime.Serialization {
         public static Object[] GetObjectData(Object obj, MemberInfo[] members) {
     
             if (obj==null) {
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             }
     
             if (members==null) {
-                throw new ArgumentNullException("members");
+                throw new ArgumentNullException(nameof(members));
             }
             Contract.EndContractBlock();
             
@@ -421,7 +421,7 @@ namespace System.Runtime.Serialization {
                 mi=members[i];
     
                 if (mi==null) {
-                    throw new ArgumentNullException("members", Environment.GetResourceString("ArgumentNull_NullMember", i));
+                    throw new ArgumentNullException(nameof(members), Environment.GetResourceString("ArgumentNull_NullMember", i));
                 }
     
                 if (mi.MemberType==MemberTypes.Field) {
@@ -448,7 +448,7 @@ namespace System.Runtime.Serialization {
         public static ISerializationSurrogate GetSurrogateForCyclicalReference(ISerializationSurrogate innerSurrogate)
         {
             if (innerSurrogate == null)
-                throw new ArgumentNullException("innerSurrogate");
+                throw new ArgumentNullException(nameof(innerSurrogate));
             Contract.EndContractBlock();
             return new SurrogateForCyclicalReference(innerSurrogate);
         }
@@ -462,7 +462,7 @@ namespace System.Runtime.Serialization {
         [System.Security.SecurityCritical]  // auto-generated_required
         public static Type GetTypeFromAssembly(Assembly assem, String name) {
             if (assem==null)
-                throw new ArgumentNullException("assem");
+                throw new ArgumentNullException(nameof(assem));
             Contract.EndContractBlock();
             return assem.GetType(name, false, false);
         }
@@ -499,7 +499,7 @@ namespace System.Runtime.Serialization {
 
         internal static string GetClrAssemblyName(Type type, out bool hasTypeForwardedFrom) {
             if ((object)type == null) {
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             }
 
             object[] typeAttributes = type.GetCustomAttributes(typeof(TypeForwardedFromAttribute), false);
@@ -566,7 +566,7 @@ namespace System.Runtime.Serialization {
         internal SurrogateForCyclicalReference(ISerializationSurrogate innerSurrogate)
         {
             if (innerSurrogate == null)
-                throw new ArgumentNullException("innerSurrogate");
+                throw new ArgumentNullException(nameof(innerSurrogate));
             this.innerSurrogate = innerSurrogate;
         }
 
index 7fea98a..9c89327 100644 (file)
@@ -221,7 +221,7 @@ namespace System.Runtime.Serialization
         public void AddSerializedState(ISafeSerializationData serializedState)
         {
             if (serializedState == null)
-                throw new ArgumentNullException("serializedState");
+                throw new ArgumentNullException(nameof(serializedState));
             if (!serializedState.GetType().IsSerializable)
                 throw new ArgumentException(Environment.GetResourceString("Serialization_NonSerType", serializedState.GetType(), serializedState.GetType().Assembly.FullName));
 
index 94e6825..64a7fca 100644 (file)
@@ -61,12 +61,12 @@ namespace System.Runtime.Serialization
         {
             if ((object)type == null)
             {
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             }
 
             if (converter == null)
             {
-                throw new ArgumentNullException("converter");
+                throw new ArgumentNullException(nameof(converter));
             }
 
             Contract.EndContractBlock();
@@ -96,7 +96,7 @@ namespace System.Runtime.Serialization
             {
                 if (null == value)
                 {
-                    throw new ArgumentNullException("value");
+                    throw new ArgumentNullException(nameof(value));
                 }
                 Contract.EndContractBlock();
            
@@ -116,7 +116,7 @@ namespace System.Runtime.Serialization
             {
                 if (null == value)
                 {
-                    throw new ArgumentNullException("value");
+                    throw new ArgumentNullException(nameof(value));
                 }
                 Contract.EndContractBlock();
                 if (this.requireSameTokenInPartialTrust)
@@ -133,7 +133,7 @@ namespace System.Runtime.Serialization
         {
             if ((object)type == null)
             {
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             }
             Contract.EndContractBlock();
 
@@ -280,12 +280,12 @@ namespace System.Runtime.Serialization
         {
             if (null == name)
             {
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             }
 
             if ((object)type == null)
             {
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             }
             Contract.EndContractBlock();
 
@@ -447,7 +447,7 @@ namespace System.Runtime.Serialization
         {
             if (null == name)
             {
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             }
             Contract.EndContractBlock();
             BCLDebug.Trace("SER", "[SerializationInfo.FindElement]Looking for ", name, " CurrMember is: ", m_currMember);
@@ -514,7 +514,7 @@ namespace System.Runtime.Serialization
 
             if ((object)type == null)
             {
-                throw new ArgumentNullException("type");
+                throw new ArgumentNullException(nameof(type));
             }
             Contract.EndContractBlock();
 
index e8c9c7d..6a340ef 100644 (file)
@@ -356,7 +356,7 @@ namespace System.Runtime.Versioning
         {
             if (frameworkName == null)
             {
-                throw new ArgumentNullException("frameworkName");
+                throw new ArgumentNullException(nameof(frameworkName));
             }
             if (frameworkName.Length == 0)
             {
index dbf98c0..600ba3f 100644 (file)
@@ -26,7 +26,7 @@ namespace System.Runtime.Versioning {
         public TargetFrameworkAttribute(String frameworkName)
         {
             if (frameworkName == null)
-                throw new ArgumentNullException("frameworkName");
+                throw new ArgumentNullException(nameof(frameworkName));
             Contract.EndContractBlock();
             _frameworkName = frameworkName;
         }
index 24ca45e..a56bfbf 100644 (file)
@@ -792,7 +792,7 @@ namespace System
         private RuntimeTypeHandle(SerializationInfo info, StreamingContext context)
         {
             if(info == null) 
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             RuntimeType m = (RuntimeType)info.GetValue("TypeObj", typeof(RuntimeType));
@@ -807,7 +807,7 @@ namespace System
         public void GetObjectData(SerializationInfo info, StreamingContext context) 
         {
             if(info == null) 
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             if (m_type == null)
@@ -959,7 +959,7 @@ namespace System
         private RuntimeMethodHandle(SerializationInfo info, StreamingContext context)
         {
             if(info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
             
             MethodBase m =(MethodBase)info.GetValue("MethodObj", typeof(MethodBase));
@@ -974,7 +974,7 @@ namespace System
         public void GetObjectData(SerializationInfo info, StreamingContext context) 
         {
             if (info == null) 
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             if (m_value == null)
@@ -1646,7 +1646,7 @@ namespace System
         private RuntimeFieldHandle(SerializationInfo info, StreamingContext context)
         {
             if(info==null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
             
             FieldInfo f =(RuntimeFieldInfo) info.GetValue("FieldObj", typeof(RuntimeFieldInfo));
@@ -1664,7 +1664,7 @@ namespace System
         public void GetObjectData(SerializationInfo info, StreamingContext context) 
         {
             if (info == null) 
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             if (m_ptr == null)
index 61334c2..46a1286 100644 (file)
@@ -177,7 +177,7 @@ namespace System.Security
         static internal void ValidateElement( SecurityElement elem, IPermission perm )
         {
             if (elem == null)
-                throw new ArgumentNullException( "elem" );
+                throw new ArgumentNullException( nameof(elem) );
             Contract.EndContractBlock();
                 
             if (!XMLUtil.IsPermissionElement( perm, elem ))
index 83f005f..ffdc607 100644 (file)
@@ -53,7 +53,7 @@ namespace System.Security
         protected HostProtectionException(SerializationInfo info, StreamingContext context) : base(info, context)
         {
             if (info==null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             m_protected = (HostProtectionResource)info.GetValue(ProtectedResourcesName, typeof(HostProtectionResource));
@@ -124,7 +124,7 @@ namespace System.Security
         public override void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info==null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             base.GetObjectData( info, context );
index 46d5552..0c2b33f 100644 (file)
@@ -86,7 +86,7 @@ namespace System.Security {
         public virtual ApplicationTrust DetermineApplicationTrust(Evidence applicationEvidence, Evidence activatorEvidence, TrustManagerContext context)
         {
             if (applicationEvidence == null)
-                throw new ArgumentNullException("applicationEvidence");
+                throw new ArgumentNullException(nameof(applicationEvidence));
             Contract.EndContractBlock();
 
             // This method looks for a trust decision for the ActivationContext in three locations, in order
@@ -154,7 +154,7 @@ namespace System.Security {
         public virtual PermissionSet ResolvePolicy(Evidence evidence)
         {
             if (evidence == null)
-                throw new ArgumentNullException("evidence");
+                throw new ArgumentNullException(nameof(evidence));
             Contract.EndContractBlock();
 
             //
index fba7674..a8779ad 100644 (file)
@@ -156,7 +156,7 @@ namespace System.Security {
         internal override void FromXml( SecurityElement et, bool allowInternalOnly, bool ignoreTypeLoadFailures )
         {
             if (et == null)
-                throw new ArgumentNullException( "et" );
+                throw new ArgumentNullException( nameof(et) );
             Contract.EndContractBlock();
 
             String elem;
index e36f075..824d3c4 100644 (file)
@@ -253,7 +253,7 @@ namespace System.Security {
         public virtual void CopyTo(Array array, int index)
         {
             if (array == null)
-                throw new ArgumentNullException( "array" );
+                throw new ArgumentNullException( nameof(array) );
             Contract.EndContractBlock();
         
             PermissionSetEnumeratorInternal enumerator = new PermissionSetEnumeratorInternal(this);
@@ -1751,7 +1751,7 @@ namespace System.Security {
         internal virtual void FromXml( SecurityElement et, bool allowInternalOnly, bool ignoreTypeLoadFailures )
         {
             if (et == null)
-                throw new ArgumentNullException("et");
+                throw new ArgumentNullException(nameof(et));
 
             if (!et.Tag.Equals(s_str_PermissionSet))
                 throw new ArgumentException(String.Format( null, Environment.GetResourceString( "Argument_InvalidXMLElement" ), "PermissionSet", this.GetType().FullName) );
@@ -1852,7 +1852,7 @@ namespace System.Security {
         internal virtual void FromXml( SecurityDocument doc, int position, bool allowInternalOnly )
         {
             if (doc == null)
-                throw new ArgumentNullException("doc");
+                throw new ArgumentNullException(nameof(doc));
             Contract.EndContractBlock();
             
             if (!doc.GetTagForElement( position ).Equals(s_str_PermissionSet))
index e78c0f1..1896dd9 100644 (file)
@@ -64,7 +64,7 @@ namespace System.Security {
         // The data structure consuming this will be responsible for dealing with null objects as keys.
         public int GetHashCode(Object obj)
         {            
-            if (obj == null) throw new ArgumentNullException("obj");
+            if (obj == null) throw new ArgumentNullException(nameof(obj));
             Contract.EndContractBlock();
             
             String str = obj as String;
index 5f5de0e..0bc689b 100644 (file)
@@ -135,7 +135,7 @@ namespace System.Security.Permissions
         public StrongNameIdentityPermission( StrongNamePublicKeyBlob blob, String name, Version version )
         {
             if (blob == null)
-                throw new ArgumentNullException( "blob" );
+                throw new ArgumentNullException( nameof(blob) );
             if (name != null && name.Equals( "" ))
                 throw new ArgumentException( Environment.GetResourceString( "Argument_EmptyStrongName" ) );      
             Contract.EndContractBlock();
@@ -156,7 +156,7 @@ namespace System.Security.Permissions
             set
             {
                 if (value == null)
-                    throw new ArgumentNullException( "PublicKey" );
+                    throw new ArgumentNullException( nameof(PublicKey) );
                 Contract.EndContractBlock();
                 m_unrestricted = false;
                 if(m_strongNames != null && m_strongNames.Length == 1)
index e0aacaf..823eaba 100644 (file)
@@ -20,7 +20,7 @@ namespace System.Security.Permissions
         public StrongNamePublicKeyBlob( byte[] publicKey )
         {
             if (publicKey == null)
-                throw new ArgumentNullException( "PublicKey" );
+                throw new ArgumentNullException( nameof(PublicKey) );
             Contract.EndContractBlock();
         
             this.PublicKey = new byte[publicKey.Length];
index e62449c..99f86ed 100644 (file)
@@ -110,7 +110,7 @@ namespace System.Security.Permissions
         public UrlIdentityPermission( String site )
         {
             if (site == null)
-                throw new ArgumentNullException( "site" );
+                throw new ArgumentNullException( nameof(site) );
             Contract.EndContractBlock();
             Url = site;
         }
index 9691c03..4d650f2 100644 (file)
@@ -247,7 +247,7 @@ namespace System.Security.Permissions {
 
         public int Add (KeyContainerPermissionAccessEntry accessEntry) {
             if (accessEntry == null)
-                throw new ArgumentNullException("accessEntry");
+                throw new ArgumentNullException(nameof(accessEntry));
             Contract.EndContractBlock();
 
             int index = m_list.IndexOf(accessEntry);
@@ -275,7 +275,7 @@ namespace System.Security.Permissions {
 
         public void Remove (KeyContainerPermissionAccessEntry accessEntry) {
             if (accessEntry == null)
-                throw new ArgumentNullException("accessEntry");
+                throw new ArgumentNullException(nameof(accessEntry));
             Contract.EndContractBlock();
             m_list.Remove(accessEntry);
         }
@@ -292,7 +292,7 @@ namespace System.Security.Permissions {
         /// <internalonly/>
         void ICollection.CopyTo (Array array, int index) {
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             if (array.Rank != 1)
                 throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
             if (index < 0 || index >= array.Length)
@@ -385,7 +385,7 @@ namespace System.Security.Permissions {
 
         public KeyContainerPermission (KeyContainerPermissionFlags flags, KeyContainerPermissionAccessEntry[] accessList) {
             if (accessList == null) 
-                throw new ArgumentNullException("accessList");
+                throw new ArgumentNullException(nameof(accessList));
             Contract.EndContractBlock();
 
             VerifyFlags(flags);
index 57b216e..9b30d05 100644 (file)
@@ -83,7 +83,7 @@ namespace System.Security.Policy {
 
         public ApplicationTrust(PermissionSet defaultGrantSet, IEnumerable<StrongName> fullTrustAssemblies) {
             if (fullTrustAssemblies == null) {
-                throw new ArgumentNullException("fullTrustAssemblies");
+                throw new ArgumentNullException(nameof(fullTrustAssemblies));
             }
 
             InitDefaultGrantSet(defaultGrantSet);
@@ -104,7 +104,7 @@ namespace System.Security.Policy {
         // IEnumerable virtual dispatches on startup when there are no fullTrustAssemblies (CoreCLR)
         private void InitDefaultGrantSet(PermissionSet defaultGrantSet) {
             if (defaultGrantSet == null) {
-                throw new ArgumentNullException("defaultGrantSet");
+                throw new ArgumentNullException(nameof(defaultGrantSet));
             }
 
             // Creating a PolicyStatement copies the incoming permission set, so we don't have to worry
@@ -120,7 +120,7 @@ namespace System.Security.Policy {
             }
             set {
                 if (value == null)
-                    throw new ArgumentNullException("value", Environment.GetResourceString("Argument_InvalidAppId"));
+                    throw new ArgumentNullException(nameof(value), Environment.GetResourceString("Argument_InvalidAppId"));
                 Contract.EndContractBlock();
                 m_appId = value;
             }
@@ -223,7 +223,7 @@ namespace System.Security.Policy {
 
         public void FromXml (SecurityElement element) {
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
             if (String.Compare(element.Tag, "ApplicationTrust", StringComparison.Ordinal) != 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_InvalidXML"));
 
@@ -455,7 +455,7 @@ namespace System.Security.Policy {
         [System.Security.SecurityCritical]  // auto-generated
         public int Add (ApplicationTrust trust) {
             if (trust == null)
-                throw new ArgumentNullException("trust");
+                throw new ArgumentNullException(nameof(trust));
             if (trust.ApplicationIdentity == null)
                 throw new ArgumentException(Environment.GetResourceString("Argument_ApplicationTrustShouldHaveIdentity"));
             Contract.EndContractBlock();
@@ -472,7 +472,7 @@ namespace System.Security.Policy {
         [System.Security.SecurityCritical]  // auto-generated
         public void AddRange (ApplicationTrust[] trusts) {
             if (trusts == null)
-                throw new ArgumentNullException("trusts");
+                throw new ArgumentNullException(nameof(trusts));
             Contract.EndContractBlock();
 
             int i=0;
@@ -491,7 +491,7 @@ namespace System.Security.Policy {
         [System.Security.SecurityCritical]  // auto-generated
         public void AddRange (ApplicationTrustCollection trusts) {
             if (trusts == null)
-                throw new ArgumentNullException("trusts");
+                throw new ArgumentNullException(nameof(trusts));
             Contract.EndContractBlock();
 
             int i = 0;
@@ -527,7 +527,7 @@ namespace System.Security.Policy {
         [System.Security.SecurityCritical]  // auto-generated
         public void Remove (ApplicationTrust trust) {
             if (trust == null)
-                throw new ArgumentNullException("trust");
+                throw new ArgumentNullException(nameof(trust));
             if (trust.ApplicationIdentity == null)
                 throw new ArgumentException(Environment.GetResourceString("Argument_ApplicationTrustShouldHaveIdentity"));
             Contract.EndContractBlock();
@@ -543,7 +543,7 @@ namespace System.Security.Policy {
         [System.Security.SecurityCritical]  // auto-generated
         public void RemoveRange (ApplicationTrust[] trusts) {
             if (trusts == null)
-                throw new ArgumentNullException("trusts");
+                throw new ArgumentNullException(nameof(trusts));
             Contract.EndContractBlock();
 
             int i=0;
@@ -562,7 +562,7 @@ namespace System.Security.Policy {
         [System.Security.SecurityCritical]  // auto-generated
         public void RemoveRange (ApplicationTrustCollection trusts) {
             if (trusts == null)
-                throw new ArgumentNullException("trusts");
+                throw new ArgumentNullException(nameof(trusts));
             Contract.EndContractBlock();
 
             int i = 0;
@@ -610,7 +610,7 @@ namespace System.Security.Policy {
         [System.Security.SecuritySafeCritical] // overrides public transparent member
         void ICollection.CopyTo(Array array, int index) {
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             if (array.Rank != 1)
                 throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
             if (index < 0 || index >= array.Length)
index 8bf8aa7..153d0a4 100644 (file)
@@ -355,7 +355,7 @@ namespace System.Security.Policy
         public void AddHost(object id)
         {
             if (id == null)
-                throw new ArgumentNullException("id");
+                throw new ArgumentNullException(nameof(id));
             if (!id.GetType().IsSerializable)
                 throw new ArgumentException(Environment.GetResourceString("Policy_EvidenceMustBeSerializable"), "id");
             Contract.EndContractBlock();
@@ -377,7 +377,7 @@ namespace System.Security.Policy
         public void AddAssembly(object id)
         {
             if (id == null)
-                throw new ArgumentNullException("id");
+                throw new ArgumentNullException(nameof(id));
             if (!id.GetType().IsSerializable)
                 throw new ArgumentException(Environment.GetResourceString("Policy_EvidenceMustBeSerializable"), "id");
             Contract.EndContractBlock();
@@ -398,7 +398,7 @@ namespace System.Security.Policy
         public void AddAssemblyEvidence<T>(T evidence) where T : EvidenceBase
         {
             if (evidence == null)
-                throw new ArgumentNullException("evidence");
+                throw new ArgumentNullException(nameof(evidence));
             Contract.EndContractBlock();
 
             // Index the evidence under the type that the Add function was called with, unless we were given
@@ -455,7 +455,7 @@ namespace System.Security.Policy
         public void AddHostEvidence<T>(T evidence) where T : EvidenceBase
         {
             if (evidence == null)
-                throw new ArgumentNullException("evidence");
+                throw new ArgumentNullException(nameof(evidence));
             Contract.EndContractBlock();
 
             // Index the evidence under the type that the Add function was called with, unless we were given
@@ -1064,7 +1064,7 @@ namespace System.Security.Policy
         public void CopyTo(Array array, int index)
         {
             if (array == null)
-                throw new ArgumentNullException("array");
+                throw new ArgumentNullException(nameof(array));
             if (index < 0 || index > array.Length - Count)
                 throw new ArgumentOutOfRangeException("index");
             Contract.EndContractBlock();
@@ -1445,7 +1445,7 @@ namespace System.Security.Policy
         public void RemoveType(Type t)
         {
             if (t == null)
-                throw new ArgumentNullException("t");
+                throw new ArgumentNullException(nameof(t));
             Contract.EndContractBlock();
 
             using (EvidenceLockHolder lockHolder = new EvidenceLockHolder(this, EvidenceLockHolder.LockType.Writer))
index 72c07d1..0c02a18 100644 (file)
@@ -357,7 +357,7 @@ namespace System.Security.Policy {
         internal void FromXml( SecurityElement et, PolicyLevel level, bool allowInternalOnly )
         {
             if (et == null)
-                throw new ArgumentNullException( "et" );
+                throw new ArgumentNullException( nameof(et) );
 
             if (!et.Tag.Equals( "PolicyStatement" ))
                 throw new ArgumentException( String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString( "Argument_InvalidXMLElement" ),  "PolicyStatement", this.GetType().FullName ) );
@@ -434,7 +434,7 @@ namespace System.Security.Policy {
         internal void FromXml( SecurityDocument doc, int position, PolicyLevel level, bool allowInternalOnly )
         {
             if (doc == null)
-                throw new ArgumentNullException( "doc" );
+                throw new ArgumentNullException( nameof(doc) );
             Contract.EndContractBlock();
 
             if (!doc.GetTagForElement( position ).Equals( "PolicyStatement" ))
index e7c6cd3..9c954d2 100644 (file)
@@ -26,7 +26,7 @@ namespace System.Security.Policy
         public Site(String name)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             Contract.EndContractBlock();
 
             m_name = new SiteString( name );
index c49f2b0..4ae95b4 100644 (file)
@@ -42,15 +42,15 @@ namespace System.Security.Policy {
         internal StrongName(StrongNamePublicKeyBlob blob, String name, Version version, Assembly assembly)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (String.IsNullOrEmpty(name))
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyStrongName"));
 
             if (blob == null)
-                throw new ArgumentNullException("blob");
+                throw new ArgumentNullException(nameof(blob));
 
             if (version == null)
-                throw new ArgumentNullException("version");
+                throw new ArgumentNullException(nameof(version));
             Contract.EndContractBlock();
 
             RuntimeAssembly rtAssembly = assembly as RuntimeAssembly;
@@ -154,7 +154,7 @@ namespace System.Security.Policy {
         internal void FromXml (SecurityElement element)
         {
             if (element == null)
-                throw new ArgumentNullException("element");
+                throw new ArgumentNullException(nameof(element));
             if (String.Compare(element.Tag, "StrongName", StringComparison.Ordinal) != 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_InvalidXML"));
             Contract.EndContractBlock();
index d3ad4f8..dba8ca8 100644 (file)
@@ -25,7 +25,7 @@ namespace System.Security.Policy {
         internal Url( String name, bool parsed )
         {
             if (name == null)
-                throw new ArgumentNullException( "name" );
+                throw new ArgumentNullException( nameof(name) );
             Contract.EndContractBlock();
 
             m_url = new URLString( name, parsed );
@@ -34,7 +34,7 @@ namespace System.Security.Policy {
         public Url( String name )
         {
             if (name == null)
-                throw new ArgumentNullException( "name" );
+                throw new ArgumentNullException( nameof(name) );
             Contract.EndContractBlock();
 
             m_url = new URLString( name );
index c999abe..267c059 100644 (file)
@@ -60,7 +60,7 @@ namespace System.Security.Policy {
         public static Zone CreateFromUrl( String url )
         {
             if (url == null)
-                throw new ArgumentNullException( "url" );
+                throw new ArgumentNullException( nameof(url) );
             Contract.EndContractBlock();
 
             return new Zone( url );
index 9f925b5..667bf7f 100644 (file)
@@ -99,7 +99,7 @@ namespace System.Security
         public static SecurityElement FromString( String xml )
         {
             if (xml == null)
-                throw new ArgumentNullException( "xml" );
+                throw new ArgumentNullException( nameof(xml) );
             Contract.EndContractBlock();
 
             return new Parser( xml ).GetTopElement();
@@ -109,7 +109,7 @@ namespace System.Security
         public SecurityElement( String tag )
         {
             if (tag == null)
-                throw new ArgumentNullException( "tag" );
+                throw new ArgumentNullException( nameof(tag) );
         
             if (!IsValidTag( tag ))
                 throw new ArgumentException( String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString( "Argument_InvalidElementTag" ), tag ) );
@@ -122,7 +122,7 @@ namespace System.Security
         public SecurityElement( String tag, String text )
         {
             if (tag == null)
-                throw new ArgumentNullException( "tag" );
+                throw new ArgumentNullException( nameof(tag) );
         
             if (!IsValidTag( tag ))
                 throw new ArgumentException( String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString( "Argument_InvalidElementTag" ), tag ) );
@@ -148,7 +148,7 @@ namespace System.Security
             set
             {
                 if (value == null)
-                    throw new ArgumentNullException( "Tag" );
+                    throw new ArgumentNullException( nameof(Tag) );
         
                 if (!IsValidTag( value ))
                     throw new ArgumentException( String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString( "Argument_InvalidElementTag" ), value ) );
@@ -314,10 +314,10 @@ namespace System.Security
         public void AddAttribute( String name, String value )
         {   
             if (name == null)
-                throw new ArgumentNullException( "name" );
+                throw new ArgumentNullException( nameof(name) );
                 
             if (value == null)
-                throw new ArgumentNullException( "value" );
+                throw new ArgumentNullException( nameof(value) );
         
             if (!IsValidAttributeName( name ))
                 throw new ArgumentException( String.Format( CultureInfo.CurrentCulture, Environment.GetResourceString( "Argument_InvalidElementName" ), name ) );
@@ -332,7 +332,7 @@ namespace System.Security
         public void AddChild( SecurityElement child )
         {   
             if (child == null)
-                throw new ArgumentNullException( "child" );
+                throw new ArgumentNullException( nameof(child) );
             Contract.EndContractBlock();
         
             if (m_lChildren == null)
@@ -344,7 +344,7 @@ namespace System.Security
         internal void AddChild( ISecurityElementFactory child )
         {
             if (child == null)
-                throw new ArgumentNullException( "child" );
+                throw new ArgumentNullException( nameof(child) );
             Contract.EndContractBlock();
         
             if (m_lChildren == null)
@@ -356,7 +356,7 @@ namespace System.Security
         internal void AddChildNoDuplicates( ISecurityElementFactory child )
         {   
             if (child == null)
-                throw new ArgumentNullException( "child" );
+                throw new ArgumentNullException( nameof(child) );
             Contract.EndContractBlock();
         
             if (m_lChildren == null)
@@ -772,7 +772,7 @@ namespace System.Security
         public String Attribute( String name )
         {
             if (name == null)
-                throw new ArgumentNullException( "name" );
+                throw new ArgumentNullException( nameof(name) );
             Contract.EndContractBlock();
                 
             // Note: we don't check for validity here because an
@@ -810,7 +810,7 @@ namespace System.Security
             // find the one are are asked for (matching tags)
 
             if (tag == null)
-                throw new ArgumentNullException( "tag" );
+                throw new ArgumentNullException( nameof(tag) );
             Contract.EndContractBlock();
                 
             // Note: we don't check for a valid tag here because
@@ -869,7 +869,7 @@ namespace System.Security
             // child's child, depth-first
             
             if (strLocalName == null)
-                throw new ArgumentNullException( "strLocalName" );
+                throw new ArgumentNullException( nameof(strLocalName) );
             Contract.EndContractBlock();
                 
             // Note: we don't check for a valid tag here because
@@ -901,7 +901,7 @@ namespace System.Security
             // child's child, depth-first
             
             if (tag == null)
-                throw new ArgumentNullException( "tag" );
+                throw new ArgumentNullException( nameof(tag) );
             Contract.EndContractBlock();
                 
             // Note: we don't check for a valid tag here because
index ca06da0..4de9d65 100644 (file)
@@ -229,7 +229,7 @@ namespace System.Security
         protected SecurityException(SerializationInfo info, StreamingContext context) : base (info, context)
         {
             if (info==null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             try
@@ -605,7 +605,7 @@ namespace System.Security
         protected SecurityException(SerializationInfo info, StreamingContext context) : base(info, context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
         }
 
@@ -643,7 +643,7 @@ namespace System.Security
         public override void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             base.GetObjectData(info, context);
index 5c46dfc..9d70949 100644 (file)
@@ -77,7 +77,7 @@ namespace System.Security {
         public static PermissionSet GetStandardSandbox(Evidence evidence)
         {
             if (evidence == null)
-                throw new ArgumentNullException("evidence");
+                throw new ArgumentNullException(nameof(evidence));
             Contract.EndContractBlock();
 
             //
@@ -160,7 +160,7 @@ namespace System.Security {
         static public PolicyLevel LoadPolicyLevelFromFile(string path, PolicyLevelType type)
         {
             if (path == null)
-               throw new ArgumentNullException( "path" );
+               throw new ArgumentNullException( nameof(path) );
             Contract.EndContractBlock();
 
             if (!AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
@@ -197,7 +197,7 @@ namespace System.Security {
         private static PolicyLevel LoadPolicyLevelFromStringHelper (string str, string path, PolicyLevelType type)
         {
             if (str == null)
-                throw new ArgumentNullException( "str" );
+                throw new ArgumentNullException( nameof(str) );
             Contract.EndContractBlock();
 
             PolicyLevel level = new PolicyLevel(type, path);
index 709744f..4ca1cf6 100644 (file)
@@ -73,7 +73,7 @@ namespace System.Security.Util
         public static byte[] DecodeHexString(String hexString)
         {
             if (hexString == null)
-                throw new ArgumentNullException( "hexString" );
+                throw new ArgumentNullException( nameof(hexString) );
             Contract.EndContractBlock();
                     
             bool spaceSkippingMode = false;    
index 19937f5..03d6998 100644 (file)
@@ -122,7 +122,7 @@ namespace System.Security.Util {
         public void AddExpressions( String str )
         {
             if (str == null)
-                throw new ArgumentNullException( "str" );
+                throw new ArgumentNullException( nameof(str) );
             Contract.EndContractBlock();
             if (str.Length == 0)
                 return;
@@ -210,14 +210,14 @@ namespace System.Security.Util {
         {
             if (str == null)
             {
-                throw new ArgumentNullException( "str" );
+                throw new ArgumentNullException( nameof(str) );
             }
             Contract.EndContractBlock();
             ArrayList retArrayList = new ArrayList();
             for (int index = 0; index < str.Length; ++index)
             {
                 if (str[index] == null)
-                    throw new ArgumentNullException( "str" );
+                    throw new ArgumentNullException( nameof(str) );
 
                 // Replace alternate directory separators
                 String oneString = StaticProcessWholeString( str[index] );
index 51ae24c..997cb2c 100644 (file)
@@ -680,7 +680,7 @@ namespace System.Security.Util {
         {
             if (url == null)
             {
-                throw new ArgumentNullException( "url" );
+                throw new ArgumentNullException( nameof(url) );
             }
             Contract.EndContractBlock();
             
index a05f9f2..b02af54 100644 (file)
@@ -417,7 +417,7 @@ namespace System
         public static int Compare(String strA, String strB, CultureInfo culture, CompareOptions options) {
             if (culture == null)
             {
-                throw new ArgumentNullException("culture");
+                throw new ArgumentNullException(nameof(culture));
             }
             Contract.EndContractBlock();
 
@@ -511,7 +511,7 @@ namespace System
         {
             if (culture == null)
             {
-                throw new ArgumentNullException("culture");
+                throw new ArgumentNullException(nameof(culture));
             }
             Contract.EndContractBlock();
 
@@ -728,7 +728,7 @@ namespace System
         [ComVisible(false)]
         public Boolean EndsWith(String value, StringComparison comparisonType) {
             if( (Object)value == null) {
-                throw new ArgumentNullException("value");                                
+                throw new ArgumentNullException(nameof(value));                                
             }
 
             if( comparisonType < StringComparison.CurrentCulture || comparisonType > StringComparison.OrdinalIgnoreCase) {
@@ -774,7 +774,7 @@ namespace System
         [Pure]
         public Boolean EndsWith(String value, Boolean ignoreCase, CultureInfo culture) {
             if (null==value) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             
@@ -1073,7 +1073,7 @@ namespace System
         [Pure]
         public Boolean StartsWith(String value) {
             if ((Object)value == null) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
             return StartsWith(value, StringComparison.CurrentCulture);
@@ -1084,7 +1084,7 @@ namespace System
         [ComVisible(false)]
         public Boolean StartsWith(String value, StringComparison comparisonType) {
             if( (Object)value == null) {
-                throw new ArgumentNullException("value");                                
+                throw new ArgumentNullException(nameof(value));                                
             }
 
             if( comparisonType < StringComparison.CurrentCulture || comparisonType > StringComparison.OrdinalIgnoreCase) {
@@ -1140,7 +1140,7 @@ namespace System
         [Pure]
         public Boolean StartsWith(String value, Boolean ignoreCase, CultureInfo culture) {
             if (null==value) {
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             Contract.EndContractBlock();
 
index 8c81897..8dd1a03 100644 (file)
@@ -114,7 +114,7 @@ namespace System
         {
             if (args == null)
             {
-                throw new ArgumentNullException("args");
+                throw new ArgumentNullException(nameof(args));
             }
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
@@ -181,7 +181,7 @@ namespace System
         public static string Concat<T>(IEnumerable<T> values)
         {
             if (values == null)
-                throw new ArgumentNullException("values");
+                throw new ArgumentNullException(nameof(values));
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
 
@@ -232,7 +232,7 @@ namespace System
         public static string Concat(IEnumerable<string> values)
         {
             if (values == null)
-                throw new ArgumentNullException("values");
+                throw new ArgumentNullException(nameof(values));
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
 
@@ -369,7 +369,7 @@ namespace System
         [System.Security.SecuritySafeCritical]
         public static String Concat(params String[] values) {
             if (values == null)
-                throw new ArgumentNullException("values");
+                throw new ArgumentNullException(nameof(values));
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
 
@@ -456,7 +456,7 @@ namespace System
             {
                 // To preserve the original exception behavior, throw an exception about format if both
                 // args and format are null. The actual null check for format is in FormatHelper.
-                throw new ArgumentNullException((format == null) ? "format" : "args");
+                throw new ArgumentNullException((format == null) ? nameof(format) : nameof(args));
             }
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
@@ -484,7 +484,7 @@ namespace System
             {
                 // To preserve the original exception behavior, throw an exception about format if both
                 // args and format are null. The actual null check for format is in FormatHelper.
-                throw new ArgumentNullException((format == null) ? "format" : "args");
+                throw new ArgumentNullException((format == null) ? nameof(format) : nameof(args));
             }
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
@@ -494,7 +494,7 @@ namespace System
         
         private static String FormatHelper(IFormatProvider provider, String format, ParamsArray args) {
             if (format == null)
-                throw new ArgumentNullException("format");
+                throw new ArgumentNullException(nameof(format));
             
             return StringBuilderCache.GetStringAndRelease(
                 StringBuilderCache
@@ -506,7 +506,7 @@ namespace System
         public String Insert(int startIndex, String value)
         {
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             if (startIndex < 0 || startIndex > this.Length)
                 throw new ArgumentOutOfRangeException("startIndex");
             Contract.Ensures(Contract.Result<String>() != null);
@@ -546,7 +546,7 @@ namespace System
         //
         public static String Join(String separator, params String[] value) {
             if (value==null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             Contract.EndContractBlock();
             return Join(separator, value, 0, value.Length);
         }
@@ -555,7 +555,7 @@ namespace System
         public static string Join(string separator, params object[] values)
         {
             if (values == null)
-                throw new ArgumentNullException("values");
+                throw new ArgumentNullException(nameof(values));
             Contract.EndContractBlock();
 
             if (values.Length == 0 || values[0] == null)
@@ -588,7 +588,7 @@ namespace System
         public static String Join<T>(String separator, IEnumerable<T> values)
         {
             if (values == null)
-                throw new ArgumentNullException("values");
+                throw new ArgumentNullException(nameof(values));
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
 
@@ -638,7 +638,7 @@ namespace System
         [ComVisible(false)]
         public static String Join(String separator, IEnumerable<String> values) {
             if (values == null)
-                throw new ArgumentNullException("values");
+                throw new ArgumentNullException(nameof(values));
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
 
@@ -671,7 +671,7 @@ namespace System
         public unsafe static String Join(String separator, String[] value, int startIndex, int count) {
             //Range check the array
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
 
             if (startIndex < 0)
                 throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
@@ -935,7 +935,7 @@ namespace System
         public String Replace(String oldValue, String newValue)
         {
             if (oldValue == null)
-                throw new ArgumentNullException("oldValue");
+                throw new ArgumentNullException(nameof(oldValue));
             // Note that if newValue is null, we treat it like String.Empty.
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
@@ -1412,7 +1412,7 @@ namespace System
         public String ToLower(CultureInfo culture) {
             if (culture == null)
             {
-                throw new ArgumentNullException("culture");
+                throw new ArgumentNullException(nameof(culture));
             }
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
@@ -1441,7 +1441,7 @@ namespace System
         public String ToUpper(CultureInfo culture) {
             if (culture == null)
             {
-                throw new ArgumentNullException("culture");
+                throw new ArgumentNullException(nameof(culture));
             }
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
index b972529..e4e0738 100644 (file)
@@ -142,7 +142,7 @@ namespace System
         public int IndexOf(String value, int startIndex, int count, StringComparison comparisonType) {
             // Validate inputs
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
 
             if (startIndex < 0 || startIndex > this.Length)
                 throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_Index"));
@@ -302,7 +302,7 @@ namespace System
         [System.Security.SecuritySafeCritical]
         public int LastIndexOf(String value, int startIndex, int count, StringComparison comparisonType) {
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             Contract.EndContractBlock();
 
             // Special case for 0 length input strings
index 4430357..e772a7c 100644 (file)
@@ -115,7 +115,7 @@ namespace System {
         unsafe public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count)
         {
             if (destination == null)
-                throw new ArgumentNullException("destination");
+                throw new ArgumentNullException(nameof(destination));
             if (count < 0)
                 throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("ArgumentOutOfRange_NegativeCount"));
             if (sourceIndex < 0)
@@ -455,7 +455,7 @@ namespace System {
         private String CtorCharArrayStartLength(char [] value, int startIndex, int length)
         {
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
 
             if (startIndex < 0)
                 throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
@@ -708,7 +708,7 @@ namespace System {
         [System.Security.SecuritySafeCritical]  // auto-generated
         unsafe public static String Copy (String str) {
             if (str==null) {
-                throw new ArgumentNullException("str");
+                throw new ArgumentNullException(nameof(str));
             }
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
@@ -727,7 +727,7 @@ namespace System {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public static String Intern(String str) {
             if (str==null) {
-                throw new ArgumentNullException("str");
+                throw new ArgumentNullException(nameof(str));
             }
             Contract.Ensures(Contract.Result<String>().Length == str.Length);
             Contract.Ensures(str.Equals(Contract.Result<String>()));
@@ -740,7 +740,7 @@ namespace System {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public static String IsInterned(String str) {
             if (str==null) {
-                throw new ArgumentNullException("str");
+                throw new ArgumentNullException(nameof(str));
             }
             Contract.Ensures(Contract.Result<String>() == null || Contract.Result<String>().Length == str.Length);
             Contract.EndContractBlock();
index 57bdf4c..38964f0 100644 (file)
@@ -64,7 +64,7 @@ namespace System {
 
         public static StringComparer Create(CultureInfo culture, bool ignoreCase) {
             if( culture == null) {
-                throw new ArgumentNullException("culture");
+                throw new ArgumentNullException(nameof(culture));
             }
             Contract.Ensures(Contract.Result<StringComparer>() != null);
             Contract.EndContractBlock();
@@ -110,7 +110,7 @@ namespace System {
         
         public int GetHashCode(object obj) {
             if( obj == null) {
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             }
             Contract.EndContractBlock();
 
@@ -161,7 +161,7 @@ namespace System {
                 
         public override int GetHashCode(string obj) {
             if( obj == null) {
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             }
             Contract.EndContractBlock();
 
@@ -229,7 +229,7 @@ namespace System {
                 
         public override int GetHashCode(string obj) {
             if( obj == null) {
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             }
             Contract.EndContractBlock();
 
@@ -311,7 +311,7 @@ namespace System {
                 
         public override int GetHashCode(string obj) {
             if( obj == null) {
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             }
             Contract.EndContractBlock();
 
@@ -388,7 +388,7 @@ namespace System {
         [System.Security.SecuritySafeCritical]            
         public override int GetHashCode(string obj) {
             if( obj == null) {
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             }
             Contract.EndContractBlock();
 
index a9c584e..34745e5 100644 (file)
@@ -1780,7 +1780,7 @@ namespace  System.StubHelpers {
         {
             if (pHandle == null)
             {
-                throw new ArgumentNullException("pHandle", Environment.GetResourceString("ArgumentNull_SafeHandle"));
+                throw new ArgumentNullException(nameof(pHandle), Environment.GetResourceString("ArgumentNull_SafeHandle"));
             }
             Contract.EndContractBlock();
 
@@ -1796,7 +1796,7 @@ namespace  System.StubHelpers {
         {
             if (pHandle == null)
             {
-                throw new ArgumentNullException("pHandle", Environment.GetResourceString("ArgumentNull_SafeHandle"));
+                throw new ArgumentNullException(nameof(pHandle), Environment.GetResourceString("ArgumentNull_SafeHandle"));
             }
             Contract.EndContractBlock();
 
index 4c9ca6e..8d22b8b 100644 (file)
@@ -175,7 +175,7 @@ namespace System.Text
         internal BaseCodePageEncoding(SerializationInfo info, StreamingContext context) : base(0)
         {
             // We cannot ever call this, we've proxied ourselved to CodePageEncoding
-            throw new ArgumentNullException("this");
+            throw new ArgumentNullException(nameof(this));
         }
 
         // ISerializable implementation
index 9f1b2d2..5ab73fc 100644 (file)
@@ -44,7 +44,7 @@ namespace System.Text
         internal CodePageEncoding(SerializationInfo info, StreamingContext context)
         {
             // Any info?
-            if (info==null) throw new ArgumentNullException("info");
+            if (info==null) throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             // All versions have a code page
@@ -113,7 +113,7 @@ namespace System.Text
             internal Decoder(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 this.realEncoding = (Encoding)info.GetValue("encoding", typeof(Encoding));
index c103d78..eab8d50 100644 (file)
@@ -62,7 +62,7 @@ namespace System.Text
         {
             // Actually this can't ever get called, CodePageEncoding is our proxy
             Contract.Assert(false, "Didn't expect to make it to DBCSCodePageEncoding serialization constructor");
-            throw new ArgumentNullException("this");
+            throw new ArgumentNullException(nameof(this));
         }
 
         // MBCS data section:
index f794dc4..ea326e9 100644 (file)
@@ -49,7 +49,7 @@ namespace System.Text
             set
             {
                 if (value == null)
-                    throw new ArgumentNullException("value");
+                    throw new ArgumentNullException(nameof(value));
                 Contract.EndContractBlock();
 
                 // Can't change fallback if buffer is wrong
@@ -131,7 +131,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (bytes == null)
-                throw new ArgumentNullException("bytes",
+                throw new ArgumentNullException(nameof(bytes),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (count < 0)
@@ -197,7 +197,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (chars == null || bytes == null)
-                throw new ArgumentNullException(chars == null ? "chars" : "bytes",
+                throw new ArgumentNullException(chars == null ? nameof(chars) : nameof(bytes),
                     Environment.GetResourceString("ArgumentNull_Array"));
 
             if (byteCount < 0 || charCount < 0)
@@ -256,7 +256,7 @@ namespace System.Text
         {
             // Validate parameters
             if (bytes == null || chars == null)
-                throw new ArgumentNullException((bytes == null ? "bytes" : "chars"),
+                throw new ArgumentNullException((bytes == null ? nameof(bytes) : nameof(chars)),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (byteIndex < 0 || byteCount < 0)
@@ -315,7 +315,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (chars == null || bytes == null)
-                throw new ArgumentNullException(chars == null ? "chars" : "bytes",
+                throw new ArgumentNullException(chars == null ? nameof(chars) : nameof(bytes),
                     Environment.GetResourceString("ArgumentNull_Array"));
 
             if (byteCount < 0 || charCount < 0)
index c2e82dd..a197454 100644 (file)
@@ -82,7 +82,7 @@ namespace System.Text
         {
             // Validate Parameters
             if (bytes == null)
-                throw new ArgumentNullException("bytes",
+                throw new ArgumentNullException(nameof(bytes),
                     Environment.GetResourceString("ArgumentNull_Array"));
 
             if (index < 0 || count < 0)
@@ -109,7 +109,7 @@ namespace System.Text
         {
             // Validate parameters
             if (bytes == null)
-                throw new ArgumentNullException("bytes",
+                throw new ArgumentNullException(nameof(bytes),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (count < 0)
@@ -137,7 +137,7 @@ namespace System.Text
         {
             // Validate Parameters
             if (bytes == null || chars == null)
-                throw new ArgumentNullException(bytes == null ? "bytes" : "chars",
+                throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars),
                     Environment.GetResourceString("ArgumentNull_Array"));
 
             if (byteIndex < 0 || byteCount < 0)
@@ -176,7 +176,7 @@ namespace System.Text
         {
             // Validate parameters
             if (chars == null || bytes == null)
-                throw new ArgumentNullException((chars == null ? "chars" : "bytes"),
+                throw new ArgumentNullException((chars == null ? nameof(chars) : nameof(bytes)),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (byteCount < 0 || charCount < 0)
@@ -201,7 +201,7 @@ namespace System.Text
         {
             // Validate parameters
             if (bytes == null || chars == null)
-                throw new ArgumentNullException((bytes == null ? "bytes" : "chars"),
+                throw new ArgumentNullException((bytes == null ? nameof(bytes) : nameof(chars)),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (byteIndex < 0 || byteCount < 0)
@@ -248,7 +248,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (chars == null || bytes == null)
-                throw new ArgumentNullException(chars == null ? "chars" : "bytes",
+                throw new ArgumentNullException(chars == null ? nameof(chars) : nameof(bytes),
                     Environment.GetResourceString("ArgumentNull_Array"));
 
             if (byteCount < 0 || charCount < 0)
index c732d15..0a54595 100644 (file)
@@ -21,7 +21,7 @@ namespace System.Text
         public DecoderReplacementFallback(String replacement)
         {
             if (replacement == null)
-                throw new ArgumentNullException("replacement");
+                throw new ArgumentNullException(nameof(replacement));
             Contract.EndContractBlock();
 
             // Make sure it doesn't have bad surrogate pairs
index d223dd9..dab5400 100644 (file)
@@ -49,7 +49,7 @@ namespace System.Text
             set
             {
                 if (value == null)
-                    throw new ArgumentNullException("value");
+                    throw new ArgumentNullException(nameof(value));
                 Contract.EndContractBlock();
 
                 // Can't change fallback if buffer is wrong
@@ -127,7 +127,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (chars == null)
-                throw new ArgumentNullException("chars",
+                throw new ArgumentNullException(nameof(chars),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (count < 0)
@@ -190,7 +190,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (bytes == null || chars == null)
-                throw new ArgumentNullException(bytes == null ? "bytes" : "chars",
+                throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars),
                     Environment.GetResourceString("ArgumentNull_Array"));
 
             if (charCount < 0 || byteCount < 0)
@@ -248,7 +248,7 @@ namespace System.Text
         {
             // Validate parameters
             if (chars == null || bytes == null)
-                throw new ArgumentNullException((chars == null ? "chars" : "bytes"),
+                throw new ArgumentNullException((chars == null ? nameof(chars) : nameof(bytes)),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (charIndex < 0 || charCount < 0)
@@ -308,7 +308,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (bytes == null || chars == null)
-                throw new ArgumentNullException(bytes == null ? "bytes" : "chars",
+                throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars),
                     Environment.GetResourceString("ArgumentNull_Array"));
                 if (charCount < 0 || byteCount < 0)
                 throw new ArgumentOutOfRangeException((charCount<0 ? "charCount" : "byteCount"),
index d5c52f4..70e2431 100644 (file)
@@ -82,7 +82,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (chars == null)
-                throw new ArgumentNullException( "chars",
+                throw new ArgumentNullException(nameof(chars),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (index < 0 || count < 0)
@@ -112,7 +112,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (chars == null)
-                throw new ArgumentNullException( "chars",
+                throw new ArgumentNullException(nameof(chars),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (count < 0)
@@ -131,7 +131,7 @@ namespace System.Text
         {
             // Validate parameters
             if (chars == null || bytes == null)
-                throw new ArgumentNullException((chars == null ? "chars" : "bytes"),
+                throw new ArgumentNullException((chars == null ? nameof(chars) : nameof(bytes)),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (charIndex < 0 || charCount < 0)
@@ -168,7 +168,7 @@ namespace System.Text
         {
             // Validate parameters
             if (chars == null || bytes == null)
-                throw new ArgumentNullException((chars == null ? "chars" : "bytes"),
+                throw new ArgumentNullException((chars == null ? nameof(chars) : nameof(bytes)),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (byteCount < 0 || charCount < 0)
@@ -190,7 +190,7 @@ namespace System.Text
         {
             // Validate parameters
             if (chars == null || bytes == null)
-                throw new ArgumentNullException((chars == null ? "chars" : "bytes"),
+                throw new ArgumentNullException((chars == null ? nameof(chars) : nameof(bytes)),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (charIndex < 0 || charCount < 0)
@@ -237,7 +237,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (bytes == null || chars == null)
-                throw new ArgumentNullException(bytes == null ? "bytes" : "chars",
+                throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars),
                     Environment.GetResourceString("ArgumentNull_Array"));
             if (charCount < 0 || byteCount < 0)
             throw new ArgumentOutOfRangeException((charCount<0 ? "charCount" : "byteCount"),
index 15dfee8..f21ef01 100644 (file)
@@ -23,7 +23,7 @@ namespace System.Text
         {
             // Must not be null
             if (replacement == null)
-                throw new ArgumentNullException("replacement");
+                throw new ArgumentNullException(nameof(replacement));
             Contract.EndContractBlock();
 
             // Make sure it doesn't have bad surrogate pairs
index 8533016..afb3afc 100644 (file)
@@ -275,7 +275,7 @@ namespace System.Text
         internal void DeserializeEncoding(SerializationInfo info, StreamingContext context)
         {
             // Any info?
-            if (info==null) throw new ArgumentNullException("info");
+            if (info==null) throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             // All versions have a code page
@@ -314,7 +314,7 @@ namespace System.Text
         internal void SerializeEncoding(SerializationInfo info, StreamingContext context)
         {
             // Any Info?
-            if (info==null) throw new ArgumentNullException("info");
+            if (info==null) throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             // These are new V2.0 Whidbey stuff
@@ -344,7 +344,7 @@ namespace System.Text
         public static byte[] Convert(Encoding srcEncoding, Encoding dstEncoding,
             byte[] bytes) {
             if (bytes==null)
-                throw new ArgumentNullException("bytes");
+                throw new ArgumentNullException(nameof(bytes));
             Contract.Ensures(Contract.Result<byte[]>() != null);
             
             return Convert(srcEncoding, dstEncoding, bytes, 0, bytes.Length);
@@ -359,11 +359,11 @@ namespace System.Text
         public static byte[] Convert(Encoding srcEncoding, Encoding dstEncoding,
             byte[] bytes, int index, int count) {
             if (srcEncoding == null || dstEncoding == null) {
-                throw new ArgumentNullException((srcEncoding == null ? "srcEncoding" : "dstEncoding"),
+                throw new ArgumentNullException((srcEncoding == null ? nameof(srcEncoding) : nameof(dstEncoding)),
                     Environment.GetResourceString("ArgumentNull_Array"));
             }
             if (bytes == null) {
-                throw new ArgumentNullException("bytes",
+                throw new ArgumentNullException(nameof(bytes),
                     Environment.GetResourceString("ArgumentNull_Array"));
             }
             Contract.Ensures(Contract.Result<byte[]>() != null);
@@ -795,7 +795,7 @@ namespace System.Text
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
 
                 if (value == null)
-                    throw new ArgumentNullException("value");
+                    throw new ArgumentNullException(nameof(value));
                 Contract.EndContractBlock();
 
                 encoderFallback = value;
@@ -817,7 +817,7 @@ namespace System.Text
                     throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
 
                 if (value == null)
-                    throw new ArgumentNullException("value");
+                    throw new ArgumentNullException(nameof(value));
                 Contract.EndContractBlock();
 
                 decoderFallback = value;
@@ -865,7 +865,7 @@ namespace System.Text
         {
             if (chars == null)
             {
-                throw new ArgumentNullException("chars",
+                throw new ArgumentNullException(nameof(chars),
                     Environment.GetResourceString("ArgumentNull_Array"));
             }
             Contract.EndContractBlock();
@@ -877,7 +877,7 @@ namespace System.Text
         public virtual int GetByteCount(String s)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             Contract.EndContractBlock();
 
             char[] chars = s.ToCharArray();
@@ -903,7 +903,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (chars == null)
-                throw new ArgumentNullException("chars",
+                throw new ArgumentNullException(nameof(chars),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (count < 0)
@@ -939,7 +939,7 @@ namespace System.Text
         {
             if (chars == null)
             {
-                throw new ArgumentNullException("chars",
+                throw new ArgumentNullException(nameof(chars),
                     Environment.GetResourceString("ArgumentNull_Array"));
             }
             Contract.EndContractBlock();
@@ -976,7 +976,7 @@ namespace System.Text
         public virtual byte[] GetBytes(String s)
         {
             if (s == null)
-                throw new ArgumentNullException("s",
+                throw new ArgumentNullException(nameof(s),
                     Environment.GetResourceString("ArgumentNull_String"));
             Contract.EndContractBlock();
 
@@ -991,7 +991,7 @@ namespace System.Text
                                        byte[] bytes, int byteIndex)
         {
             if (s==null)
-                throw new ArgumentNullException("s");
+                throw new ArgumentNullException(nameof(s));
             Contract.EndContractBlock();
             return GetBytes(s.ToCharArray(), charIndex, charCount, bytes, byteIndex);
         }
@@ -1030,7 +1030,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (bytes == null || chars == null)
-                throw new ArgumentNullException(bytes == null ? "bytes" : "chars",
+                throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars),
                     Environment.GetResourceString("ArgumentNull_Array"));
 
             if (charCount < 0 || byteCount < 0)
@@ -1076,7 +1076,7 @@ namespace System.Text
         {
             if (bytes == null)
             {
-                throw new ArgumentNullException("bytes",
+                throw new ArgumentNullException(nameof(bytes),
                     Environment.GetResourceString("ArgumentNull_Array"));
             }
             Contract.EndContractBlock();
@@ -1099,7 +1099,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (bytes == null)
-                throw new ArgumentNullException("bytes",
+                throw new ArgumentNullException(nameof(bytes),
                       Environment.GetResourceString("ArgumentNull_Array"));
 
             if (count < 0)
@@ -1132,7 +1132,7 @@ namespace System.Text
         {
             if (bytes == null)
             {
-                throw new ArgumentNullException("bytes",
+                throw new ArgumentNullException(nameof(bytes),
                     Environment.GetResourceString("ArgumentNull_Array"));
             }
             Contract.EndContractBlock();
@@ -1189,7 +1189,7 @@ namespace System.Text
         {
             // Validate input parameters
             if (chars == null || bytes == null)
-                throw new ArgumentNullException(chars == null ? "chars" : "bytes",
+                throw new ArgumentNullException(chars == null ? nameof(chars) : nameof(bytes),
                     Environment.GetResourceString("ArgumentNull_Array"));
 
             if (byteCount < 0 || charCount < 0)
@@ -1244,7 +1244,7 @@ namespace System.Text
         public unsafe string GetString(byte* bytes, int byteCount)
         {
             if (bytes == null)
-                throw new ArgumentNullException("bytes", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(nameof(bytes), Environment.GetResourceString("ArgumentNull_Array"));
 
             if (byteCount < 0)
                 throw new ArgumentOutOfRangeException("byteCount", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
@@ -1391,7 +1391,7 @@ namespace System.Text
         public virtual String GetString(byte[] bytes)
         {
             if (bytes == null)
-                throw new ArgumentNullException("bytes",
+                throw new ArgumentNullException(nameof(bytes),
                     Environment.GetResourceString("ArgumentNull_Array"));
             Contract.EndContractBlock();
 
@@ -1541,7 +1541,7 @@ namespace System.Text
             // Constructor called by serialization, have to handle deserializing from Everett
             internal DefaultEncoder(SerializationInfo info, StreamingContext context)
             {
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // All we have is our encoding
@@ -1588,7 +1588,7 @@ namespace System.Text
             void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // All we have is our encoding
@@ -1667,7 +1667,7 @@ namespace System.Text
             internal DefaultDecoder(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // All we have is our encoding
@@ -1709,7 +1709,7 @@ namespace System.Text
             void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // All we have is our encoding
index d4bcf80..6cc664f 100644 (file)
@@ -39,7 +39,7 @@ namespace System.Text
             Contract.Assert(encoding != null); // this parameter should only be affected internally, so just do a debug check here
             if (chars == null)
             {
-                throw new ArgumentNullException("chars", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(nameof(chars), Environment.GetResourceString("ArgumentNull_Array"));
             }
             if (index < 0 || count < 0)
             {
@@ -90,7 +90,7 @@ namespace System.Text
             Contract.Assert(encoding != null);
             if (chars == null)
             {
-                throw new ArgumentNullException("chars", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(nameof(chars), Environment.GetResourceString("ArgumentNull_Array"));
             }
             if (count < 0)
             {
@@ -108,8 +108,8 @@ namespace System.Text
             Contract.Assert(encoding != null);
             if (s == null || bytes == null)
             {
-                string stringName = encoding is ASCIIEncoding ? "chars" : "s"; // ASCIIEncoding calls the first parameter chars
-                throw new ArgumentNullException(s == null ? stringName : "bytes", Environment.GetResourceString("ArgumentNull_Array"));
+                string stringName = encoding is ASCIIEncoding ? "chars" : nameof(s); // ASCIIEncoding calls the first parameter chars
+                throw new ArgumentNullException(s == null ? stringName : nameof(bytes), Environment.GetResourceString("ArgumentNull_Array"));
             }
             if (charIndex < 0 || charCount < 0)
             {
@@ -117,7 +117,7 @@ namespace System.Text
             }
             if (s.Length - charIndex < charCount)
             {
-                string stringName = encoding is ASCIIEncoding ? "chars" : "s"; // ASCIIEncoding calls the first parameter chars
+                string stringName = encoding is ASCIIEncoding ? "chars" : nameof(s); // ASCIIEncoding calls the first parameter chars
                 // Duplicate the above check since we don't want the overhead of a type check on the general path
                 throw new ArgumentOutOfRangeException(stringName, Environment.GetResourceString("ArgumentOutOfRange_IndexCount"));
             }
@@ -145,7 +145,7 @@ namespace System.Text
             Contract.Assert(encoding != null);
             if (chars == null || bytes == null)
             {
-                throw new ArgumentNullException(chars == null ? "chars" : "bytes", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(chars == null ? nameof(chars) : nameof(bytes), Environment.GetResourceString("ArgumentNull_Array"));
             }
             if (charIndex < 0 || charCount < 0)
             {
@@ -186,7 +186,7 @@ namespace System.Text
             Contract.Assert(encoding != null);
             if (bytes == null || chars == null)
             {
-                throw new ArgumentNullException(bytes == null ? "bytes" : "chars", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars), Environment.GetResourceString("ArgumentNull_Array"));
             }
             if (charCount < 0 || byteCount < 0)
             {
@@ -203,7 +203,7 @@ namespace System.Text
             Contract.Assert(encoding != null);
             if (bytes == null)
             {
-                throw new ArgumentNullException("bytes", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(nameof(bytes), Environment.GetResourceString("ArgumentNull_Array"));
             }
             if (index < 0 || count < 0)
             {
@@ -230,7 +230,7 @@ namespace System.Text
             Contract.Assert(encoding != null);
             if (bytes == null)
             {
-                throw new ArgumentNullException("bytes", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(nameof(bytes), Environment.GetResourceString("ArgumentNull_Array"));
             }
             if (count < 0)
             {
@@ -247,7 +247,7 @@ namespace System.Text
             Contract.Assert(encoding != null);
             if (bytes == null || chars == null)
             {
-                throw new ArgumentNullException(bytes == null ? "bytes" : "chars", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars), Environment.GetResourceString("ArgumentNull_Array"));
             }
             if (byteIndex < 0 || byteCount < 0)
             {
@@ -286,7 +286,7 @@ namespace System.Text
             Contract.Assert(encoding != null);
             if (bytes == null || chars == null)
             {
-                throw new ArgumentNullException(bytes == null ? "bytes" : "chars", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars), Environment.GetResourceString("ArgumentNull_Array"));
             }
             if (charCount < 0 || byteCount < 0)
             {
@@ -303,14 +303,14 @@ namespace System.Text
             Contract.Assert(encoding != null);
             if (bytes == null)
             {
-                throw new ArgumentNullException("bytes", Environment.GetResourceString("ArgumentNull_Array"));
+                throw new ArgumentNullException(nameof(bytes), Environment.GetResourceString("ArgumentNull_Array"));
             }
             if (index < 0 || count < 0)
             {
                 // ASCIIEncoding has different names for its parameters here (byteIndex, byteCount)
                 bool ascii = encoding is ASCIIEncoding;
-                string indexName = ascii ? "byteIndex" : "index";
-                string countName = ascii ? "byteCount" : "count";
+                string indexName = ascii ? "byteIndex" : nameof(index);
+                string countName = ascii ? "byteCount" : nameof(count);
                 throw new ArgumentOutOfRangeException(index < 0 ? indexName : countName, Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
             }
             if (bytes.Length - index < count)
index b1dea2c..a7f745a 100644 (file)
@@ -45,7 +45,7 @@ namespace System.Text
         internal static void AddProvider(EncodingProvider provider)
         {
             if (provider == null)
-                throw new ArgumentNullException("provider");
+                throw new ArgumentNullException(nameof(provider));
 
             lock (s_InternalSyncObject)
             {
index 98746fc..e7875ac 100644 (file)
@@ -856,7 +856,7 @@ namespace System.Text
             internal GB18030Decoder(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 try
@@ -883,7 +883,7 @@ namespace System.Text
             void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // Save Whidbey data
index 53924a9..e65bcee 100644 (file)
@@ -46,7 +46,7 @@ namespace System.Text
         internal MLangCodePageEncoding(SerializationInfo info, StreamingContext context)
         {
             // Any info?
-            if (info==null) throw new ArgumentNullException("info");
+            if (info==null) throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             // All versions have a code page
@@ -115,7 +115,7 @@ namespace System.Text
             internal MLangEncoder(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 this.realEncoding = (Encoding)info.GetValue("m_encoding", typeof(Encoding));
@@ -151,7 +151,7 @@ namespace System.Text
             internal MLangDecoder(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 this.realEncoding = (Encoding)info.GetValue("m_encoding", typeof(Encoding));
index ce611d8..d436ed9 100644 (file)
@@ -54,7 +54,7 @@ namespace System.Text
         {
             // Actually this can't ever get called, CodePageEncoding is our proxy
             Contract.Assert(false, "Didn't expect to make it to SBCSCodePageEncoding serialization constructor");
-            throw new ArgumentNullException("this");
+            throw new ArgumentNullException(nameof(this));
         }
 
         // We have a managed code page entry, so load our tables
index e4800e3..31e6a24 100644 (file)
@@ -180,7 +180,7 @@ namespace System.Text {
         [System.Security.SecurityCritical]  // auto-generated
         private StringBuilder(SerializationInfo info, StreamingContext context) {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             int persistedCapacity = 0;
@@ -244,7 +244,7 @@ namespace System.Text {
         void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
 
@@ -606,7 +606,7 @@ namespace System.Text {
                 if (startIndex == 0 && charCount == 0) {
                     return this;
                 }
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
             if (charCount > value.Length - startIndex) {
                 throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("ArgumentOutOfRange_Index"));
@@ -702,7 +702,7 @@ namespace System.Text {
                 if (startIndex == 0 && count == 0) {
                     return this;
                 }
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
             }
 
             if (count == 0) {
@@ -741,7 +741,7 @@ namespace System.Text {
         [SecuritySafeCritical]
         public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) {
             if (destination == null) {
-                throw new ArgumentNullException("destination");
+                throw new ArgumentNullException(nameof(destination));
             }
 
             if (count < 0) {
@@ -1129,7 +1129,7 @@ namespace System.Text {
                 {
                     return this;
                 }
-                throw new ArgumentNullException("value", Environment.GetResourceString("ArgumentNull_String"));
+                throw new ArgumentNullException(nameof(value), Environment.GetResourceString("ArgumentNull_String"));
             }
 
             //Range check the array.
@@ -1263,7 +1263,7 @@ namespace System.Text {
             {
                 // To preserve the original exception behavior, throw an exception about format if both
                 // args and format are null. The actual null check for format is in AppendFormatHelper.
-                throw new ArgumentNullException((format == null) ? "format" : "args");
+                throw new ArgumentNullException((format == null) ? nameof(format) : nameof(args));
             }
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
@@ -1291,7 +1291,7 @@ namespace System.Text {
             {
                 // To preserve the original exception behavior, throw an exception about format if both
                 // args and format are null. The actual null check for format is in AppendFormatHelper.
-                throw new ArgumentNullException((format == null) ? "format" : "args");
+                throw new ArgumentNullException((format == null) ? nameof(format) : nameof(args));
             }
             Contract.Ensures(Contract.Result<String>() != null);
             Contract.EndContractBlock();
@@ -1309,7 +1309,7 @@ namespace System.Text {
 
         internal StringBuilder AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args) {
             if (format == null) {
-                throw new ArgumentNullException("format");
+                throw new ArgumentNullException(nameof(format));
             }
             Contract.Ensures(Contract.Result<StringBuilder>() != null);
             Contract.EndContractBlock();
@@ -1598,7 +1598,7 @@ namespace System.Text {
             }
             if (oldValue == null)
             {
-                throw new ArgumentNullException("oldValue");
+                throw new ArgumentNullException(nameof(oldValue));
             }
             if (oldValue.Length == 0)
             {
index 409e8a3..8ee41a3 100644 (file)
@@ -30,7 +30,7 @@ namespace System.Text
         internal SurrogateEncoder(SerializationInfo info, StreamingContext context)
         {
             // Any info?
-            if (info==null) throw new ArgumentNullException("info");
+            if (info==null) throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             // All versions have a code page
index 654fb8b..6a0e393 100644 (file)
@@ -663,7 +663,7 @@ namespace System.Text
             internal Decoder(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // Get common info
@@ -678,7 +678,7 @@ namespace System.Text
             void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // Save Whidbey data
@@ -727,7 +727,7 @@ namespace System.Text
             internal Encoder(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // Get common info
@@ -741,7 +741,7 @@ namespace System.Text
             void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // Save Whidbey data
index a527de7..df32ac2 100644 (file)
@@ -2174,7 +2174,7 @@ namespace System.Text
             internal UTF8Encoder(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // Get common info
@@ -2198,7 +2198,7 @@ namespace System.Text
             void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // Save Whidbey data
@@ -2247,7 +2247,7 @@ namespace System.Text
             internal UTF8Decoder(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // Get common info
@@ -2272,7 +2272,7 @@ namespace System.Text
             void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // Save new Whidbey data
index 41d4f3b..556aa0c 100644 (file)
@@ -1781,7 +1781,7 @@ namespace System.Text
             internal Decoder(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // Get Common Info
@@ -1807,7 +1807,7 @@ namespace System.Text
             void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
             {
                 // Any info?
-                if (info==null) throw new ArgumentNullException("info");
+                if (info==null) throw new ArgumentNullException(nameof(info));
                 Contract.EndContractBlock();
 
                 // Save Whidbey data
index 48a2344..7f744f8 100644 (file)
@@ -192,7 +192,7 @@ namespace System.Threading
         public CancellationTokenRegistration Register(Action callback)
         {
             if (callback == null)
-                throw new ArgumentNullException("callback");
+                throw new ArgumentNullException(nameof(callback));
             
             return Register(
                 s_ActionToActionObjShunt,
@@ -227,7 +227,7 @@ namespace System.Threading
         public CancellationTokenRegistration Register(Action callback, bool useSynchronizationContext)
         {
             if (callback == null)
-                throw new ArgumentNullException("callback");
+                throw new ArgumentNullException(nameof(callback));
             
             return Register(
                 s_ActionToActionObjShunt,
@@ -260,7 +260,7 @@ namespace System.Threading
         public CancellationTokenRegistration Register(Action<Object> callback, Object state)
         {
             if (callback == null)
-                throw new ArgumentNullException("callback");
+                throw new ArgumentNullException(nameof(callback));
 
             return Register(
                 callback,
@@ -325,7 +325,7 @@ namespace System.Threading
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
 
             if (callback == null)
-                throw new ArgumentNullException("callback");
+                throw new ArgumentNullException(nameof(callback));
 
             if (CanBeCanceled == false)
             {
index 954cd38..b3dad85 100644 (file)
@@ -882,7 +882,7 @@ namespace System.Threading
         public static CancellationTokenSource CreateLinkedTokenSource(params CancellationToken[] tokens)
         {
             if (tokens == null)
-                throw new ArgumentNullException("tokens");
+                throw new ArgumentNullException(nameof(tokens));
 
             if (tokens.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("CancellationToken_CreateLinkedToken_TokensIsEmpty"));
index f56da1f..cb5efbe 100644 (file)
@@ -216,7 +216,7 @@ namespace System.Threading
 #else
             if (name == null)
             {
-                throw new ArgumentNullException("name", Environment.GetResourceString("ArgumentNull_WithParamName"));
+                throw new ArgumentNullException(nameof(name), Environment.GetResourceString("ArgumentNull_WithParamName"));
             }
 
             if(name.Length  == 0)
@@ -286,7 +286,7 @@ namespace System.Threading
         public void SetAccessControl(EventWaitHandleSecurity eventSecurity)
         {
             if (eventSecurity == null)
-                throw new ArgumentNullException("eventSecurity");
+                throw new ArgumentNullException(nameof(eventSecurity));
             Contract.EndContractBlock();
 
             eventSecurity.Persist(safeWaitHandle);
index 0440368..087ee28 100644 (file)
@@ -1342,7 +1342,7 @@ namespace System.Threading
         public void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info==null) 
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
 #if FEATURE_REMOTING
index 415948b..6dccdcb 100644 (file)
@@ -162,7 +162,7 @@ namespace System.Threading {
         public static bool IsEntered(object obj)
         {
             if (obj == null)
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
 
             return IsEnteredNative(obj);
         }
@@ -190,7 +190,7 @@ namespace System.Threading {
         public static bool Wait(Object obj, int millisecondsTimeout, bool exitContext)
         {
             if (obj == null)
-                throw (new ArgumentNullException("obj"));
+                throw (new ArgumentNullException(nameof(obj)));
             return ObjWait(exitContext, millisecondsTimeout, obj);
         }
 
@@ -228,7 +228,7 @@ namespace System.Threading {
         {
             if (obj == null)
             {
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             }
             Contract.EndContractBlock();
 
@@ -246,7 +246,7 @@ namespace System.Threading {
         {
             if (obj == null)
             {
-                throw new ArgumentNullException("obj");
+                throw new ArgumentNullException(nameof(obj));
             }
             Contract.EndContractBlock();
 
index 2e9b681..69ac305 100644 (file)
@@ -321,7 +321,7 @@ namespace System.Threading
         {
             if (name == null)
             {
-                throw new ArgumentNullException("name", Environment.GetResourceString("ArgumentNull_WithParamName"));
+                throw new ArgumentNullException(nameof(name), Environment.GetResourceString("ArgumentNull_WithParamName"));
             }
 
             if(name.Length  == 0)
@@ -477,7 +477,7 @@ namespace System.Threading
         public void SetAccessControl(MutexSecurity mutexSecurity)
         {
             if (mutexSecurity == null)
-                throw new ArgumentNullException("mutexSecurity");
+                throw new ArgumentNullException(nameof(mutexSecurity));
             Contract.EndContractBlock();
 
             mutexSecurity.Persist(safeWaitHandle);
index 3f9fbc4..7b27464 100644 (file)
@@ -392,7 +392,7 @@ namespace System.Threading
         unsafe public static Overlapped Unpack(NativeOverlapped* nativeOverlappedPtr)
         {
             if (nativeOverlappedPtr == null)
-                throw new ArgumentNullException("nativeOverlappedPtr");
+                throw new ArgumentNullException(nameof(nativeOverlappedPtr));
             Contract.EndContractBlock();
 
             Overlapped overlapped = OverlappedData.GetOverlappedFromNative(nativeOverlappedPtr).m_overlapped;
@@ -405,7 +405,7 @@ namespace System.Threading
         unsafe public static void Free(NativeOverlapped* nativeOverlappedPtr)
         {
             if (nativeOverlappedPtr == null)
-                throw new ArgumentNullException("nativeOverlappedPtr");
+                throw new ArgumentNullException(nameof(nativeOverlappedPtr));
             Contract.EndContractBlock();
 
             Overlapped overlapped = OverlappedData.GetOverlappedFromNative(nativeOverlappedPtr).m_overlapped;
index 303593b..0c67cde 100644 (file)
@@ -138,7 +138,7 @@ namespace System.Threading
             throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_NamedSynchronizationPrimitives"));
 #else
             if (name == null)
-                throw new ArgumentNullException("name", Environment.GetResourceString("ArgumentNull_WithParamName"));
+                throw new ArgumentNullException(nameof(name), Environment.GetResourceString("ArgumentNull_WithParamName"));
             if (name.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
             if (name.Length > Path.MaxPath)
index c2cd0b6..6cea774 100644 (file)
@@ -246,7 +246,7 @@ namespace System.Threading
             }
             if (condition == null)
             {
-                throw new ArgumentNullException("condition", Environment.GetResourceString("SpinWait_SpinUntil_ArgumentNull"));
+                throw new ArgumentNullException(nameof(condition), Environment.GetResourceString("SpinWait_SpinUntil_ArgumentNull"));
             }
             uint startTime = 0;
             if (millisecondsTimeout != 0 && millisecondsTimeout != Timeout.Infinite)
index a3f28d1..2f2dc36 100644 (file)
@@ -151,7 +151,7 @@ namespace System.Threading
         {
             if (waitHandles == null)
             {
-                throw new ArgumentNullException("waitHandles");
+                throw new ArgumentNullException(nameof(waitHandles));
             }
             Contract.EndContractBlock();
             return WaitHelper(waitHandles, waitAll, millisecondsTimeout);
index cb4a22b..acf9902 100644 (file)
@@ -101,7 +101,7 @@ namespace System.Threading.Tasks
         public ConcurrentExclusiveSchedulerPair(TaskScheduler taskScheduler, int maxConcurrencyLevel, int maxItemsPerTask)
         {
             // Validate arguments
-            if (taskScheduler == null) throw new ArgumentNullException("taskScheduler");
+            if (taskScheduler == null) throw new ArgumentNullException(nameof(taskScheduler));
             if (maxConcurrencyLevel == 0 || maxConcurrencyLevel < -1) throw new ArgumentOutOfRangeException("maxConcurrencyLevel");
             if (maxItemsPerTask == 0 || maxItemsPerTask < -1) throw new ArgumentOutOfRangeException("maxItemsPerTask");
             Contract.EndContractBlock();
index 5ec2ae3..c6087b3 100644 (file)
@@ -208,11 +208,11 @@ namespace System.Threading.Tasks
         {
             if (actions == null)
             {
-                throw new ArgumentNullException("actions");
+                throw new ArgumentNullException(nameof(actions));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             // Throw an ODE if we're passed a disposed CancellationToken.
@@ -423,7 +423,7 @@ namespace System.Threading.Tasks
         {
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
 
             return ForWorker<object>(
@@ -452,7 +452,7 @@ namespace System.Threading.Tasks
         {
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
 
             return ForWorker64<object>(
@@ -491,11 +491,11 @@ namespace System.Threading.Tasks
         {
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return ForWorker<object>(
@@ -534,11 +534,11 @@ namespace System.Threading.Tasks
         {
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return ForWorker64<object>(
@@ -590,7 +590,7 @@ namespace System.Threading.Tasks
         {
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
 
             return ForWorker<object>(
@@ -620,7 +620,7 @@ namespace System.Threading.Tasks
         {
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
 
             return ForWorker64<object>(
@@ -661,11 +661,11 @@ namespace System.Threading.Tasks
         {
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return ForWorker<object>(
@@ -707,11 +707,11 @@ namespace System.Threading.Tasks
         {
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return ForWorker64<object>(
@@ -765,15 +765,15 @@ namespace System.Threading.Tasks
         {
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (localInit == null)
             {
-                throw new ArgumentNullException("localInit");
+                throw new ArgumentNullException(nameof(localInit));
             }
             if (localFinally == null)
             {
-                throw new ArgumentNullException("localFinally");
+                throw new ArgumentNullException(nameof(localFinally));
             }
 
             return ForWorker(
@@ -827,15 +827,15 @@ namespace System.Threading.Tasks
         {
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (localInit == null)
             {
-                throw new ArgumentNullException("localInit");
+                throw new ArgumentNullException(nameof(localInit));
             }
             if (localFinally == null)
             {
-                throw new ArgumentNullException("localFinally");
+                throw new ArgumentNullException(nameof(localFinally));
             }
 
             return ForWorker64(
@@ -900,19 +900,19 @@ namespace System.Threading.Tasks
         {
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (localInit == null)
             {
-                throw new ArgumentNullException("localInit");
+                throw new ArgumentNullException(nameof(localInit));
             }
             if (localFinally == null)
             {
-                throw new ArgumentNullException("localFinally");
+                throw new ArgumentNullException(nameof(localFinally));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return ForWorker(
@@ -977,19 +977,19 @@ namespace System.Threading.Tasks
         {
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (localInit == null)
             {
-                throw new ArgumentNullException("localInit");
+                throw new ArgumentNullException(nameof(localInit));
             }
             if (localFinally == null)
             {
-                throw new ArgumentNullException("localFinally");
+                throw new ArgumentNullException(nameof(localFinally));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
 
@@ -1656,11 +1656,11 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
 
             return ForEachWorker<TSource, object>(
@@ -1701,15 +1701,15 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return ForEachWorker<TSource, object>(
@@ -1741,11 +1741,11 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
 
             return ForEachWorker<TSource, object>(
@@ -1788,15 +1788,15 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return ForEachWorker<TSource, object>(
@@ -1828,11 +1828,11 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
 
             return ForEachWorker<TSource, object>(
@@ -1875,15 +1875,15 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return ForEachWorker<TSource, object>(
@@ -1936,19 +1936,19 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (localInit == null)
             {
-                throw new ArgumentNullException("localInit");
+                throw new ArgumentNullException(nameof(localInit));
             }
             if (localFinally == null)
             {
-                throw new ArgumentNullException("localFinally");
+                throw new ArgumentNullException(nameof(localFinally));
             }
 
             return ForEachWorker<TSource, TLocal>(
@@ -2013,23 +2013,23 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (localInit == null)
             {
-                throw new ArgumentNullException("localInit");
+                throw new ArgumentNullException(nameof(localInit));
             }
             if (localFinally == null)
             {
-                throw new ArgumentNullException("localFinally");
+                throw new ArgumentNullException(nameof(localFinally));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return ForEachWorker<TSource, TLocal>(
@@ -2082,19 +2082,19 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (localInit == null)
             {
-                throw new ArgumentNullException("localInit");
+                throw new ArgumentNullException(nameof(localInit));
             }
             if (localFinally == null)
             {
-                throw new ArgumentNullException("localFinally");
+                throw new ArgumentNullException(nameof(localFinally));
             }
 
             return ForEachWorker<TSource, TLocal>(
@@ -2158,23 +2158,23 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (localInit == null)
             {
-                throw new ArgumentNullException("localInit");
+                throw new ArgumentNullException(nameof(localInit));
             }
             if (localFinally == null)
             {
-                throw new ArgumentNullException("localFinally");
+                throw new ArgumentNullException(nameof(localFinally));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return ForEachWorker<TSource, TLocal>(
@@ -2416,11 +2416,11 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
 
             return PartitionerForEachWorker<TSource, object>(source, s_defaultParallelOptions, body, null, null, null, null, null, null);
@@ -2475,11 +2475,11 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
 
             return PartitionerForEachWorker<TSource, object>(source, s_defaultParallelOptions, null, body, null, null, null, null, null);
@@ -2537,11 +2537,11 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
 
             if (!source.KeysNormalized)
@@ -2621,19 +2621,19 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (localInit == null)
             {
-                throw new ArgumentNullException("localInit");
+                throw new ArgumentNullException(nameof(localInit));
             }
             if (localFinally == null)
             {
-                throw new ArgumentNullException("localFinally");
+                throw new ArgumentNullException(nameof(localFinally));
             }
 
             return PartitionerForEachWorker<TSource, TLocal>(source, s_defaultParallelOptions, null, null, null, body, null, localInit, localFinally);
@@ -2711,19 +2711,19 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (localInit == null)
             {
-                throw new ArgumentNullException("localInit");
+                throw new ArgumentNullException(nameof(localInit));
             }
             if (localFinally == null)
             {
-                throw new ArgumentNullException("localFinally");
+                throw new ArgumentNullException(nameof(localFinally));
             }
 
             if (!source.KeysNormalized)
@@ -2793,15 +2793,15 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return PartitionerForEachWorker<TSource, object>(source, parallelOptions, body, null, null, null, null, null, null);
@@ -2868,15 +2868,15 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return PartitionerForEachWorker<TSource, object>(source, parallelOptions, null, body, null, null, null, null, null);
@@ -2946,15 +2946,15 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             if (!source.KeysNormalized)
@@ -3046,23 +3046,23 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (localInit == null)
             {
-                throw new ArgumentNullException("localInit");
+                throw new ArgumentNullException(nameof(localInit));
             }
             if (localFinally == null)
             {
-                throw new ArgumentNullException("localFinally");
+                throw new ArgumentNullException(nameof(localFinally));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             return PartitionerForEachWorker<TSource, TLocal>(source, parallelOptions, null, null, null, body, null, localInit, localFinally);
@@ -3152,23 +3152,23 @@ namespace System.Threading.Tasks
         {
             if (source == null)
             {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (body == null)
             {
-                throw new ArgumentNullException("body");
+                throw new ArgumentNullException(nameof(body));
             }
             if (localInit == null)
             {
-                throw new ArgumentNullException("localInit");
+                throw new ArgumentNullException(nameof(localInit));
             }
             if (localFinally == null)
             {
-                throw new ArgumentNullException("localFinally");
+                throw new ArgumentNullException(nameof(localFinally));
             }
             if (parallelOptions == null)
             {
-                throw new ArgumentNullException("parallelOptions");
+                throw new ArgumentNullException(nameof(parallelOptions));
             }
 
             if (!source.KeysNormalized)
index 52b4716..b9055bd 100644 (file)
@@ -1801,7 +1801,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task ContinueWhenAll(Task[] tasks, Action<Task[]> continuationAction)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -1833,7 +1833,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task ContinueWhenAll(Task[] tasks, Action<Task[]> continuationAction, CancellationToken cancellationToken)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -1870,7 +1870,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task ContinueWhenAll(Task[] tasks, Action<Task[]> continuationAction, TaskContinuationOptions continuationOptions)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -1918,7 +1918,7 @@ namespace System.Threading.Tasks
         public Task ContinueWhenAll(Task[] tasks, Action<Task[]> continuationAction, CancellationToken cancellationToken,
             TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -1945,7 +1945,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -1979,7 +1979,7 @@ namespace System.Threading.Tasks
         public Task ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction,
             CancellationToken cancellationToken)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2018,7 +2018,7 @@ namespace System.Threading.Tasks
         public Task ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction,
             TaskContinuationOptions continuationOptions)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2067,7 +2067,7 @@ namespace System.Threading.Tasks
         public Task ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>[]> continuationAction,
             CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2097,7 +2097,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task<TResult> ContinueWhenAll<TResult>(Task[] tasks, Func<Task[], TResult> continuationFunction)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2133,7 +2133,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task<TResult> ContinueWhenAll<TResult>(Task[] tasks, Func<Task[], TResult> continuationFunction, CancellationToken cancellationToken)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2174,7 +2174,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task<TResult> ContinueWhenAll<TResult>(Task[] tasks, Func<Task[], TResult> continuationFunction, TaskContinuationOptions continuationOptions)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2226,7 +2226,7 @@ namespace System.Threading.Tasks
         public Task<TResult> ContinueWhenAll<TResult>(Task[] tasks, Func<Task[], TResult> continuationFunction, CancellationToken cancellationToken,
             TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2258,7 +2258,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2295,7 +2295,7 @@ namespace System.Threading.Tasks
         public Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction,
             CancellationToken cancellationToken)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2338,7 +2338,7 @@ namespace System.Threading.Tasks
         public Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction,
             TaskContinuationOptions continuationOptions)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2391,7 +2391,7 @@ namespace System.Threading.Tasks
         public Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction,
             CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2531,7 +2531,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2562,7 +2562,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction, CancellationToken cancellationToken)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2599,7 +2599,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction, TaskContinuationOptions continuationOptions)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2647,7 +2647,7 @@ namespace System.Threading.Tasks
         public Task ContinueWhenAny(Task[] tasks, Action<Task> continuationAction, CancellationToken cancellationToken,
             TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2678,7 +2678,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2713,7 +2713,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2754,7 +2754,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction, TaskContinuationOptions continuationOptions)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2806,7 +2806,7 @@ namespace System.Threading.Tasks
         public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken,
             TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2838,7 +2838,7 @@ namespace System.Threading.Tasks
         public Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction)
         {
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             return TaskFactory<TResult>.ContinueWhenAnyImpl<TAntecedentResult>(tasks, continuationFunction, null, m_defaultContinuationOptions, m_defaultCancellationToken, DefaultScheduler, ref stackMark);
         }
 
@@ -2872,7 +2872,7 @@ namespace System.Threading.Tasks
         public Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction,
             CancellationToken cancellationToken)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2915,7 +2915,7 @@ namespace System.Threading.Tasks
         public Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction,
             TaskContinuationOptions continuationOptions)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2968,7 +2968,7 @@ namespace System.Threading.Tasks
         public Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction,
             CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
         {
-            if (continuationFunction == null) throw new ArgumentNullException("continuationFunction");
+            if (continuationFunction == null) throw new ArgumentNullException(nameof(continuationFunction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -2996,7 +2996,7 @@ namespace System.Threading.Tasks
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable            
         public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -3029,7 +3029,7 @@ namespace System.Threading.Tasks
         public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction,
             CancellationToken cancellationToken)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -3068,7 +3068,7 @@ namespace System.Threading.Tasks
         public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction,
             TaskContinuationOptions continuationOptions)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -3117,7 +3117,7 @@ namespace System.Threading.Tasks
         public Task ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Action<Task<TAntecedentResult>> continuationAction,
             CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
         {
-            if (continuationAction == null) throw new ArgumentNullException("continuationAction");
+            if (continuationAction == null) throw new ArgumentNullException(nameof(continuationAction));
             Contract.EndContractBlock();
 
             StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -3129,7 +3129,7 @@ namespace System.Threading.Tasks
         internal static Task[] CheckMultiContinuationTasksAndCopy(Task[] tasks)
         {
             if (tasks == null)
-                throw new ArgumentNullException("tasks");
+                throw new ArgumentNullException(nameof(tasks));
             if (tasks.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Task_MultiTaskContinuation_EmptyTaskList"), "tasks");
             Contract.EndContractBlock();
@@ -3149,7 +3149,7 @@ namespace System.Threading.Tasks
         internal static Task<TResult>[] CheckMultiContinuationTasksAndCopy<TResult>(Task<TResult>[] tasks)
         {
             if (tasks == null)
-                throw new ArgumentNullException("tasks");
+                throw new ArgumentNullException(nameof(tasks));
             if (tasks.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Task_MultiTaskContinuation_EmptyTaskList"), "tasks");
             Contract.EndContractBlock();
index c5b38ca..0ee38c8 100644 (file)
@@ -229,7 +229,7 @@ namespace System.Threading {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public Thread(ThreadStart start) {
             if (start == null) {
-                throw new ArgumentNullException("start");
+                throw new ArgumentNullException(nameof(start));
             }
             Contract.EndContractBlock();
             SetStartHelper((Delegate)start,0);  //0 will setup Thread with default stackSize
@@ -238,7 +238,7 @@ namespace System.Threading {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public Thread(ThreadStart start, int maxStackSize) {
             if (start == null) {
-                throw new ArgumentNullException("start");
+                throw new ArgumentNullException(nameof(start));
             }
             if (0 > maxStackSize)
                 throw new ArgumentOutOfRangeException("maxStackSize",Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
@@ -248,7 +248,7 @@ namespace System.Threading {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public Thread(ParameterizedThreadStart start) {
             if (start == null) {
-                throw new ArgumentNullException("start");
+                throw new ArgumentNullException(nameof(start));
             }
             Contract.EndContractBlock();
             SetStartHelper((Delegate)start, 0);
@@ -257,7 +257,7 @@ namespace System.Threading {
         [System.Security.SecuritySafeCritical]  // auto-generated
         public Thread(ParameterizedThreadStart start, int maxStackSize) {
             if (start == null) {
-                throw new ArgumentNullException("start");
+                throw new ArgumentNullException(nameof(start));
             }
             if (0 > maxStackSize)
                 throw new ArgumentOutOfRangeException("maxStackSize",Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
@@ -1046,7 +1046,7 @@ namespace System.Threading {
             [HostProtection(ExternalThreading=true)]
             set {
                 if (value == null) {
-                    throw new ArgumentNullException("value");
+                    throw new ArgumentNullException(nameof(value));
                 }
                 Contract.EndContractBlock();
 
@@ -1157,7 +1157,7 @@ namespace System.Threading {
 #endif
             set {
                 if (null==value) {
-                    throw new ArgumentNullException("value");
+                    throw new ArgumentNullException(nameof(value));
                 }
                 Contract.EndContractBlock();
 
index b4cf12a..1af377f 100644 (file)
@@ -107,7 +107,7 @@ namespace System.Threading
         public ThreadLocal(Func<T> valueFactory)
         {
             if (valueFactory == null)
-                throw new ArgumentNullException("valueFactory");
+                throw new ArgumentNullException(nameof(valueFactory));
 
             Initialize(valueFactory, false);
         }
@@ -127,7 +127,7 @@ namespace System.Threading
         public ThreadLocal(Func<T> valueFactory, bool trackAllValues)
         {
             if (valueFactory == null)
-                throw new ArgumentNullException("valueFactory");
+                throw new ArgumentNullException(nameof(valueFactory));
 
             Initialize(valueFactory, trackAllValues);
         }
index 8262757..002fe0d 100644 (file)
@@ -1505,7 +1505,7 @@ namespace System.Threading
             }
             else
             {
-                throw new ArgumentNullException("WaitOrTimerCallback");
+                throw new ArgumentNullException(nameof(WaitOrTimerCallback));
             }
             return registeredWaitHandle;
         }
@@ -1687,7 +1687,7 @@ namespace System.Threading
             }
             else
             {
-                throw new ArgumentNullException("WaitCallback");
+                throw new ArgumentNullException(nameof(WaitCallback));
             }
             return success;
         }
@@ -1928,7 +1928,7 @@ namespace System.Threading
         public static bool BindHandle(SafeHandle osHandle)
         {
             if (osHandle == null)
-                throw new ArgumentNullException("osHandle");
+                throw new ArgumentNullException(nameof(osHandle));
             
             bool ret = false;
             bool mustReleaseSafeHandle = false;
index 99eae69..0db5765 100644 (file)
@@ -873,7 +873,7 @@ namespace System.Threading
                                 ref StackCrawlMark stackMark)
         {
             if (callback == null)
-                throw new ArgumentNullException("TimerCallback");
+                throw new ArgumentNullException(nameof(TimerCallback));
             Contract.EndContractBlock();
 
             m_timer = new TimerHolder(new TimerQueueTimer(callback, state, dueTime, period, ref stackMark));
@@ -931,7 +931,7 @@ namespace System.Threading
         public bool Dispose(WaitHandle notifyObject)
         {
             if (notifyObject==null)
-                throw new ArgumentNullException("notifyObject");
+                throw new ArgumentNullException(nameof(notifyObject));
             Contract.EndContractBlock();
 
             return m_timer.Close(notifyObject);
index b8fbe48..cda384c 100644 (file)
@@ -277,7 +277,7 @@ namespace System.Threading
         {
             if (waitHandles == null)
             {
-                throw new ArgumentNullException("waitHandles", Environment.GetResourceString("ArgumentNull_Waithandles"));
+                throw new ArgumentNullException(nameof(waitHandles), Environment.GetResourceString("ArgumentNull_Waithandles"));
             }
             if(waitHandles.Length == 0)
             {
@@ -293,7 +293,7 @@ namespace System.Threading
 #if FEATURE_CORECLR
                 throw new ArgumentException(Environment.GetResourceString("Argument_EmptyWaithandleArray"));
 #else
-                throw new ArgumentNullException("waitHandles", Environment.GetResourceString("Argument_EmptyWaithandleArray"));
+                throw new ArgumentNullException(nameof(waitHandles), Environment.GetResourceString("Argument_EmptyWaithandleArray"));
 #endif
             }
             if (waitHandles.Length > MAX_WAITHANDLES)
@@ -390,7 +390,7 @@ namespace System.Threading
         {
             if (waitHandles==null)
             {
-                throw new ArgumentNullException("waitHandles", Environment.GetResourceString("ArgumentNull_Waithandles"));
+                throw new ArgumentNullException(nameof(waitHandles), Environment.GetResourceString("ArgumentNull_Waithandles"));
             }
             if(waitHandles.Length == 0)
             {
@@ -534,11 +534,11 @@ namespace System.Threading
 #else
             if(null == toSignal)
             {
-                throw new ArgumentNullException("toSignal");
+                throw new ArgumentNullException(nameof(toSignal));
             }
             if(null == toWaitOn)
             {
-                throw new ArgumentNullException("toWaitOn");
+                throw new ArgumentNullException(nameof(toWaitOn));
             }
             if (-1 > millisecondsTimeout)
             {
index 1e0251e..ad0a6e3 100644 (file)
@@ -10,7 +10,7 @@ namespace System {
     // The old way to throw an exception generates quite a lot IL code and assembly code.
     // Following is an example:
     //     C# source
-    //          throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+    //          throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
     //     IL code:
     //          IL_0003:  ldstr      "key"
     //          IL_0008:  ldstr      "ArgumentNull_Key"
index a9d194a..8d6f567 100644 (file)
@@ -738,7 +738,7 @@ namespace System {
 
         static public DateTimeOffset ConvertTime(DateTimeOffset dateTimeOffset, TimeZoneInfo destinationTimeZone) {
             if (destinationTimeZone == null) {
-                throw new ArgumentNullException("destinationTimeZone");
+                throw new ArgumentNullException(nameof(destinationTimeZone));
             }
 
             Contract.EndContractBlock();
@@ -762,7 +762,7 @@ namespace System {
 
         static public DateTime ConvertTime(DateTime dateTime, TimeZoneInfo destinationTimeZone) {
             if (destinationTimeZone == null) {
-                throw new ArgumentNullException("destinationTimeZone");
+                throw new ArgumentNullException(nameof(destinationTimeZone));
             }
             Contract.EndContractBlock();
 
@@ -790,11 +790,11 @@ namespace System {
 
         static private DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags, CachedData cachedData) {
             if (sourceTimeZone == null) {
-                throw new ArgumentNullException("sourceTimeZone");
+                throw new ArgumentNullException(nameof(sourceTimeZone));
             }
 
             if (destinationTimeZone == null) {
-                throw new ArgumentNullException("destinationTimeZone");
+                throw new ArgumentNullException(nameof(destinationTimeZone));
             }
             Contract.EndContractBlock();
 
@@ -921,7 +921,7 @@ namespace System {
         //
         static public TimeZoneInfo FromSerializedString(string source) {
             if (source == null) {
-                throw new ArgumentNullException("source");
+                throw new ArgumentNullException(nameof(source));
             }
             if (source.Length == 0) {
                 throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSerializedString", source), "source");
@@ -1025,7 +1025,7 @@ namespace System {
         //
         public Boolean HasSameRules(TimeZoneInfo other) {
             if (other == null) {
-                throw new ArgumentNullException("other");
+                throw new ArgumentNullException(nameof(other));
             }
 
             // check the utcOffset and supportsDaylightSavingTime members
@@ -1376,7 +1376,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated_required
         void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info == null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
 
@@ -1392,7 +1392,7 @@ namespace System {
         
         TimeZoneInfo(SerializationInfo info, StreamingContext context) {
             if (info == null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
 
             m_id                  = (String)info.GetValue("Id", typeof(String));
@@ -2582,7 +2582,7 @@ namespace System {
             }
 
             if (id == null) {
-                throw new ArgumentNullException("id");
+                throw new ArgumentNullException(nameof(id));
             }
             else if (!IsValidSystemTimeZoneId(id)) {
                 throw new TimeZoneNotFoundException(Environment.GetResourceString("TimeZoneNotFound_MissingData", id));
@@ -4386,7 +4386,7 @@ namespace System {
                 out Boolean adjustmentRulesSupportDst) {
 
             if (id == null) {
-                throw new ArgumentNullException("id");
+                throw new ArgumentNullException(nameof(id));
             }
 
             if (id.Length == 0) {
@@ -4712,7 +4712,7 @@ namespace System {
             [System.Security.SecurityCritical]  // auto-generated_required
             void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) {
                 if (info == null) {
-                    throw new ArgumentNullException("info");
+                    throw new ArgumentNullException(nameof(info));
                 }
                 Contract.EndContractBlock();
  
@@ -4727,7 +4727,7 @@ namespace System {
 
             AdjustmentRule(SerializationInfo info, StreamingContext context) {
                 if (info == null) {
-                    throw new ArgumentNullException("info");
+                    throw new ArgumentNullException(nameof(info));
                 }
 
                 m_dateStart           = (DateTime)info.GetValue("DateStart", typeof(DateTime));
@@ -4976,7 +4976,7 @@ namespace System {
             [System.Security.SecurityCritical]  // auto-generated_required
             void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) {
                 if (info == null) {
-                    throw new ArgumentNullException("info");
+                    throw new ArgumentNullException(nameof(info));
                 }
                 Contract.EndContractBlock();
  
@@ -4990,7 +4990,7 @@ namespace System {
 
             TransitionTime(SerializationInfo info, StreamingContext context) {
                 if (info == null) {
-                    throw new ArgumentNullException("info");
+                    throw new ArgumentNullException(nameof(info));
                 }
 
                 m_timeOfDay       = (DateTime)info.GetValue("TimeOfDay", typeof(DateTime));
index 467a228..e9958b7 100644 (file)
@@ -395,11 +395,11 @@ namespace System {
         {               
            // Must provide some types (Type[0] for nothing)
             if (types == null)
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             Contract.EndContractBlock();
             for (int i=0;i<types.Length;i++)
                 if (types[i] == null)
-                    throw new ArgumentNullException("types");
+                    throw new ArgumentNullException(nameof(types));
             return GetConstructorImpl(bindingAttr, binder, callConvention, types, modifiers);
         }
 
@@ -407,11 +407,11 @@ namespace System {
         public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
         {
             if (types == null)
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             Contract.EndContractBlock();
             for (int i=0;i<types.Length;i++)
                 if (types[i] == null)
-                    throw new ArgumentNullException("types");
+                    throw new ArgumentNullException(nameof(types));
             return GetConstructorImpl(bindingAttr, binder, CallingConventions.Any, types, modifiers);
         }
 
@@ -464,13 +464,13 @@ namespace System {
                                     ParameterModifier[] modifiers)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (types == null)
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             Contract.EndContractBlock();
             for (int i = 0; i < types.Length; i++)
                 if (types[i] == null)
-                    throw new ArgumentNullException("types");
+                    throw new ArgumentNullException(nameof(types));
             return GetMethodImpl(name, bindingAttr, binder, callConvention, types, modifiers);
         }
 
@@ -481,46 +481,46 @@ namespace System {
                                     ParameterModifier[] modifiers)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (types == null)
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             Contract.EndContractBlock();
             for (int i = 0; i < types.Length; i++)
                 if (types[i] == null)
-                    throw new ArgumentNullException("types");
+                    throw new ArgumentNullException(nameof(types));
             return GetMethodImpl(name, bindingAttr, binder, CallingConventions.Any, types, modifiers);
         }
 
         public MethodInfo GetMethod(String name, Type[] types, ParameterModifier[] modifiers)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (types == null)
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             Contract.EndContractBlock();
             for (int i=0;i<types.Length;i++)
                 if (types[i] == null)
-                    throw new ArgumentNullException("types");
+                    throw new ArgumentNullException(nameof(types));
             return GetMethodImpl(name, Type.DefaultLookup, null, CallingConventions.Any, types, modifiers);
         }
 
         public MethodInfo GetMethod(String name,Type[] types)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (types == null)
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             Contract.EndContractBlock();
             for (int i=0;i<types.Length;i++)
                 if (types[i] == null)
-                    throw new ArgumentNullException("types");
+                    throw new ArgumentNullException(nameof(types));
             return GetMethodImpl(name, Type.DefaultLookup, null, CallingConventions.Any, types, null);
         }
 
         public MethodInfo GetMethod(String name, BindingFlags bindingAttr)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             Contract.EndContractBlock();
             return GetMethodImpl(name, bindingAttr, null, CallingConventions.Any, null, null);
         }
@@ -528,7 +528,7 @@ namespace System {
         public MethodInfo GetMethod(String name)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             Contract.EndContractBlock();
             return GetMethodImpl(name, Type.DefaultLookup, null, CallingConventions.Any, null, null);
         }
@@ -584,7 +584,7 @@ namespace System {
         public virtual Type[] FindInterfaces(TypeFilter filter,Object filterCriteria)
         {
             if (filter == null)
-                throw new ArgumentNullException("filter");
+                throw new ArgumentNullException(nameof(filter));
             Contract.EndContractBlock();
             Type[] c = GetInterfaces();
             int cnt = 0;
@@ -631,9 +631,9 @@ namespace System {
                         Type returnType, Type[] types, ParameterModifier[] modifiers)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (types == null)
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             Contract.EndContractBlock();
             return GetPropertyImpl(name,bindingAttr,binder,returnType,types,modifiers);
         }
@@ -641,9 +641,9 @@ namespace System {
         public PropertyInfo GetProperty(String name, Type returnType, Type[] types,ParameterModifier[] modifiers)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (types == null)
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             Contract.EndContractBlock();
             return GetPropertyImpl(name,Type.DefaultLookup,null,returnType,types,modifiers);
         }
@@ -651,7 +651,7 @@ namespace System {
         public PropertyInfo GetProperty(String name, BindingFlags bindingAttr)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             Contract.EndContractBlock();
             return GetPropertyImpl(name,bindingAttr,null,null,null,null);
         }
@@ -659,9 +659,9 @@ namespace System {
         public PropertyInfo GetProperty(String name, Type returnType, Type[] types)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (types == null)
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             Contract.EndContractBlock();
             return GetPropertyImpl(name,Type.DefaultLookup,null,returnType,types,null);
         }
@@ -669,9 +669,9 @@ namespace System {
         public PropertyInfo GetProperty(String name, Type[] types)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (types == null)
-                throw new ArgumentNullException("types");
+                throw new ArgumentNullException(nameof(types));
             Contract.EndContractBlock();
             return GetPropertyImpl(name,Type.DefaultLookup,null,null,types,null);
         }
@@ -679,9 +679,9 @@ namespace System {
         public PropertyInfo GetProperty(String name, Type returnType)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (returnType == null)
-                throw new ArgumentNullException("returnType");
+                throw new ArgumentNullException(nameof(returnType));
             Contract.EndContractBlock();
             return GetPropertyImpl(name,Type.DefaultLookup,null,returnType,null,null);
         }
@@ -689,9 +689,9 @@ namespace System {
         internal PropertyInfo GetProperty(String name, BindingFlags bindingAttr, Type returnType)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             if (returnType == null)
-                throw new ArgumentNullException("returnType");
+                throw new ArgumentNullException(nameof(returnType));
             Contract.EndContractBlock();
             return GetPropertyImpl(name, bindingAttr, null, returnType, null, null);
         }
@@ -699,7 +699,7 @@ namespace System {
         public PropertyInfo GetProperty(String name)
         {
             if (name == null)
-                throw new ArgumentNullException("name");
+                throw new ArgumentNullException(nameof(name));
             Contract.EndContractBlock();
             return GetPropertyImpl(name,Type.DefaultLookup,null,null,null,null);
         }
@@ -1472,7 +1472,7 @@ namespace System {
         public virtual bool IsEnumDefined(object value)
         {
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
 
             if (!IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
@@ -1520,7 +1520,7 @@ namespace System {
         public virtual string GetEnumName(object value)
         {
             if (value == null)
-                throw new ArgumentNullException("value");
+                throw new ArgumentNullException(nameof(value));
 
             if (!IsEnum)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
@@ -1750,7 +1750,7 @@ namespace System {
         // types.
         public static Type[] GetTypeArray(Object[] args) {
             if (args == null)
-                throw new ArgumentNullException("args");
+                throw new ArgumentNullException(nameof(args));
             Contract.EndContractBlock();
             Type[] cls = new Type[args.Length];
             for (int i = 0;i < cls.Length;i++)
index 9b5d28d..a1eae15 100644 (file)
@@ -103,7 +103,7 @@ namespace System {
 
         protected TypeLoadException(SerializationInfo info, StreamingContext context) : base(info, context) {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             ClassName =  info.GetString("TypeLoadClassName");
@@ -122,7 +122,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated_required
         public override void GetObjectData(SerializationInfo info, StreamingContext context) {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
 
             base.GetObjectData(info, context);
index fee0f3a..0fadf39 100644 (file)
@@ -79,7 +79,7 @@ namespace System
             ref StackCrawlMark stackMark)
         {
             if (typeName == null)
-                throw new ArgumentNullException("typeName");
+                throw new ArgumentNullException(nameof(typeName));
             if (typeName.Length > 0 && typeName[0] == '\0')
                 throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength"));
             Contract.EndContractBlock();
index 7c68c41..9d3f36f 100644 (file)
@@ -27,9 +27,9 @@ namespace System {
         [CLSCompliant(false)]
         public static TypedReference MakeTypedReference(Object target, FieldInfo[] flds) {
             if (target == null)
-                throw new ArgumentNullException("target");
+                throw new ArgumentNullException(nameof(target));
             if (flds == null)
-                throw new ArgumentNullException("flds");
+                throw new ArgumentNullException(nameof(flds));
             Contract.EndContractBlock();
             if (flds.Length == 0)
                 throw new ArgumentException(Environment.GetResourceString("Arg_ArrayZeroError"));
index ac3b811..141eb4d 100644 (file)
@@ -71,7 +71,7 @@ namespace System {
         unsafe void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
             info.AddValue("value", (ulong)m_value);
index ec32fce..2840004 100644 (file)
@@ -166,7 +166,7 @@ namespace System {
         internal UnitySerializationHolder(SerializationInfo info, StreamingContext context) 
         {
             if (info == null)
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             Contract.EndContractBlock();
             
             m_unityType = info.GetInt32("UnityType");
index 26e2e4a..98fa321 100644 (file)
@@ -345,7 +345,7 @@ namespace System {
         [System.Security.SecurityCritical]  // auto-generated
         unsafe public Variant(void* voidPointer,Type pointerType) {
             if (pointerType == null)
-                throw new ArgumentNullException("pointerType");
+                throw new ArgumentNullException(nameof(pointerType));
             if (!pointerType.IsPointer)
                 throw new ArgumentException(Environment.GetResourceString("Arg_MustBePointer"),"pointerType");
             Contract.EndContractBlock();
index 34f716a..7761a08 100644 (file)
@@ -272,7 +272,7 @@ namespace System {
 
         public static Version Parse(string input) {
             if (input == null) {
-                throw new ArgumentNullException("input");
+                throw new ArgumentNullException(nameof(input));
             }
             Contract.EndContractBlock();
 
@@ -368,14 +368,14 @@ namespace System {
 
         public static bool operator <(Version v1, Version v2) {
             if ((Object) v1 == null)
-                throw new ArgumentNullException("v1");
+                throw new ArgumentNullException(nameof(v1));
             Contract.EndContractBlock();
             return (v1.CompareTo(v2) < 0);
         }
         
         public static bool operator <=(Version v1, Version v2) {
             if ((Object) v1 == null)
-                throw new ArgumentNullException("v1");
+                throw new ArgumentNullException(nameof(v1));
             Contract.EndContractBlock();
             return (v1.CompareTo(v2) <= 0);
         }
index d12ca3e..27a9ab7 100644 (file)
@@ -53,7 +53,7 @@ namespace System {
 
         protected WeakReference(SerializationInfo info, StreamingContext context) {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
 
@@ -106,7 +106,7 @@ namespace System {
         public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info==null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
             info.AddValue("TrackedObject", Target, typeof(Object));
index b8195df..da2999e 100644 (file)
@@ -46,7 +46,7 @@ namespace System
         internal WeakReference(SerializationInfo info, StreamingContext context)
         {
             if (info == null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();
 
@@ -102,7 +102,7 @@ namespace System
         public void GetObjectData(SerializationInfo info, StreamingContext context)
         {
             if (info == null) {
-                throw new ArgumentNullException("info");
+                throw new ArgumentNullException(nameof(info));
             }
             Contract.EndContractBlock();