Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / clr / src / BCL / System / ArgumentException.cs / 1 / ArgumentException.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================== ** ** Class: ArgumentException ** ** ** Purpose: Exception class for invalid arguments to a method. ** ** =============================================================================*/ namespace System { using System; using System.Runtime.Remoting; using System.Runtime.Serialization; using System.Globalization; using System.Security.Permissions; // The ArgumentException is thrown when an argument does not meet // the contract of the method. Ideally it should give a meaningful error // message describing what was wrong and which parameter is incorrect. // [System.Runtime.InteropServices.ComVisible(true)] [Serializable()] public class ArgumentException : SystemException, ISerializable { private String m_paramName; // Creates a new ArgumentException with its message // string set to the empty string. public ArgumentException() : base(Environment.GetResourceString("Arg_ArgumentException")) { SetErrorCode(__HResults.COR_E_ARGUMENT); } // Creates a new ArgumentException with its message // string set to message. // public ArgumentException(String message) : base(message) { SetErrorCode(__HResults.COR_E_ARGUMENT); } public ArgumentException(String message, Exception innerException) : base(message, innerException) { SetErrorCode(__HResults.COR_E_ARGUMENT); } public ArgumentException(String message, String paramName, Exception innerException) : base(message, innerException) { m_paramName = paramName; SetErrorCode(__HResults.COR_E_ARGUMENT); } public ArgumentException (String message, String paramName) : base (message) { m_paramName = paramName; SetErrorCode(__HResults.COR_E_ARGUMENT); } protected ArgumentException(SerializationInfo info, StreamingContext context) : base(info, context) { m_paramName = info.GetString("ParamName"); } public override String Message { get { String s = base.Message; if (! ((m_paramName == null) || (m_paramName.Length == 0)) ) return s + Environment.NewLine + String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Arg_ParamName_Name"), m_paramName); else return s; } } public virtual String ParamName { get { return m_paramName; } } [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)] public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException("info"); } base.GetObjectData(info, context); info.AddValue("ParamName", m_paramName, typeof(String)); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================== ** ** Class: ArgumentException ** ** ** Purpose: Exception class for invalid arguments to a method. ** ** =============================================================================*/ namespace System { using System; using System.Runtime.Remoting; using System.Runtime.Serialization; using System.Globalization; using System.Security.Permissions; // The ArgumentException is thrown when an argument does not meet // the contract of the method. Ideally it should give a meaningful error // message describing what was wrong and which parameter is incorrect. // [System.Runtime.InteropServices.ComVisible(true)] [Serializable()] public class ArgumentException : SystemException, ISerializable { private String m_paramName; // Creates a new ArgumentException with its message // string set to the empty string. public ArgumentException() : base(Environment.GetResourceString("Arg_ArgumentException")) { SetErrorCode(__HResults.COR_E_ARGUMENT); } // Creates a new ArgumentException with its message // string set to message. // public ArgumentException(String message) : base(message) { SetErrorCode(__HResults.COR_E_ARGUMENT); } public ArgumentException(String message, Exception innerException) : base(message, innerException) { SetErrorCode(__HResults.COR_E_ARGUMENT); } public ArgumentException(String message, String paramName, Exception innerException) : base(message, innerException) { m_paramName = paramName; SetErrorCode(__HResults.COR_E_ARGUMENT); } public ArgumentException (String message, String paramName) : base (message) { m_paramName = paramName; SetErrorCode(__HResults.COR_E_ARGUMENT); } protected ArgumentException(SerializationInfo info, StreamingContext context) : base(info, context) { m_paramName = info.GetString("ParamName"); } public override String Message { get { String s = base.Message; if (! ((m_paramName == null) || (m_paramName.Length == 0)) ) return s + Environment.NewLine + String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Arg_ParamName_Name"), m_paramName); else return s; } } public virtual String ParamName { get { return m_paramName; } } [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)] public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException("info"); } base.GetObjectData(info, context); info.AddValue("ParamName", m_paramName, typeof(String)); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AnimatedTypeHelpers.cs
- UserPreferenceChangingEventArgs.cs
- LinqMaximalSubtreeNominator.cs
- DataGridViewRow.cs
- ButtonFieldBase.cs
- CompilerErrorCollection.cs
- SyndicationPerson.cs
- printdlgexmarshaler.cs
- AssemblyCache.cs
- Quad.cs
- PeerDefaultCustomResolverClient.cs
- PersonalizablePropertyEntry.cs
- DataGridViewColumn.cs
- WFItemsToSpacerVisibility.cs
- MergePropertyDescriptor.cs
- WebPartConnectionsEventArgs.cs
- AdornerHitTestResult.cs
- EdmItemCollection.cs
- GeneralTransformGroup.cs
- MulticastNotSupportedException.cs
- HttpProfileGroupBase.cs
- AddToCollection.cs
- UITypeEditor.cs
- IsolatedStorageFile.cs
- StructuredCompositeActivityDesigner.cs
- EventRoute.cs
- DesignerDataSchemaClass.cs
- _UriSyntax.cs
- Operator.cs
- TextFindEngine.cs
- SerializableAuthorizationContext.cs
- ExtractedStateEntry.cs
- AnimationLayer.cs
- AttributeCollection.cs
- Screen.cs
- DesignerToolStripControlHost.cs
- DbConnectionClosed.cs
- DesignerTransactionCloseEvent.cs
- DataIdProcessor.cs
- MexBindingBindingCollectionElement.cs
- ISCIIEncoding.cs
- DropShadowBitmapEffect.cs
- LayoutTable.cs
- XPathException.cs
- GeometryModel3D.cs
- AnimationStorage.cs
- Int64Converter.cs
- EntityViewGenerator.cs
- TraceProvider.cs
- UseManagedPresentationElement.cs
- GPRECTF.cs
- DataServiceQueryProvider.cs
- TypeInitializationException.cs
- GenericIdentity.cs
- ResourceAssociationType.cs
- PrintPreviewDialog.cs
- EncryptedKey.cs
- LayoutTableCell.cs
- InstanceCreationEditor.cs
- Bezier.cs
- RequiredFieldValidator.cs
- InlinedLocationReference.cs
- Clock.cs
- TrackingMemoryStream.cs
- IdleTimeoutMonitor.cs
- SafeCryptoHandles.cs
- CommandPlan.cs
- ConfigPathUtility.cs
- SerTrace.cs
- RemoveStoryboard.cs
- PhysicalAddress.cs
- sqlinternaltransaction.cs
- ProcessManager.cs
- SiteMapDataSourceView.cs
- PreApplicationStartMethodAttribute.cs
- WebExceptionStatus.cs
- OracleInfoMessageEventArgs.cs
- UriExt.cs
- Configuration.cs
- PrePrepareMethodAttribute.cs
- RecommendedAsConfigurableAttribute.cs
- PrimaryKeyTypeConverter.cs
- PhysicalAddress.cs
- AccessControlEntry.cs
- SmtpClient.cs
- SqlGatherProducedAliases.cs
- FormatterServices.cs
- OdbcConnectionString.cs
- RangeValuePatternIdentifiers.cs
- InternalEnumValidatorAttribute.cs
- BooleanAnimationBase.cs
- StringStorage.cs
- SignedXml.cs
- SharedHttpsTransportManager.cs
- TokenBasedSetEnumerator.cs
- ToggleButton.cs
- XmlnsCache.cs
- Base64Decoder.cs
- WindowsBrush.cs
- TdsParserSafeHandles.cs