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
[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;
[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"));
[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);
public void SetAccessControl(RegistrySecurity registrySecurity) {
EnsureWriteable();
if (registrySecurity == null)
- throw new ArgumentNullException("registrySecurity");
+ throw new ArgumentNullException(nameof(registrySecurity));
registrySecurity.Persist(hkey, keyName);
}
Object[] activationAttributes)
{
if ((object)type == null)
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
Contract.EndContractBlock();
if (type is System.Reflection.Emit.TypeBuilder)
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;
[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);
}
Object[] activationAttributes,
Evidence securityAttributes) {
if (domain == null)
- throw new ArgumentNullException("domain");
+ throw new ArgumentNullException(nameof(domain));
Contract.EndContractBlock();
#if FEATURE_CAS_POLICY
object[] activationAttributes)
{
if (domain == null)
- throw new ArgumentNullException("domain");
+ throw new ArgumentNullException(nameof(domain));
Contract.EndContractBlock();
return domain.InternalCreateInstanceWithNoSecurity(assemblyName,
[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);
}
Object[] activationAttributes,
Evidence securityAttributes) {
if (domain == null)
- throw new ArgumentNullException("domain");
+ throw new ArgumentNullException(nameof(domain));
Contract.EndContractBlock();
#if FEATURE_CAS_POLICY
object[] activationAttributes)
{
if (domain == null)
- throw new ArgumentNullException("domain");
+ throw new ArgumentNullException(nameof(domain));
Contract.EndContractBlock();
return domain.InternalCreateInstanceFromWithNoSecurity(assemblyFile,
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);
}
{
if (innerException == null)
{
- throw new ArgumentNullException("innerException");
+ throw new ArgumentNullException(nameof(innerException));
}
m_innerExceptions = new ReadOnlyCollection<Exception>(new Exception[] { innerException });
{
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,
{
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,
{
if (info == null)
{
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
Exception[] innerExceptions = info.GetValue("InnerExceptions", typeof(Exception[])) as Exception[];
{
if (info == null)
{
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
base.GetObjectData(info, context);
{
if (predicate == null)
{
- throw new ArgumentNullException("predicate");
+ throw new ArgumentNullException(nameof(predicate));
}
List<Exception> unhandledExceptions = null;
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");
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");
throw new NullReferenceException();
if (assemblyName == null)
- throw new ArgumentNullException("assemblyName");
+ throw new ArgumentNullException(nameof(assemblyName));
Contract.EndContractBlock();
return Activator.CreateInstance(assemblyName,
throw new NullReferenceException();
if (assemblyName == null)
- throw new ArgumentNullException("assemblyName");
+ throw new ArgumentNullException(nameof(assemblyName));
Contract.EndContractBlock();
return Activator.CreateInstance(assemblyName,
throw new NullReferenceException();
if (assemblyName == null)
- throw new ArgumentNullException("assemblyName");
+ throw new ArgumentNullException(nameof(assemblyName));
Contract.EndContractBlock();
#if FEATURE_CAS_POLICY
throw new NullReferenceException();
if (assemblyName == null)
- throw new ArgumentNullException("assemblyName");
+ throw new ArgumentNullException(nameof(assemblyName));
Contract.EndContractBlock();
return Activator.CreateInstance(assemblyName,
[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();
//
public Object GetData(string name)
{
if(name == null)
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
Contract.EndContractBlock();
int key = AppDomainSetup.Locate(name);
public static void Unload(AppDomain domain)
{
if (domain == null)
- throw new ArgumentNullException("domain");
+ throw new ArgumentNullException(nameof(domain));
Contract.EndContractBlock();
try {
public void SetAppDomainPolicy(PolicyLevel domainPolicy)
{
if (domainPolicy == null)
- throw new ArgumentNullException("domainPolicy");
+ throw new ArgumentNullException(nameof(domainPolicy));
Contract.EndContractBlock();
if (!IsLegacyCasPolicyEnabled)
public void SetThreadPrincipal(IPrincipal principal)
{
if (principal == null)
- throw new ArgumentNullException("principal");
+ throw new ArgumentNullException(nameof(principal));
Contract.EndContractBlock();
lock (this) {
public void DoCallBack(CrossAppDomainDelegate callBackDelegate)
{
if (callBackDelegate == null)
- throw new ArgumentNullException("callBackDelegate");
+ throw new ArgumentNullException(nameof(callBackDelegate));
Contract.EndContractBlock();
callBackDelegate();
AppDomainSetup info)
{
if (friendlyName == null)
- throw new ArgumentNullException("friendlyName", Environment.GetResourceString("ArgumentNull_String"));
+ throw new ArgumentNullException(nameof(friendlyName), Environment.GetResourceString("ArgumentNull_String"));
Contract.EndContractBlock();
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();
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.
[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;
{
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))
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];
[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);
[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);
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"));
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)
{
// 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"));
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"));
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");
{
// 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"));
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);
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"));
{
// 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"));
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"));
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);
{
// 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"));
// 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.
// 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);
// 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);
// 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)
// 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)) {
{
// Is the array present?
if (array == null)
- throw new ArgumentNullException("array");
+ throw new ArgumentNullException(nameof(array));
// Is it of primitive types?
if (!IsPrimitiveTypeArray(array))
{
// Is the array present?
if (array == null)
- throw new ArgumentNullException("array");
+ throw new ArgumentNullException(nameof(array));
// Is it of primitive types?
if (!IsPrimitiveTypeArray(array))
{
// Is the array present?
if (array == null)
- throw new ArgumentNullException("array");
+ throw new ArgumentNullException(nameof(array));
// Is it of primitive types?
if (!IsPrimitiveTypeArray(array))
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] == '/'){
public static char Parse(String s) {
if (s==null) {
- throw new ArgumentNullException("s");
+ throw new ArgumentNullException(nameof(s));
}
Contract.EndContractBlock();
// <;<;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);
}
// <;<;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);
}
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");
}
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");
}
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");
}
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");
}
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");
}
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");
}
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");
}
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");
}
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");
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");
}
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");
}
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");
}
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");
}
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");
}
[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");
[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");
[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");
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) {
//
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;
//
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);
//
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);
//
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);
//
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();
#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);
//
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);
// 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"));
[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);
[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);
[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);
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)
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();
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();
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);
public override void AddRange(ICollection c) {
if( c == null ) {
- throw new ArgumentNullException("c");
+ throw new ArgumentNullException(nameof(c));
}
Contract.EndContractBlock();
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)
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)
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();
[SecuritySafeCritical]
public override Array ToArray(Type type) {
if (type==null)
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
Contract.EndContractBlock();
InternalUpdateRange();
public ArrayListDebugView( ArrayList arrayList) {
if( arrayList == null)
- throw new ArgumentNullException("arrayList");
+ throw new ArgumentNullException(nameof(arrayList));
this.arrayList = arrayList;
}
}
protected virtual void OnValidate(Object value) {
- if (value == null) throw new ArgumentNullException("value");
+ if (value == null) throw new ArgumentNullException(nameof(value));
Contract.EndContractBlock();
}
public Comparer(CultureInfo culture) {
if (culture==null) {
- throw new ArgumentNullException("culture");
+ throw new ArgumentNullException(nameof(culture));
}
Contract.EndContractBlock();
m_compareInfo = culture.CompareInfo;
[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();
public int GetHashCode(Object obj) {
if( obj == null) {
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
Contract.EndContractBlock();
{
if (collection == null)
{
- throw new ArgumentNullException("collection");
+ throw new ArgumentNullException(nameof(collection));
}
InitializeFromCollection(collection);
// 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
{
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
{
if (collection == null)
{
- throw new ArgumentNullException("collection");
+ throw new ArgumentNullException(nameof(collection));
}
InitializeFromCollection(collection);
}
// 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
{
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
{
if (items == null)
{
- throw new ArgumentNullException("items");
+ throw new ArgumentNullException(nameof(items));
}
PushRange(items, 0, items.Length);
}
{
if (items == null)
{
- throw new ArgumentNullException("items");
+ throw new ArgumentNullException(nameof(items));
}
if (count < 0)
{
{
if (items == null)
{
- throw new ArgumentNullException("items");
+ throw new ArgumentNullException(nameof(items));
}
return TryPopRange(items, 0, items.Length);
{
if (collection == null)
{
- throw new ArgumentNullException("collection");
+ throw new ArgumentNullException(nameof(collection));
}
m_collection = collection;
{
if (list == null)
{
- throw new ArgumentNullException("list");
+ throw new ArgumentNullException(nameof(list));
}
if (loadBalance)
{
if (array == null)
{
- throw new ArgumentNullException("array");
+ throw new ArgumentNullException(nameof(array));
}
if (loadBalance)
{
{
if (source == null)
{
- throw new ArgumentNullException("source");
+ throw new ArgumentNullException(nameof(source));
}
if ((partitionerOptions & (~EnumerablePartitionerOptions.NoBuffering)) != 0)
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"));
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)
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)
Contract.Ensures(Contract.Result<Comparer<T>>() != null);
if (comparison == null)
- throw new ArgumentNullException("comparison");
+ throw new ArgumentNullException(nameof(comparison));
return new ComparisonComparer<T>(comparison);
}
public Mscorlib_KeyedCollectionDebugView(KeyedCollection<K, T> keyedCollection) {
if (keyedCollection == null) {
- throw new ArgumentNullException("keyedCollection");
+ throw new ArgumentNullException(nameof(keyedCollection));
}
Contract.EndContractBlock();
[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)
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();
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();
//
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();
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)
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();
[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) {
[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.");
[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);
}
[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
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)
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)
[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
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);
public HashtableDebugView( Hashtable hashtable) {
if( hashtable == null) {
- throw new ArgumentNullException( "hashtable");
+ throw new ArgumentNullException(nameof(hashtable));
}
Contract.EndContractBlock();
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;
}
set {
if (key == null) {
- throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
}
Contract.EndContractBlock();
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();
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) {
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"));
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++;
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)
public ReadOnlyDictionary(IDictionary<TKey, TValue> dictionary) {
if (dictionary == null) {
- throw new ArgumentNullException("dictionary");
+ throw new ArgumentNullException(nameof(dictionary));
}
Contract.EndContractBlock();
m_dictionary = dictionary;
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);
// 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)
// 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)
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) {
//
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;
[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);
}
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) {
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,
public SortedListDebugView( SortedList sortedList) {
if( sortedList == null) {
- throw new ArgumentNullException("sortedList");
+ throw new ArgumentNullException(nameof(sortedList));
}
Contract.EndContractBlock();
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())
// 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)
[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);
public StackDebugView( Stack stack) {
if( stack == null)
- throw new ArgumentNullException("stack");
+ throw new ArgumentNullException(nameof(stack));
Contract.EndContractBlock();
this.stack = stack;
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();
public static Object ChangeType(Object value, Type conversionType, IFormatProvider provider) {
if( conversionType == null) {
- throw new ArgumentNullException("conversionType");
+ throw new ArgumentNullException(nameof(conversionType));
}
Contract.EndContractBlock();
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)
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();
[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();
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)
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)
// "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();
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"));
//
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;
}
//
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));
}
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));
}
private DateTime(SerializationInfo info, StreamingContext context) {
if (info==null)
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
Boolean foundTicks = false;
[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();
[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();
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));
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];
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;
// 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");
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;
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;
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
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;
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;
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;
{
// 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;
{
// 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;
{
// 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)
{
// 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();
// 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))
private DelegateSerializationHolder(SerializationInfo info, StreamingContext context)
{
if (info == null)
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
bool bNewWire = true;
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");
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++)
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)
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++)
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)
public DebuggerTypeProxyAttribute(Type type)
{
if (type == null) {
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
}
Contract.EndContractBlock();
{
set {
if( value == null) {
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
{
set {
if( value == null) {
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
public DebuggerVisualizerAttribute(string visualizerTypeName, Type visualizerObjectSource)
{
if (visualizerObjectSource == null) {
- throw new ArgumentNullException("visualizerObjectSource");
+ throw new ArgumentNullException(nameof(visualizerObjectSource));
}
Contract.EndContractBlock();
this.visualizerName = visualizerTypeName;
public DebuggerVisualizerAttribute(Type visualizer)
{
if (visualizer == null) {
- throw new ArgumentNullException("visualizer");
+ throw new ArgumentNullException(nameof(visualizer));
}
Contract.EndContractBlock();
this.visualizerName = visualizer.AssemblyQualifiedName;
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;
public DebuggerVisualizerAttribute(Type visualizer, string visualizerObjectSourceTypeName)
{
if (visualizer == null) {
- throw new ArgumentNullException("visualizer");
+ throw new ArgumentNullException(nameof(visualizer));
}
Contract.EndContractBlock();
this.visualizerName = visualizer.AssemblyQualifiedName;
{
set {
if( value == null) {
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
get
{
if (key == null)
- throw new System.ArgumentNullException("key");
+ throw new System.ArgumentNullException(nameof(key));
int position = 0;
foreach(var name in m_names)
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)
{
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)
public EventSourceActivity(EventSource eventSource)
{
if (eventSource == null)
- throw new ArgumentNullException("eventSource");
+ throw new ArgumentNullException(nameof(eventSource));
Contract.EndContractBlock();
this.eventSource = eventSource;
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.");
{
if (eventSourceName == null)
{
- throw new ArgumentNullException("eventSourceName");
+ throw new ArgumentNullException(nameof(eventSourceName));
}
Contract.EndContractBlock();
}
{
if (eventName == null)
{
- throw new ArgumentNullException("eventName");
+ throw new ArgumentNullException(nameof(eventName));
}
Contract.EndContractBlock();
{
if (eventName == null)
{
- throw new ArgumentNullException("eventName");
+ throw new ArgumentNullException(nameof(eventName));
}
Contract.EndContractBlock();
{
if (name == null)
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
Contract.EndContractBlock();
{
if (defaultName == null)
{
- throw new ArgumentNullException("defaultName");
+ throw new ArgumentNullException(nameof(defaultName));
}
Contract.EndContractBlock();
{
if (paramInfos == null)
{
- throw new ArgumentNullException("paramInfos");
+ throw new ArgumentNullException(nameof(paramInfos));
}
Contract.EndContractBlock();
{
if (types == null)
{
- throw new ArgumentNullException("types");
+ throw new ArgumentNullException(nameof(types));
}
Contract.EndContractBlock();
{
if (typeInfos == null)
{
- throw new ArgumentNullException("typeInfos");
+ throw new ArgumentNullException(nameof(typeInfos));
}
Contract.EndContractBlock();
{
if (dataType == null)
{
- throw new ArgumentNullException("dataType");
+ throw new ArgumentNullException(nameof(dataType));
}
Contract.EndContractBlock();
{
if (dataType == null)
{
- throw new ArgumentNullException("dataType");
+ throw new ArgumentNullException(nameof(dataType));
}
if (name == null)
public StackTrace(Exception e)
{
if (e == null)
- throw new ArgumentNullException("e");
+ throw new ArgumentNullException(nameof(e));
Contract.EndContractBlock();
m_iNumOfFrames = 0;
public StackTrace(Exception e, bool fNeedFileInfo)
{
if (e == null)
- throw new ArgumentNullException("e");
+ throw new ArgumentNullException(nameof(e));
Contract.EndContractBlock();
m_iNumOfFrames = 0;
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",
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",
[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);
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;
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();
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();
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);
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();
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
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);
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;
[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())) {
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
public static String ExpandEnvironmentVariables(String name)
{
if (name == null)
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
Contract.EndContractBlock();
if (name.Length == 0) {
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()) {
{
if (variable == null)
{
- throw new ArgumentNullException("variable");
+ throw new ArgumentNullException(nameof(variable));
}
Contract.EndContractBlock();
private static void CheckEnvironmentVariableName(string variable) {
if (variable == null) {
- throw new ArgumentNullException("variable");
+ throw new ArgumentNullException(nameof(variable));
}
if( variable.Length == 0) {
protected Exception(SerializationInfo info, StreamingContext context)
{
if (info==null)
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
_className = info.GetString("ClassName");
{
if (info == null)
{
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
Contract.EndContractBlock();
{
if (formattable == null)
{
- throw new ArgumentNullException("formattable");
+ throw new ArgumentNullException(nameof(formattable));
}
return formattable.ToString(Globalization.CultureInfo.InvariantCulture);
[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);
}
[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);
}
[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); }
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"));
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"));
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"));
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");
}
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");
}
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"));
// 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();
{
if (name == null)
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
Contract.EndContractBlock();
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) {
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();
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();
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);
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);
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);
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);
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);
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);
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);
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);
{
// 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"));
{
// 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)
{
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.
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.
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.
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.
{
// Verify Arguments
if (source==null)
- throw new ArgumentNullException("source");
+ throw new ArgumentNullException(nameof(source));
Contract.EndContractBlock();
// Validate CompareOptions
{
// 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
[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.
{
if (source == null)
{
- throw new ArgumentNullException("source");
+ throw new ArgumentNullException(nameof(source));
}
if (options == CompareOptions.Ordinal)
//
if(null == source)
{
- throw new ArgumentNullException("source");
+ throw new ArgumentNullException(nameof(source));
}
if ((options & ValidHashCodeOfStringMaskOffFlags) != 0)
public CultureInfo(String name, bool useUserOverride) {
if (name==null) {
- throw new ArgumentNullException("name",
+ throw new ArgumentNullException(nameof(name),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
internal CultureInfo(String cultureName, String textAndCompareCultureName)
{
if (cultureName==null) {
- throw new ArgumentNullException("cultureName",
+ throw new ArgumentNullException(nameof(cultureName),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
set {
#if FEATURE_APPX
if (value == null) {
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
if (AppDomain.IsAppXModel()) {
set {
#if FEATURE_APPX
if (value == null) {
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
if (AppDomain.IsAppXModel()) {
}
set {
if (value == null) {
- throw new ArgumentNullException("value",
+ throw new ArgumentNullException(nameof(value),
Environment.GetResourceString("ArgumentNull_Obj"));
}
Contract.EndContractBlock();
set {
if (value == null) {
- throw new ArgumentNullException("value",
+ throw new ArgumentNullException(nameof(value),
Environment.GetResourceString("ArgumentNull_Obj"));
}
Contract.EndContractBlock();
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();
// 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();
// 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();
[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);
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();
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();
public int GetEra(String eraName) {
if (eraName == null) {
- throw new ArgumentNullException("eraName",
+ throw new ArgumentNullException(nameof(eraName),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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) {
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)
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)
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)
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)
public static DateTimeFormatInfo ReadOnly(DateTimeFormatInfo dtfi) {
if (dtfi == null) {
- throw new ArgumentNullException("dtfi",
+ throw new ArgumentNullException(nameof(dtfi),
Environment.GetResourceString("ArgumentNull_Obj"));
}
Contract.EndContractBlock();
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"));
}
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)
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)
internal static int GetCodePageFromName(String name)
{
if (name==null) {
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
Contract.EndContractBlock();
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);
}
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"));
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"));
}
set {
if (value == null) {
- throw new ArgumentNullException("CurrencyGroupSizes",
+ throw new ArgumentNullException(nameof(CurrencyGroupSizes),
Environment.GetResourceString("ArgumentNull_Obj"));
}
Contract.EndContractBlock();
}
set {
if (value == null) {
- throw new ArgumentNullException("NumberGroupSizes",
+ throw new ArgumentNullException(nameof(NumberGroupSizes),
Environment.GetResourceString("ArgumentNull_Obj"));
}
Contract.EndContractBlock();
}
set {
if (value == null) {
- throw new ArgumentNullException("PercentGroupSizes",
+ throw new ArgumentNullException(nameof(PercentGroupSizes),
Environment.GetResourceString("ArgumentNull_Obj"));
}
Contract.EndContractBlock();
get { return currencySymbol; }
set {
if (value == null) {
- throw new ArgumentNullException("CurrencySymbol",
+ throw new ArgumentNullException(nameof(CurrencySymbol),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
}
set {
if (value == null) {
- throw new ArgumentNullException("NaNSymbol",
+ throw new ArgumentNullException(nameof(NaNSymbol),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
}
set {
if (value == null) {
- throw new ArgumentNullException("NegativeInfinitySymbol",
+ throw new ArgumentNullException(nameof(NegativeInfinitySymbol),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
get { return negativeSign; }
set {
if (value == null) {
- throw new ArgumentNullException("NegativeSign",
+ throw new ArgumentNullException(nameof(NegativeSign),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
}
set {
if (value == null) {
- throw new ArgumentNullException("PositiveInfinitySymbol",
+ throw new ArgumentNullException(nameof(PositiveInfinitySymbol),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
get { return positiveSign; }
set {
if (value == null) {
- throw new ArgumentNullException("PositiveSign",
+ throw new ArgumentNullException(nameof(PositiveSign),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
}
set {
if (value == null) {
- throw new ArgumentNullException("PercentSymbol",
+ throw new ArgumentNullException(nameof(PercentSymbol),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
get { return perMilleSymbol; }
set {
if (value == null) {
- throw new ArgumentNullException("PerMilleSymbol",
+ throw new ArgumentNullException(nameof(PerMilleSymbol),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
public static NumberFormatInfo ReadOnly(NumberFormatInfo nfi) {
if (nfi == null) {
- throw new ArgumentNullException("nfi");
+ throw new ArgumentNullException(nameof(nfi));
}
Contract.EndContractBlock();
if (nfi.IsReadOnly) {
[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
{
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();
}
set {
if (null == value) {
- throw new ArgumentNullException("String",
+ throw new ArgumentNullException(nameof(String),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
// Validate parameters.
//
if (str==null) {
- throw new ArgumentNullException("str");
+ throw new ArgumentNullException(nameof(str));
}
Contract.EndContractBlock();
//
if (str==null)
{
- throw new ArgumentNullException("str");
+ throw new ArgumentNullException(nameof(str));
}
Contract.EndContractBlock();
{
if (str == null)
{
- throw new ArgumentNullException("str");
+ throw new ArgumentNullException(nameof(str));
}
Contract.EndContractBlock();
[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); }
{
if (value == null)
{
- throw new ArgumentNullException("value", Environment.GetResourceString("ArgumentNull_String"));
+ throw new ArgumentNullException(nameof(value), Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
VerifyWritable();
[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);
[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);
}
{
if (str == null)
{
- throw new ArgumentNullException("str");
+ throw new ArgumentNullException(nameof(str));
}
Contract.EndContractBlock();
if (str.Length == 0)
// Validate inputs
if (str==null)
{
- throw new ArgumentNullException("str");
+ throw new ArgumentNullException(nameof(str));
}
Contract.EndContractBlock();
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();
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");
public Guid(String g)
{
if (g==null) {
- throw new ArgumentNullException("g");
+ throw new ArgumentNullException(nameof(g));
}
Contract.EndContractBlock();
this = Guid.Empty;
public static Guid Parse(String input)
{
if (input == null) {
- throw new ArgumentNullException("input");
+ throw new ArgumentNullException(nameof(input));
}
Contract.EndContractBlock();
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
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"));
[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"));
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)
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();
//
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);
}
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);
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);
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");
[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();
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();
[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();
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);
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();
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();
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);
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();
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();
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);
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();
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();
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);
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);
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);
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();
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();
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();
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);
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();
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();
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);
[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);
[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();
public static DirectoryInfo UnsafeCreateDirectoryInfo(String path)
{
if (path == null)
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
Contract.EndContractBlock();
DirectoryInfo di = new DirectoryInfo();
public DirectoryInfo(String path)
{
if (path==null)
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
Contract.EndContractBlock();
Init(path, true);
#endif
public DirectoryInfo CreateSubdirectory(String path) {
if (path == null)
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
Contract.EndContractBlock();
return CreateSubdirectory(path, null);
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);
public FileInfo[] GetFiles(String searchPattern)
{
if (searchPattern == null)
- throw new ArgumentNullException("searchPattern");
+ throw new ArgumentNullException(nameof(searchPattern));
Contract.EndContractBlock();
return InternalGetFiles(searchPattern, SearchOption.TopDirectoryOnly);
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();
public FileSystemInfo[] GetFileSystemInfos(String searchPattern)
{
if (searchPattern == null)
- throw new ArgumentNullException("searchPattern");
+ throw new ArgumentNullException(nameof(searchPattern));
Contract.EndContractBlock();
return InternalGetFileSystemInfos(searchPattern, SearchOption.TopDirectoryOnly);
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();
public DirectoryInfo[] GetDirectories(String searchPattern)
{
if (searchPattern == null)
- throw new ArgumentNullException("searchPattern");
+ throw new ArgumentNullException(nameof(searchPattern));
Contract.EndContractBlock();
return InternalGetDirectories(searchPattern, SearchOption.TopDirectoryOnly);
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();
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);
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();
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);
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();
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);
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();
[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();
public DriveInfo(String driveName)
{
if (driveName == null)
- throw new ArgumentNullException("driveName");
+ throw new ArgumentNullException(nameof(driveName));
Contract.EndContractBlock();
if (driveName.Length == 1)
_name = driveName + ":\\";
public static StreamReader OpenText(String path)
{
if (path == null)
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
Contract.EndContractBlock();
return new StreamReader(path);
}
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);
}
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);
}
//
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)
//
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)
[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)
[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);
internal static void UnsafeDelete(String path)
{
if (path == null)
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
Contract.EndContractBlock();
InternalDelete(path, false);
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);
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);
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);
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();
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();
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();
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();
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();
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();
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);
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);
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
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();
[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)
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);
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);
public static FileInfo UnsafeCreateFileInfo(String fileName)
{
if (fileName == null)
- throw new ArgumentNullException("fileName");
+ throw new ArgumentNullException(nameof(fileName));
Contract.EndContractBlock();
FileInfo fi = new FileInfo();
public FileInfo(String fileName)
{
if (fileName == null)
- throw new ArgumentNullException("fileName");
+ throw new ArgumentNullException(nameof(fileName));
Contract.EndContractBlock();
Init(fileName, true);
//
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();
//
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();
[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();
{
if (path == null)
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
VerifyAccess(access);
m_access = access;
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();
public void SetAccessControl(FileSecurity fileSecurity)
{
if (fileSecurity == null)
- throw new ArgumentNullException("fileSecurity");
+ throw new ArgumentNullException(nameof(fileSecurity));
Contract.EndContractBlock();
if (_handle.IsClosed) __Error.FileNotOpen();
[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)
[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)
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)
// 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)
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)
public unsafe override void EndWrite(IAsyncResult asyncResult)
{
if (asyncResult==null)
- throw new ArgumentNullException("asyncResult");
+ throw new ArgumentNullException(nameof(asyncResult));
Contract.EndContractBlock();
if (!_isAsync) {
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)
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)
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
}
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;
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)
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)
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)
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)
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)
// 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();
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);
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);
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);
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);
public static String Combine(params String[] paths) {
if (paths == null) {
- throw new ArgumentNullException("paths");
+ throw new ArgumentNullException(nameof(paths));
}
Contract.EndContractBlock();
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) {
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"));
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);
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();
public virtual void EndWrite(IAsyncResult asyncResult)
{
if (asyncResult==null)
- throw new ArgumentNullException("asyncResult");
+ throw new ArgumentNullException(nameof(asyncResult));
Contract.EndContractBlock();
var writeTask = _activeReadWriteTask;
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)
public override int EndRead(IAsyncResult asyncResult)
{
if (asyncResult == null)
- throw new ArgumentNullException("asyncResult");
+ throw new ArgumentNullException(nameof(asyncResult));
Contract.EndContractBlock();
return BlockingEndRead(asyncResult);
public override void EndWrite(IAsyncResult asyncResult)
{
if (asyncResult == null)
- throw new ArgumentNullException("asyncResult");
+ throw new ArgumentNullException(nameof(asyncResult));
Contract.EndContractBlock();
BlockingEndWrite(asyncResult);
internal SyncStream(Stream stream)
{
if (stream == null)
- throw new ArgumentNullException("stream");
+ throw new ArgumentNullException(nameof(stream));
Contract.EndContractBlock();
_stream = stream;
}
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();
public override void EndWrite(IAsyncResult asyncResult)
{
if (asyncResult == null)
- throw new ArgumentNullException("asyncResult");
+ throw new ArgumentNullException(nameof(asyncResult));
Contract.EndContractBlock();
lock(_stream)
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)
// 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)
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)
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)
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)
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)
: 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"));
: 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"));
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)
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)
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)
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)
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)
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)
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();
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)
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)
[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();
//
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)
#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"));
[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"));
[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"));
[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"));
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)
[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)
[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)
[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)
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)
// 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();
// 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"));
[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
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;
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.
[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);
[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);
// 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;
[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];
[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];
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, "");
}
if ((Object) version == null)
- throw new ArgumentNullException("version");
+ throw new ArgumentNullException(nameof(version));
Contract.EndContractBlock();
_platform = platform;
[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();
/// <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;
}
**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));
public static Assembly GetAssembly(Type type)
{
if (type == null)
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
Contract.EndContractBlock();
Module m = type.Module;
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);
}
public static Assembly LoadWithPartialName(String partialName)
{
if(partialName == null)
- throw new ArgumentNullException("partialName");
+ throw new ArgumentNullException(nameof(partialName));
return Load(partialName);
}
#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;
#if FEATURE_CORECLR
Assembly result = null;
if(path == null)
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
if (Path.IsRelative(path))
{
{
// 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;
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info==null)
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
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;
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;
ref StackCrawlMark stackMark)
{
if (assemblyFile == null)
- throw new ArgumentNullException("assemblyFile");
+ throw new ArgumentNullException(nameof(assemblyFile));
Contract.EndContractBlock();
out RuntimeAssembly assemblyFromResolveEvent)
{
if (assemblyString == null)
- throw new ArgumentNullException("assemblyString");
+ throw new ArgumentNullException(nameof(assemblyString));
Contract.EndContractBlock();
if ((assemblyString.Length == 0) ||
{
if (assemblyRef == null)
- throw new ArgumentNullException("assemblyRef");
+ throw new ArgumentNullException(nameof(assemblyRef));
Contract.EndContractBlock();
if (assemblyRef.CodeBase != null)
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();
StringBuilder sb = new StringBuilder();
if(type == null) {
if (name == null)
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
}
else {
String nameSpace = type.Namespace;
ref StackCrawlMark stackMark)
{
if (culture == null)
- throw new ArgumentNullException("culture");
+ throw new ArgumentNullException(nameof(culture));
Contract.EndContractBlock();
public AssemblyFileVersionAttribute(String version)
{
if (version == null)
- throw new ArgumentNullException("version");
+ throw new ArgumentNullException(nameof(version));
Contract.EndContractBlock();
_version = version;
}
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
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.
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'))
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;
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;
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
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
MemberInfoSerializationHolder.GetSerializationInfo(
info,
public static IList<CustomAttributeData> GetCustomAttributes(MemberInfo target)
{
if (target == null)
- throw new ArgumentNullException("target");
+ throw new ArgumentNullException(nameof(target));
return target.GetCustomAttributesData();
}
public static IList<CustomAttributeData> GetCustomAttributes(Module target)
{
if (target == null)
- throw new ArgumentNullException("target");
+ throw new ArgumentNullException(nameof(target));
Contract.EndContractBlock();
return target.GetCustomAttributesData();
public static IList<CustomAttributeData> GetCustomAttributes(Assembly target)
{
if (target == null)
- throw new ArgumentNullException("target");
+ throw new ArgumentNullException(nameof(target));
Contract.EndContractBlock();
return target.GetCustomAttributesData();
public static IList<CustomAttributeData> GetCustomAttributes(ParameterInfo target)
{
if (target == null)
- throw new ArgumentNullException("target");
+ throw new ArgumentNullException(nameof(target));
Contract.EndContractBlock();
return target.GetCustomAttributesData();
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;
public CustomAttributeNamedArgument(MemberInfo memberInfo, CustomAttributeTypedArgument typedArgument)
{
if (memberInfo == null)
- throw new ArgumentNullException("memberInfo");
+ throw new ArgumentNullException(nameof(memberInfo));
m_memberInfo = memberInfo;
m_value = typedArgument;
{
// 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;
{
// value cannot be null.
if (value == null)
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
m_value = CanonicalizeValue(value);
m_argumentType = value.GetType();
RuntimeModule customAttributeModule)
{
if (customAttributeModule == null)
- throw new ArgumentNullException("customAttributeModule");
+ throw new ArgumentNullException(nameof(customAttributeModule));
Contract.EndContractBlock();
Contract.Assert(customAttributeCtorParameters != null);
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;
SecurityContextSource securityContextSource)
{
if (name == null)
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
if (access != AssemblyBuilderAccess.Run
#if !FEATURE_CORECLR
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')
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)))
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)))
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)))
public void DefineUnmanagedResource(Byte[] resource)
{
if (resource == null)
- throw new ArgumentNullException("resource");
+ throw new ArgumentNullException(nameof(resource));
Contract.EndContractBlock();
lock(SyncRoot)
public void DefineUnmanagedResource(String resourceFileName)
{
if (resourceFileName == null)
- throw new ArgumentNullException("resourceFileName");
+ throw new ArgumentNullException(nameof(resourceFileName));
Contract.EndContractBlock();
lock(SyncRoot)
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();
{
if (entryMethod == null)
- throw new ArgumentNullException("entryMethod");
+ throw new ArgumentNullException(nameof(entryMethod));
Contract.EndContractBlock();
BCLDebug.Log("DYNIL", "## DYNIL LOGGING: AssemblyBuilder.SetEntryPoint");
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)
{
if (customBuilder == null)
{
- throw new ArgumentNullException("customBuilder");
+ throw new ArgumentNullException(nameof(customBuilder));
}
Contract.EndContractBlock();
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)))
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) ||
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)
{
LocalBuilder localBuilder;
if (localType == null)
- throw new ArgumentNullException("localType");
+ throw new ArgumentNullException(nameof(localType));
Contract.EndContractBlock();
RuntimeType rtType = localType as RuntimeType;
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;
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;
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;
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;
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);
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");
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;
{
// 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"));
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];
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];
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];
m_methodHandle = null;
if (name == null)
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
#if FEATURE_APPX
if (AppDomain.ProfileAPICheck)
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
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;
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);
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)))
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)))
{
if (mdBuilder == null)
{
- throw new ArgumentNullException("mdBuilder");
+ throw new ArgumentNullException(nameof(mdBuilder));
}
Contract.EndContractBlock();
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();
{
if (customBuilder == null)
{
- throw new ArgumentNullException("customBuilder");
+ throw new ArgumentNullException(nameof(customBuilder));
}
Contract.EndContractBlock();
m_type.ThrowIfCreated();
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");
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"));
public void SetMarshal(UnmanagedMarshal unmanagedMarshal)
{
if (unmanagedMarshal == null)
- throw new ArgumentNullException("unmanagedMarshal");
+ throw new ArgumentNullException(nameof(unmanagedMarshal));
Contract.EndContractBlock();
m_typeBuilder.ThrowIfCreated();
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;
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
if (customBuilder == null)
- throw new ArgumentNullException("customBuilder");
+ throw new ArgumentNullException(nameof(customBuilder));
Contract.EndContractBlock();
m_typeBuilder.ThrowIfCreated();
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))
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");
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;
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;
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
if (local == null)
{
- throw new ArgumentNullException("local");
+ throw new ArgumentNullException(nameof(local));
}
Contract.EndContractBlock();
int tempVal = local.GetLocalIndex();
} 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();
// 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)) {
if (fld == null)
{
- throw new ArgumentNullException("fld");
+ throw new ArgumentNullException(nameof(fld));
}
Contract.EndContractBlock();
}
if (localType==null) {
- throw new ArgumentNullException("localType");
+ throw new ArgumentNullException(nameof(localType));
}
if (methodBuilder.m_bIsBaked) {
// 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");
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");
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)
foreach(Type t in parameterTypes)
{
if (t == null)
- throw new ArgumentNullException("parameterTypes");
+ throw new ArgumentNullException(nameof(parameterTypes));
}
}
// 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();
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");
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"));
public void AddDeclarativeSecurity(SecurityAction action, PermissionSet pset)
{
if (pset == null)
- throw new ArgumentNullException("pset");
+ throw new ArgumentNullException(nameof(pset));
Contract.EndContractBlock();
ThrowIfGeneric ();
{
if (il == null)
{
- throw new ArgumentNullException("il", Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(nameof(il), Environment.GetResourceString("ArgumentNull_Array"));
}
if (maxStack < 0)
{
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();
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
if (customBuilder == null)
- throw new ArgumentNullException("customBuilder");
+ throw new ArgumentNullException(nameof(customBuilder));
Contract.EndContractBlock();
ThrowIfGeneric();
// 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;
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);
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
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");
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)
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)
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");
private TypeToken GetTypeTokenWorkerNoLock(Type type, bool getGenericDefinition)
{
if (type == null)
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
Contract.EndContractBlock();
CheckContext(type);
// 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;
{
if (constructor == null)
{
- throw new ArgumentNullException("constructor");
+ throw new ArgumentNullException(nameof(constructor));
}
lock (SyncRoot)
{
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.
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");
{
if (str == null)
{
- throw new ArgumentNullException("str");
+ throw new ArgumentNullException(nameof(str));
}
Contract.EndContractBlock();
if (sigHelper == null)
{
- throw new ArgumentNullException("sigHelper");
+ throw new ArgumentNullException(nameof(sigHelper));
}
Contract.EndContractBlock();
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];
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(
{
if (customBuilder == null)
{
- throw new ArgumentNullException("customBuilder");
+ throw new ArgumentNullException(nameof(customBuilder));
}
Contract.EndContractBlock();
{
// 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)
if (entryPoint == null)
{
- throw new ArgumentNullException("entryPoint");
+ throw new ArgumentNullException(nameof(entryPoint));
}
Contract.EndContractBlock();
{
if (unmanagedMarshal == null)
{
- throw new ArgumentNullException("unmanagedMarshal");
+ throw new ArgumentNullException(nameof(unmanagedMarshal));
}
Contract.EndContractBlock();
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(
{
if (customBuilder == null)
{
- throw new ArgumentNullException("customBuilder");
+ throw new ArgumentNullException(nameof(customBuilder));
}
Contract.EndContractBlock();
customBuilder.CreateCustomAttribute((ModuleBuilder) (m_methodBuilder .GetModule()), m_pdToken.Token);
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')
{
if (mdBuilder == null)
{
- throw new ArgumentNullException("mdBuilder");
+ throw new ArgumentNullException(nameof(mdBuilder));
}
m_containingType.ThrowIfCreated();
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(
{
if (customBuilder == null)
{
- throw new ArgumentNullException("customBuilder");
+ throw new ArgumentNullException(nameof(customBuilder));
}
m_containingType.ThrowIfCreated();
customBuilder.CreateCustomAttribute(m_moduleBuilder, m_prToken.Token);
throw new ArgumentNullException("module");
if (type == null)
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
return new SignatureHelper(mod, type);
}
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");
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");
public void AddArgument(Type argument, bool pinned)
{
if (argument == null)
- throw new ArgumentNullException("argument");
+ throw new ArgumentNullException(nameof(argument));
IncrementArgCounts();
AddOneArgTypeHelper(argument, pinned);
throw new ArgumentException(Environment.GetResourceString("Argument_SigIsFinalized"));
if (argument == null)
- throw new ArgumentNullException("argument");
+ throw new ArgumentNullException(nameof(argument));
IncrementArgCounts();
internal void SetElementType(Type baseType)
{
if (baseType == null)
- throw new ArgumentNullException("baseType");
+ throw new ArgumentNullException(nameof(baseType));
Contract.EndContractBlock();
m_baseType = baseType;
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;
public CustAttr(CustomAttributeBuilder customBuilder)
{
if (customBuilder == null)
- throw new ArgumentNullException("customBuilder");
+ throw new ArgumentNullException(nameof(customBuilder));
Contract.EndContractBlock();
m_customBuilder = customBuilder;
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");
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];
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");
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");
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;
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;
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();
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();
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();
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");
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.
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();
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')
{
if (interfaceType == null)
{
- throw new ArgumentNullException("interfaceType");
+ throw new ArgumentNullException(nameof(interfaceType));
}
Contract.EndContractBlock();
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) ||
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,
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);
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);
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;
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;
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
MemberInfoSerializationHolder.GetSerializationInfo(
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;
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;
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
MemberInfoSerializationHolder.GetSerializationInfo(
info,
{
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){
Type[] genericArguments)
{
if (info == null)
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
String assemblyName = reflectedClass.Module.Assembly.FullName;
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");
{
if (assembly == null)
{
- throw new ArgumentNullException("assembly");
+ throw new ArgumentNullException(nameof(assembly));
}
blob = null;
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;
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;
{
// Validate the parameters.
if (delegateType == null)
- throw new ArgumentNullException("delegateType");
+ throw new ArgumentNullException(nameof(delegateType));
Contract.EndContractBlock();
RuntimeType rtType = delegateType as RuntimeType;
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];
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)
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);
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);
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);
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,
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;
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;
{
if (info == null)
{
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
Contract.EndContractBlock();
UnitySerializationHolder.GetUnitySerializationInfo(info, UnitySerializationHolder.ModuleUnity, this.ScopeName, this.GetRuntimeAssembly());
{
// 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;
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;
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;
public virtual bool IsDefined(Type attributeType, bool inherit)
{
if (attributeType == null)
- throw new ArgumentNullException("attributeType");
+ throw new ArgumentNullException(nameof(attributeType));
Contract.EndContractBlock();
return false;
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
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))
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))
[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();
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;
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;
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
MemberInfoSerializationHolder.GetSerializationInfo(
public virtual TypeInfo GetTypeForObject(object value)
{
if (value == null)
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
return MapType(value.GetType().GetTypeInfo());
}
[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);
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);
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;
}
public StrongNameKeyPair(FileStream keyPairFile)
{
if (keyPairFile == null)
- throw new ArgumentNullException("keyPairFile");
+ throw new ArgumentNullException(nameof(keyPairFile));
Contract.EndContractBlock();
int length = (int)keyPairFile.Length;
public StrongNameKeyPair(byte[] keyPairArray)
{
if (keyPairArray == null)
- throw new ArgumentNullException("keyPairArray");
+ throw new ArgumentNullException(nameof(keyPairArray));
Contract.EndContractBlock();
_keyPairArray = new byte[keyPairArray.Length];
public StrongNameKeyPair(String keyPairContainer)
{
if (keyPairContainer == null)
- throw new ArgumentNullException("keyPairContainer");
+ throw new ArgumentNullException(nameof(keyPairContainer));
Contract.EndContractBlock();
_keyPairContainer = keyPairContainer;
public TypeDelegator(Type delegatingType) {
if (delegatingType == null)
- throw new ArgumentNullException("delegatingType");
+ throw new ArgumentNullException(nameof(delegatingType));
Contract.EndContractBlock();
typeImpl = delegatingType;
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)
public Object Resolve(Assembly assembly)
{
if (assembly == null)
- throw new ArgumentNullException("assembly");
+ throw new ArgumentNullException(nameof(assembly));
Contract.EndContractBlock();
Stream data = assembly.GetManifestResourceStream(_manifestResourceName);
public NeutralResourcesLanguageAttribute(String cultureName)
{
if (cultureName == null)
- throw new ArgumentNullException("cultureName");
+ throw new ArgumentNullException(nameof(cultureName));
Contract.EndContractBlock();
_culture = cultureName;
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();
//
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
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))
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
public ResourceManager(Type resourceSource)
{
if (null==resourceSource)
- throw new ArgumentNullException("resourceSource");
+ throw new ArgumentNullException(nameof(resourceSource));
Contract.EndContractBlock();
if (!(resourceSource is RuntimeType))
[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;
{
// 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();
//
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
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
{
if (rm == null)
{
- throw new ArgumentNullException("rm");
+ throw new ArgumentNullException(nameof(rm));
}
_rm = rm;
}
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();
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"));
public ResourceSet(IResourceReader reader)
{
if (reader == null)
- throw new ArgumentNullException("reader");
+ throw new ArgumentNullException(nameof(reader));
Contract.EndContractBlock();
Reader = reader;
CommonInit();
public ResourceSet(IResourceReader reader, Assembly assembly)
{
if (reader == null)
- throw new ArgumentNullException("reader");
+ throw new ArgumentNullException(nameof(reader));
Contract.EndContractBlock();
Reader = reader;
CommonInit();
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
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();
public SatelliteContractVersionAttribute(String version)
{
if (version == null)
- throw new ArgumentNullException("version");
+ throw new ArgumentNullException(nameof(version));
Contract.EndContractBlock();
_version = version;
}
ref StackCrawlMark stackMark)
{
if (typeName == null)
- throw new ArgumentNullException("typeName");
+ throw new ArgumentNullException(nameof(typeName));
Contract.EndContractBlock();
return RuntimeTypeHandle.GetTypeByName(
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;
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)
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
public override string GetEnumName(object value)
{
if (value == null)
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
Contract.EndContractBlock();
Type valueType = value.GetType();
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];
{
#region Non-TransparentProxy case
if (name == null)
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
bool[] isByRef = modifiers == null ? null : modifiers[0].IsByRefArray;
#region Name
if (name == null)
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
if (name.Length == 0 || name.Equals(@"[DISPID=0]"))
{
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."
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);
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;
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;
// 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.
/// <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)
// 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.
// 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.
/// <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();
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.
/// <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;
if (createValueCallback == null)
{
- throw new ArgumentNullException("createValueCallback");
+ throw new ArgumentNullException(nameof(createValueCallback));
}
TValue existingValue;
{
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);
[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);
[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
public TypeDependencyAttribute (string typeName)
{
- if(typeName == null) throw new ArgumentNullException("typeName");
+ if(typeName == null) throw new ArgumentNullException(nameof(typeName));
Contract.EndContractBlock();
this.typeName = typeName;
}
{
if (String.IsNullOrEmpty(assemblyFullName))
{
- throw new ArgumentNullException("assemblyFullName");
+ throw new ArgumentNullException(nameof(assemblyFullName));
}
this.assemblyFullName = assemblyFullName;
}
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())
{
if (source == null)
{
- throw new ArgumentNullException("source", Environment.GetResourceString("ArgumentNull_Obj"));
+ throw new ArgumentNullException(nameof(source), Environment.GetResourceString("ArgumentNull_Obj"));
}
return new ExceptionDispatchInfo(source);
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");
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");
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();
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)
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);
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;
public static void PrelinkAll(Type c)
{
if (c == null)
- throw new ArgumentNullException("c");
+ throw new ArgumentNullException(nameof(c));
Contract.EndContractBlock();
MethodInfo[] mi = c.GetMethods();
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;
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");
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;
}
if (rtModule == null)
- throw new ArgumentNullException("m",Environment.GetResourceString("Argument_MustBeRuntimeModule"));
+ throw new ArgumentNullException(nameof(m),Environment.GetResourceString("Argument_MustBeRuntimeModule"));
return GetHINSTANCE(rtModule.GetNativeHandle());
}
public static String GetTypeLibName(ITypeLib typelib)
{
if (typelib == null)
- throw new ArgumentNullException("typelib");
+ throw new ArgumentNullException(nameof(typelib));
Contract.EndContractBlock();
String strTypeLibName = null;
internal static String GetTypeLibNameInternal(ITypeLib typelib)
{
if (typelib == null)
- throw new ArgumentNullException("typelib");
+ throw new ArgumentNullException(nameof(typelib));
Contract.EndContractBlock();
// Try GUID_ManagedName first
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;
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;
public static String GetTypeInfoName(ITypeInfo typeInfo)
{
if (typeInfo == null)
- throw new ArgumentNullException("typeInfo");
+ throw new ArgumentNullException(nameof(typeInfo));
Contract.EndContractBlock();
String strTypeLibName = null;
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
public static Int32 FinalReleaseComObject(Object o)
{
if (o == null)
- throw new ArgumentNullException("o");
+ throw new ArgumentNullException(nameof(o));
Contract.EndContractBlock();
__ComObject co = null;
#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;
#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;
{
// 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)
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");
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)
{
// 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)
public static IntPtr GetFunctionPointerForDelegate(Delegate d)
{
if (d == null)
- throw new ArgumentNullException("d");
+ throw new ArgumentNullException(nameof(d));
Contract.EndContractBlock();
return GetFunctionPointerForDelegateInternal(d);
[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();
[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();
{
if (s == null)
{
- throw new ArgumentNullException("s");
+ throw new ArgumentNullException(nameof(s));
}
Contract.EndContractBlock();
[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();
[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();
{
// 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"));
{
// 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"));
{
// Validate the arguments.
if (assembly == null)
- throw new ArgumentNullException("assembly");
+ throw new ArgumentNullException(nameof(assembly));
Contract.EndContractBlock();
if (!(assembly is RuntimeAssembly))
{
#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");
{
#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");
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)
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)
[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);
}
/// </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,
/// </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,
[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");
[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;
{
// 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)
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)
internal ConstantSplittableMap(IReadOnlyDictionary<TKey, TValue> data)
{
if (data == null)
- throw new ArgumentNullException("data");
+ throw new ArgumentNullException(nameof(data));
Contract.EndContractBlock();
this.firstItemIndex = 0;
internal ConstantSplittableMap(IMapView<TKey, TValue> data)
{
if (data == null)
- throw new ArgumentNullException("data");
+ throw new ArgumentNullException(nameof(data));
if (((UInt32)Int32.MaxValue) < data.Size)
{
public CustomPropertyImpl(PropertyInfo propertyInfo)
{
if (propertyInfo == null)
- throw new ArgumentNullException("propertyInfo");
+ throw new ArgumentNullException(nameof(propertyInfo));
m_property = propertyInfo;
}
public DictionaryKeyCollection(IDictionary<TKey, TValue> dictionary)
{
if (dictionary == null)
- throw new ArgumentNullException("dictionary");
+ throw new ArgumentNullException(nameof(dictionary));
this.dictionary = dictionary;
}
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)
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();
public DictionaryValueCollection(IDictionary<TKey, TValue> dictionary)
{
if (dictionary == null)
- throw new ArgumentNullException("dictionary");
+ throw new ArgumentNullException(nameof(dictionary));
this.dictionary = dictionary;
}
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)
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();
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);
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);
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);
public ReadOnlyDictionaryKeyCollection(IReadOnlyDictionary<TKey, TValue> dictionary)
{
if (dictionary == null)
- throw new ArgumentNullException("dictionary");
+ throw new ArgumentNullException(nameof(dictionary));
this.dictionary = dictionary;
}
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)
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();
public ReadOnlyDictionaryValueCollection(IReadOnlyDictionary<TKey, TValue> dictionary)
{
if (dictionary == null)
- throw new ArgumentNullException("dictionary");
+ throw new ArgumentNullException(nameof(dictionary));
this.dictionary = dictionary;
}
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)
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();
internal ListToBindableVectorViewAdapter(IList list)
{
if (list == null)
- throw new ArgumentNullException("list");
+ throw new ArgumentNullException(nameof(list));
Contract.EndContractBlock();
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.
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");
internal V Indexer_Get<K, V>(K key)
{
if (key == null)
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
Contract.EndContractBlock();
internal void Indexer_Set<K, V>(K key, V value)
{
if (key == null)
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
Contract.EndContractBlock();
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);
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"));
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))
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))
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");
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
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
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
public static IActivationFactory GetActivationFactory(Type type)
{
if (type == null)
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
if (type.IsWindowsRuntimeObject && type.IsImport)
{
throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_WinRT"));
if (s == null)
- throw new ArgumentNullException("s");
+ throw new ArgumentNullException(nameof(s));
unsafe
{
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;
{
if (assemblyPath == null)
{
- throw new ArgumentNullException("assemblyPath");
+ throw new ArgumentNullException(nameof(assemblyPath));
}
if (Path.IsRelative(assemblyPath))
{
if (nativeImagePath == null)
{
- throw new ArgumentNullException("nativeImagePath");
+ throw new ArgumentNullException(nameof(nativeImagePath));
}
if (Path.IsRelative(nativeImagePath))
{
if (assembly == null)
{
- throw new ArgumentNullException("assembly");
+ throw new ArgumentNullException(nameof(assembly));
}
int iAssemblyStreamLength = (int)assembly.Length;
{
if (unmanagedDllPath == null)
{
- throw new ArgumentNullException("unmanagedDllPath");
+ throw new ArgumentNullException(nameof(unmanagedDllPath));
}
if (unmanagedDllPath.Length == 0)
{
{
if (context == null)
{
- throw new ArgumentNullException("context");
+ throw new ArgumentNullException(nameof(context));
}
// Try to override the default assembly load context
{
if (assemblyPath == null)
{
- throw new ArgumentNullException("assemblyPath");
+ throw new ArgumentNullException(nameof(assemblyPath));
}
String fullPath = Path.GetFullPathInternal(assemblyPath);
{
if (assembly == null)
{
- throw new ArgumentNullException("assembly");
+ throw new ArgumentNullException(nameof(assembly));
}
AssemblyLoadContext loadContextForAssembly = null;
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);
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);
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);
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);
[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);
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);
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);
[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);
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);
[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);
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);
[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);
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);
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);
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);
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);
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);
MemberInfo[] members;
if ((object)type==null) {
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
}
Contract.EndContractBlock();
[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();
[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();
[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) {
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.
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();
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) {
public static ISerializationSurrogate GetSurrogateForCyclicalReference(ISerializationSurrogate innerSurrogate)
{
if (innerSurrogate == null)
- throw new ArgumentNullException("innerSurrogate");
+ throw new ArgumentNullException(nameof(innerSurrogate));
Contract.EndContractBlock();
return new SurrogateForCyclicalReference(innerSurrogate);
}
[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);
}
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);
internal SurrogateForCyclicalReference(ISerializationSurrogate innerSurrogate)
{
if (innerSurrogate == null)
- throw new ArgumentNullException("innerSurrogate");
+ throw new ArgumentNullException(nameof(innerSurrogate));
this.innerSurrogate = innerSurrogate;
}
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));
{
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();
{
if (null == value)
{
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
{
if (null == value)
{
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
if (this.requireSameTokenInPartialTrust)
{
if ((object)type == null)
{
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
}
Contract.EndContractBlock();
{
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();
{
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);
if ((object)type == null)
{
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
}
Contract.EndContractBlock();
{
if (frameworkName == null)
{
- throw new ArgumentNullException("frameworkName");
+ throw new ArgumentNullException(nameof(frameworkName));
}
if (frameworkName.Length == 0)
{
public TargetFrameworkAttribute(String frameworkName)
{
if (frameworkName == null)
- throw new ArgumentNullException("frameworkName");
+ throw new ArgumentNullException(nameof(frameworkName));
Contract.EndContractBlock();
_frameworkName = frameworkName;
}
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));
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)
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));
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)
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));
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)
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 ))
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));
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 );
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
public virtual PermissionSet ResolvePolicy(Evidence evidence)
{
if (evidence == null)
- throw new ArgumentNullException("evidence");
+ throw new ArgumentNullException(nameof(evidence));
Contract.EndContractBlock();
//
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;
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);
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) );
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))
// 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;
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();
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)
public StrongNamePublicKeyBlob( byte[] publicKey )
{
if (publicKey == null)
- throw new ArgumentNullException( "PublicKey" );
+ throw new ArgumentNullException( nameof(PublicKey) );
Contract.EndContractBlock();
this.PublicKey = new byte[publicKey.Length];
public UrlIdentityPermission( String site )
{
if (site == null)
- throw new ArgumentNullException( "site" );
+ throw new ArgumentNullException( nameof(site) );
Contract.EndContractBlock();
Url = site;
}
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);
public void Remove (KeyContainerPermissionAccessEntry accessEntry) {
if (accessEntry == null)
- throw new ArgumentNullException("accessEntry");
+ throw new ArgumentNullException(nameof(accessEntry));
Contract.EndContractBlock();
m_list.Remove(accessEntry);
}
/// <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)
public KeyContainerPermission (KeyContainerPermissionFlags flags, KeyContainerPermissionAccessEntry[] accessList) {
if (accessList == null)
- throw new ArgumentNullException("accessList");
+ throw new ArgumentNullException(nameof(accessList));
Contract.EndContractBlock();
VerifyFlags(flags);
public ApplicationTrust(PermissionSet defaultGrantSet, IEnumerable<StrongName> fullTrustAssemblies) {
if (fullTrustAssemblies == null) {
- throw new ArgumentNullException("fullTrustAssemblies");
+ throw new ArgumentNullException(nameof(fullTrustAssemblies));
}
InitDefaultGrantSet(defaultGrantSet);
// 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
}
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;
}
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"));
[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();
[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;
[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;
[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();
[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;
[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;
[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)
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();
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();
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
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
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();
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))
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 ) );
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" ))
public Site(String name)
{
if (name == null)
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
Contract.EndContractBlock();
m_name = new SiteString( name );
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;
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();
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 );
public Url( String name )
{
if (name == null)
- throw new ArgumentNullException( "name" );
+ throw new ArgumentNullException( nameof(name) );
Contract.EndContractBlock();
m_url = new URLString( name );
public static Zone CreateFromUrl( String url )
{
if (url == null)
- throw new ArgumentNullException( "url" );
+ throw new ArgumentNullException( nameof(url) );
Contract.EndContractBlock();
return new Zone( url );
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();
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 ) );
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 ) );
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 ) );
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 ) );
public void AddChild( SecurityElement child )
{
if (child == null)
- throw new ArgumentNullException( "child" );
+ throw new ArgumentNullException( nameof(child) );
Contract.EndContractBlock();
if (m_lChildren == null)
internal void AddChild( ISecurityElementFactory child )
{
if (child == null)
- throw new ArgumentNullException( "child" );
+ throw new ArgumentNullException( nameof(child) );
Contract.EndContractBlock();
if (m_lChildren == null)
internal void AddChildNoDuplicates( ISecurityElementFactory child )
{
if (child == null)
- throw new ArgumentNullException( "child" );
+ throw new ArgumentNullException( nameof(child) );
Contract.EndContractBlock();
if (m_lChildren == null)
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
// 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
// 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
// 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
protected SecurityException(SerializationInfo info, StreamingContext context) : base (info, context)
{
if (info==null)
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
try
protected SecurityException(SerializationInfo info, StreamingContext context) : base(info, context)
{
if (info == null)
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
}
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);
public static PermissionSet GetStandardSandbox(Evidence evidence)
{
if (evidence == null)
- throw new ArgumentNullException("evidence");
+ throw new ArgumentNullException(nameof(evidence));
Contract.EndContractBlock();
//
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)
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);
public static byte[] DecodeHexString(String hexString)
{
if (hexString == null)
- throw new ArgumentNullException( "hexString" );
+ throw new ArgumentNullException( nameof(hexString) );
Contract.EndContractBlock();
bool spaceSkippingMode = false;
public void AddExpressions( String str )
{
if (str == null)
- throw new ArgumentNullException( "str" );
+ throw new ArgumentNullException( nameof(str) );
Contract.EndContractBlock();
if (str.Length == 0)
return;
{
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] );
{
if (url == null)
{
- throw new ArgumentNullException( "url" );
+ throw new ArgumentNullException( nameof(url) );
}
Contract.EndContractBlock();
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();
{
if (culture == null)
{
- throw new ArgumentNullException("culture");
+ throw new ArgumentNullException(nameof(culture));
}
Contract.EndContractBlock();
[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) {
[Pure]
public Boolean EndsWith(String value, Boolean ignoreCase, CultureInfo culture) {
if (null==value) {
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
[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);
[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) {
[Pure]
public Boolean StartsWith(String value, Boolean ignoreCase, CultureInfo culture) {
if (null==value) {
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
{
if (args == null)
{
- throw new ArgumentNullException("args");
+ throw new ArgumentNullException(nameof(args));
}
Contract.Ensures(Contract.Result<String>() != null);
Contract.EndContractBlock();
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();
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();
[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();
{
// 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();
{
// 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();
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
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);
//
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);
}
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)
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();
[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();
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"));
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();
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();
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();
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"));
[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
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)
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"));
[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();
[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>()));
[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();
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();
public int GetHashCode(object obj) {
if( obj == null) {
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
Contract.EndContractBlock();
public override int GetHashCode(string obj) {
if( obj == null) {
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
Contract.EndContractBlock();
public override int GetHashCode(string obj) {
if( obj == null) {
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
Contract.EndContractBlock();
public override int GetHashCode(string obj) {
if( obj == null) {
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
Contract.EndContractBlock();
[System.Security.SecuritySafeCritical]
public override int GetHashCode(string obj) {
if( obj == null) {
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
Contract.EndContractBlock();
{
if (pHandle == null)
{
- throw new ArgumentNullException("pHandle", Environment.GetResourceString("ArgumentNull_SafeHandle"));
+ throw new ArgumentNullException(nameof(pHandle), Environment.GetResourceString("ArgumentNull_SafeHandle"));
}
Contract.EndContractBlock();
{
if (pHandle == null)
{
- throw new ArgumentNullException("pHandle", Environment.GetResourceString("ArgumentNull_SafeHandle"));
+ throw new ArgumentNullException(nameof(pHandle), Environment.GetResourceString("ArgumentNull_SafeHandle"));
}
Contract.EndContractBlock();
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
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
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));
{
// 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:
set
{
if (value == null)
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
Contract.EndContractBlock();
// Can't change fallback if buffer is wrong
{
// Validate input parameters
if (bytes == null)
- throw new ArgumentNullException("bytes",
+ throw new ArgumentNullException(nameof(bytes),
Environment.GetResourceString("ArgumentNull_Array"));
if (count < 0)
{
// 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)
{
// 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)
{
// 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)
{
// Validate Parameters
if (bytes == null)
- throw new ArgumentNullException("bytes",
+ throw new ArgumentNullException(nameof(bytes),
Environment.GetResourceString("ArgumentNull_Array"));
if (index < 0 || count < 0)
{
// Validate parameters
if (bytes == null)
- throw new ArgumentNullException("bytes",
+ throw new ArgumentNullException(nameof(bytes),
Environment.GetResourceString("ArgumentNull_Array"));
if (count < 0)
{
// 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)
{
// 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)
{
// 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)
{
// 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)
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
set
{
if (value == null)
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
Contract.EndContractBlock();
// Can't change fallback if buffer is wrong
{
// Validate input parameters
if (chars == null)
- throw new ArgumentNullException("chars",
+ throw new ArgumentNullException(nameof(chars),
Environment.GetResourceString("ArgumentNull_Array"));
if (count < 0)
{
// 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)
{
// 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)
{
// 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"),
{
// Validate input parameters
if (chars == null)
- throw new ArgumentNullException( "chars",
+ throw new ArgumentNullException(nameof(chars),
Environment.GetResourceString("ArgumentNull_Array"));
if (index < 0 || count < 0)
{
// Validate input parameters
if (chars == null)
- throw new ArgumentNullException( "chars",
+ throw new ArgumentNullException(nameof(chars),
Environment.GetResourceString("ArgumentNull_Array"));
if (count < 0)
{
// 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)
{
// 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)
{
// 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)
{
// 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"),
{
// 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
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
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
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);
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);
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
if (value == null)
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
Contract.EndContractBlock();
encoderFallback = value;
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
if (value == null)
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
Contract.EndContractBlock();
decoderFallback = value;
{
if (chars == null)
{
- throw new ArgumentNullException("chars",
+ throw new ArgumentNullException(nameof(chars),
Environment.GetResourceString("ArgumentNull_Array"));
}
Contract.EndContractBlock();
public virtual int GetByteCount(String s)
{
if (s==null)
- throw new ArgumentNullException("s");
+ throw new ArgumentNullException(nameof(s));
Contract.EndContractBlock();
char[] chars = s.ToCharArray();
{
// Validate input parameters
if (chars == null)
- throw new ArgumentNullException("chars",
+ throw new ArgumentNullException(nameof(chars),
Environment.GetResourceString("ArgumentNull_Array"));
if (count < 0)
{
if (chars == null)
{
- throw new ArgumentNullException("chars",
+ throw new ArgumentNullException(nameof(chars),
Environment.GetResourceString("ArgumentNull_Array"));
}
Contract.EndContractBlock();
public virtual byte[] GetBytes(String s)
{
if (s == null)
- throw new ArgumentNullException("s",
+ throw new ArgumentNullException(nameof(s),
Environment.GetResourceString("ArgumentNull_String"));
Contract.EndContractBlock();
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);
}
{
// 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)
{
if (bytes == null)
{
- throw new ArgumentNullException("bytes",
+ throw new ArgumentNullException(nameof(bytes),
Environment.GetResourceString("ArgumentNull_Array"));
}
Contract.EndContractBlock();
{
// Validate input parameters
if (bytes == null)
- throw new ArgumentNullException("bytes",
+ throw new ArgumentNullException(nameof(bytes),
Environment.GetResourceString("ArgumentNull_Array"));
if (count < 0)
{
if (bytes == null)
{
- throw new ArgumentNullException("bytes",
+ throw new ArgumentNullException(nameof(bytes),
Environment.GetResourceString("ArgumentNull_Array"));
}
Contract.EndContractBlock();
{
// 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)
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"));
public virtual String GetString(byte[] bytes)
{
if (bytes == null)
- throw new ArgumentNullException("bytes",
+ throw new ArgumentNullException(nameof(bytes),
Environment.GetResourceString("ArgumentNull_Array"));
Contract.EndContractBlock();
// 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
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
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
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
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)
{
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)
{
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)
{
}
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"));
}
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
internal static void AddProvider(EncodingProvider provider)
{
if (provider == null)
- throw new ArgumentNullException("provider");
+ throw new ArgumentNullException(nameof(provider));
lock (s_InternalSyncObject)
{
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
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
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
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));
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));
{
// 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
[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;
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info==null) {
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
Contract.EndContractBlock();
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"));
if (startIndex == 0 && count == 0) {
return this;
}
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
if (count == 0) {
[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) {
{
return this;
}
- throw new ArgumentNullException("value", Environment.GetResourceString("ArgumentNull_String"));
+ throw new ArgumentNullException(nameof(value), Environment.GetResourceString("ArgumentNull_String"));
}
//Range check the array.
{
// 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();
{
// 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();
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();
}
if (oldValue == null)
{
- throw new ArgumentNullException("oldValue");
+ throw new ArgumentNullException(nameof(oldValue));
}
if (oldValue.Length == 0)
{
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
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
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
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
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
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
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
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
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
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
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
public CancellationTokenRegistration Register(Action callback)
{
if (callback == null)
- throw new ArgumentNullException("callback");
+ throw new ArgumentNullException(nameof(callback));
return Register(
s_ActionToActionObjShunt,
public CancellationTokenRegistration Register(Action callback, bool useSynchronizationContext)
{
if (callback == null)
- throw new ArgumentNullException("callback");
+ throw new ArgumentNullException(nameof(callback));
return Register(
s_ActionToActionObjShunt,
public CancellationTokenRegistration Register(Action<Object> callback, Object state)
{
if (callback == null)
- throw new ArgumentNullException("callback");
+ throw new ArgumentNullException(nameof(callback));
return Register(
callback,
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
if (callback == null)
- throw new ArgumentNullException("callback");
+ throw new ArgumentNullException(nameof(callback));
if (CanBeCanceled == false)
{
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"));
#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)
public void SetAccessControl(EventWaitHandleSecurity eventSecurity)
{
if (eventSecurity == null)
- throw new ArgumentNullException("eventSecurity");
+ throw new ArgumentNullException(nameof(eventSecurity));
Contract.EndContractBlock();
eventSecurity.Persist(safeWaitHandle);
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info==null)
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
#if FEATURE_REMOTING
public static bool IsEntered(object obj)
{
if (obj == null)
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
return IsEnteredNative(obj);
}
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);
}
{
if (obj == null)
{
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
Contract.EndContractBlock();
{
if (obj == null)
{
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
Contract.EndContractBlock();
{
if (name == null)
{
- throw new ArgumentNullException("name", Environment.GetResourceString("ArgumentNull_WithParamName"));
+ throw new ArgumentNullException(nameof(name), Environment.GetResourceString("ArgumentNull_WithParamName"));
}
if(name.Length == 0)
public void SetAccessControl(MutexSecurity mutexSecurity)
{
if (mutexSecurity == null)
- throw new ArgumentNullException("mutexSecurity");
+ throw new ArgumentNullException(nameof(mutexSecurity));
Contract.EndContractBlock();
mutexSecurity.Persist(safeWaitHandle);
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;
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;
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)
}
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)
{
if (waitHandles == null)
{
- throw new ArgumentNullException("waitHandles");
+ throw new ArgumentNullException(nameof(waitHandles));
}
Contract.EndContractBlock();
return WaitHelper(waitHandles, waitAll, millisecondsTimeout);
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();
{
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.
{
if (body == null)
{
- throw new ArgumentNullException("body");
+ throw new ArgumentNullException(nameof(body));
}
return ForWorker<object>(
{
if (body == null)
{
- throw new ArgumentNullException("body");
+ throw new ArgumentNullException(nameof(body));
}
return ForWorker64<object>(
{
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>(
{
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>(
{
if (body == null)
{
- throw new ArgumentNullException("body");
+ throw new ArgumentNullException(nameof(body));
}
return ForWorker<object>(
{
if (body == null)
{
- throw new ArgumentNullException("body");
+ throw new ArgumentNullException(nameof(body));
}
return ForWorker64<object>(
{
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>(
{
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>(
{
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(
{
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(
{
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(
{
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 == 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>(
{
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>(
{
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>(
{
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>(
{
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>(
{
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>(
{
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>(
{
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>(
{
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>(
{
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>(
{
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);
{
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);
{
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)
{
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);
{
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)
{
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);
{
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);
{
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)
{
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);
{
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)
[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;
[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;
[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;
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;
[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;
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;
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;
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;
[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;
[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;
[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;
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;
[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;
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;
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;
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;
[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;
[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;
[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;
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;
[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;
[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;
[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;
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;
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);
}
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;
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;
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;
[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;
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;
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;
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;
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();
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();
[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
[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"));
[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);
[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"));
[HostProtection(ExternalThreading=true)]
set {
if (value == null) {
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
#endif
set {
if (null==value) {
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
Contract.EndContractBlock();
public ThreadLocal(Func<T> valueFactory)
{
if (valueFactory == null)
- throw new ArgumentNullException("valueFactory");
+ throw new ArgumentNullException(nameof(valueFactory));
Initialize(valueFactory, false);
}
public ThreadLocal(Func<T> valueFactory, bool trackAllValues)
{
if (valueFactory == null)
- throw new ArgumentNullException("valueFactory");
+ throw new ArgumentNullException(nameof(valueFactory));
Initialize(valueFactory, trackAllValues);
}
}
else
{
- throw new ArgumentNullException("WaitOrTimerCallback");
+ throw new ArgumentNullException(nameof(WaitOrTimerCallback));
}
return registeredWaitHandle;
}
}
else
{
- throw new ArgumentNullException("WaitCallback");
+ throw new ArgumentNullException(nameof(WaitCallback));
}
return success;
}
public static bool BindHandle(SafeHandle osHandle)
{
if (osHandle == null)
- throw new ArgumentNullException("osHandle");
+ throw new ArgumentNullException(nameof(osHandle));
bool ret = false;
bool mustReleaseSafeHandle = false;
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));
public bool Dispose(WaitHandle notifyObject)
{
if (notifyObject==null)
- throw new ArgumentNullException("notifyObject");
+ throw new ArgumentNullException(nameof(notifyObject));
Contract.EndContractBlock();
return m_timer.Close(notifyObject);
{
if (waitHandles == null)
{
- throw new ArgumentNullException("waitHandles", Environment.GetResourceString("ArgumentNull_Waithandles"));
+ throw new ArgumentNullException(nameof(waitHandles), Environment.GetResourceString("ArgumentNull_Waithandles"));
}
if(waitHandles.Length == 0)
{
#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)
{
if (waitHandles==null)
{
- throw new ArgumentNullException("waitHandles", Environment.GetResourceString("ArgumentNull_Waithandles"));
+ throw new ArgumentNullException(nameof(waitHandles), Environment.GetResourceString("ArgumentNull_Waithandles"));
}
if(waitHandles.Length == 0)
{
#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)
{
// 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"
static public DateTimeOffset ConvertTime(DateTimeOffset dateTimeOffset, TimeZoneInfo destinationTimeZone) {
if (destinationTimeZone == null) {
- throw new ArgumentNullException("destinationTimeZone");
+ throw new ArgumentNullException(nameof(destinationTimeZone));
}
Contract.EndContractBlock();
static public DateTime ConvertTime(DateTime dateTime, TimeZoneInfo destinationTimeZone) {
if (destinationTimeZone == null) {
- throw new ArgumentNullException("destinationTimeZone");
+ throw new ArgumentNullException(nameof(destinationTimeZone));
}
Contract.EndContractBlock();
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();
//
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");
//
public Boolean HasSameRules(TimeZoneInfo other) {
if (other == null) {
- throw new ArgumentNullException("other");
+ throw new ArgumentNullException(nameof(other));
}
// check the utcOffset and supportsDaylightSavingTime members
[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();
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));
}
if (id == null) {
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
else if (!IsValidSystemTimeZoneId(id)) {
throw new TimeZoneNotFoundException(Environment.GetResourceString("TimeZoneNotFound_MissingData", id));
out Boolean adjustmentRulesSupportDst) {
if (id == null) {
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
if (id.Length == 0) {
[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();
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));
[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();
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));
{
// 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);
}
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);
}
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);
}
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);
}
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);
}
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;
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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");
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");
// 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++)
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");
[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);
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();
[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"));
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);
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");
[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();
public static Version Parse(string input) {
if (input == null) {
- throw new ArgumentNullException("input");
+ throw new ArgumentNullException(nameof(input));
}
Contract.EndContractBlock();
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);
}
protected WeakReference(SerializationInfo info, StreamingContext context) {
if (info==null) {
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
Contract.EndContractBlock();
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));
internal WeakReference(SerializationInfo info, StreamingContext context)
{
if (info == null) {
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
Contract.EndContractBlock();
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null) {
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
Contract.EndContractBlock();