Xamarin Public Jenkins (auto-signing) 966bba02bb Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
2017-06-07 13:16:24 +00:00

69 lines
2.9 KiB
C#

//------------------------------------------------------------------------------
// <copyright file="InvalidEnumArgumentException.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.ComponentModel {
using Microsoft.Win32;
using System;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.Serialization;
#if MONO_FEATURE_CAS
using System.Security.Permissions;
#endif
/// <devdoc>
/// <para>The exception that is thrown when using invalid arguments that are enumerators.</para>
/// </devdoc>
#if MONO_FEATURE_CAS
[HostProtection(SharedState = true)]
#endif
[Serializable]
public class InvalidEnumArgumentException : ArgumentException {
/// <devdoc>
/// <para>Initializes a new instance of the <see cref='System.ComponentModel.InvalidEnumArgumentException'/> class without a message.</para>
/// </devdoc>
public InvalidEnumArgumentException() : this(null) {
}
/// <devdoc>
/// <para>Initializes a new instance of the <see cref='System.ComponentModel.InvalidEnumArgumentException'/> class with
/// the specified message.</para>
/// </devdoc>
public InvalidEnumArgumentException(string message)
: base(message) {
}
/// <devdoc>
/// Initializes a new instance of the Exception class with a specified error message and a
/// reference to the inner exception that is the cause of this exception.
/// FxCop CA1032: Multiple constructors are required to correctly implement a custom exception.
/// </devdoc>
public InvalidEnumArgumentException( string message, Exception innerException )
: base(message, innerException) {
}
/// <devdoc>
/// <para>Initializes a new instance of the <see cref='System.ComponentModel.InvalidEnumArgumentException'/> class with a
/// message generated from the argument, invalid value, and enumeration
/// class.</para>
/// </devdoc>
public InvalidEnumArgumentException(string argumentName, int invalidValue, Type enumClass)
: base(SR.GetString(SR.InvalidEnumArgument,
argumentName,
invalidValue.ToString(CultureInfo.CurrentCulture),
enumClass.Name), argumentName) {
}
/// <devdoc>
/// Need this constructor since Exception implements ISerializable. We don't have any fields,
/// so just forward this to base.
/// </devdoc>
protected InvalidEnumArgumentException(SerializationInfo info, StreamingContext context) : base(info, context) {
}
}
}