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
- DockProviderWrapper.cs
- DataTemplate.cs
- DocumentViewerConstants.cs
- XmlNamedNodeMap.cs
- OdbcEnvironmentHandle.cs
- LoginCancelEventArgs.cs
- VariableValue.cs
- mediaclock.cs
- PublisherIdentityPermission.cs
- ComponentCommands.cs
- FixedPage.cs
- MediaContextNotificationWindow.cs
- MiniModule.cs
- PropertyToken.cs
- XmlCharCheckingReader.cs
- CommandManager.cs
- ContentOperations.cs
- CommonRemoteMemoryBlock.cs
- FileAuthorizationModule.cs
- Timer.cs
- Font.cs
- TraceListeners.cs
- x509store.cs
- UInt64Storage.cs
- MetadataArtifactLoader.cs
- SimpleType.cs
- CfgParser.cs
- ObjectItemConventionAssemblyLoader.cs
- DataGridViewColumnCollection.cs
- DesignerSerializationManager.cs
- TextRange.cs
- Int16KeyFrameCollection.cs
- ElementUtil.cs
- MemoryMappedFile.cs
- CollectionViewGroupRoot.cs
- MimeTypePropertyAttribute.cs
- ClipboardProcessor.cs
- SplineKeyFrames.cs
- AtomContentProperty.cs
- util.cs
- GridEntryCollection.cs
- SchemaMapping.cs
- RegexMatchCollection.cs
- BindingGroup.cs
- GeneralTransformGroup.cs
- CategoryAttribute.cs
- DefaultWorkflowTransactionService.cs
- SplitContainer.cs
- FilterException.cs
- HttpServerUtilityWrapper.cs
- HierarchicalDataBoundControl.cs
- MsmqIntegrationOutputChannel.cs
- CriticalExceptions.cs
- HttpServerUtilityWrapper.cs
- QueryCacheKey.cs
- JpegBitmapEncoder.cs
- assertwrapper.cs
- AsyncOperationManager.cs
- PersistencePipeline.cs
- GridEntryCollection.cs
- Pen.cs
- ClientSideProviderDescription.cs
- SurrogateSelector.cs
- Vector.cs
- ToolStripDropDownItem.cs
- SecurityState.cs
- DataTableReader.cs
- WebConfigurationFileMap.cs
- SelectManyQueryOperator.cs
- LockRecursionException.cs
- HandlerBase.cs
- DrawListViewItemEventArgs.cs
- PropertyEmitterBase.cs
- UnitySerializationHolder.cs
- ThumbAutomationPeer.cs
- WebPartsSection.cs
- AppDomainProtocolHandler.cs
- DefaultSettingsSection.cs
- XmlResolver.cs
- AppDomainManager.cs
- TextParagraph.cs
- TopClause.cs
- FilePrompt.cs
- WorkerRequest.cs
- MatrixTransform3D.cs
- MediaCommands.cs
- DbConnectionOptions.cs
- DbConnectionStringBuilder.cs
- ScriptResourceAttribute.cs
- UnsafeNativeMethods.cs
- InputLangChangeRequestEvent.cs
- TypeGeneratedEventArgs.cs
- ConsumerConnectionPoint.cs
- MailAddress.cs
- XsltOutput.cs
- JsonFormatReaderGenerator.cs
- RuntimeResourceSet.cs
- SmtpDigestAuthenticationModule.cs
- TimerElapsedEvenArgs.cs
- Sentence.cs