Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- CollectionView.cs
- DictionaryContent.cs
- PreviewPageInfo.cs
- Clause.cs
- SelectingProviderEventArgs.cs
- MailWriter.cs
- OneOfConst.cs
- WindowsSolidBrush.cs
- HttpStreamXmlDictionaryReader.cs
- MissingFieldException.cs
- DbConnectionPool.cs
- Context.cs
- DataTemplateKey.cs
- AutomationIdentifier.cs
- DataServiceRequest.cs
- TypedTableHandler.cs
- XmlDataSource.cs
- List.cs
- EngineSiteSapi.cs
- TypeUnloadedException.cs
- WizardPanel.cs
- UTF7Encoding.cs
- GeometryHitTestParameters.cs
- GrammarBuilderBase.cs
- EventLogPermissionAttribute.cs
- NavigationExpr.cs
- ClientBuildManager.cs
- ApplyImportsAction.cs
- QueryComponents.cs
- PrintController.cs
- AutomationPatternInfo.cs
- mda.cs
- WinCategoryAttribute.cs
- ActiveDocumentEvent.cs
- AutomationTextAttribute.cs
- DeferredTextReference.cs
- Item.cs
- SHA512Managed.cs
- RegexStringValidator.cs
- RtfNavigator.cs
- ReflectPropertyDescriptor.cs
- BamlRecords.cs
- HttpApplicationFactory.cs
- ObjectDataSource.cs
- WpfKnownMemberInvoker.cs
- SqlDelegatedTransaction.cs
- WizardStepBase.cs
- FormViewRow.cs
- SelectionItemPattern.cs
- ReachDocumentPageSerializerAsync.cs
- HtmlButton.cs
- IQueryable.cs
- HttpProxyCredentialType.cs
- DataTableExtensions.cs
- WindowsFormsHostPropertyMap.cs
- BaseCAMarshaler.cs
- SHA512.cs
- NativeMethods.cs
- IgnorePropertiesAttribute.cs
- SqlResolver.cs
- RuntimeResourceSet.cs
- ListViewSelectEventArgs.cs
- PasswordTextNavigator.cs
- StatusBar.cs
- ScrollPatternIdentifiers.cs
- SynchronizedCollection.cs
- DataGridViewUtilities.cs
- QuotedPrintableStream.cs
- SmtpMail.cs
- SqlDataSourceEnumerator.cs
- SByteConverter.cs
- HandlerBase.cs
- SubordinateTransaction.cs
- ToolStripItemImageRenderEventArgs.cs
- UniqueConstraint.cs
- ContainerAction.cs
- serverconfig.cs
- ToolboxItemSnapLineBehavior.cs
- EventSetter.cs
- UrlPath.cs
- UriParserTemplates.cs
- MembershipValidatePasswordEventArgs.cs
- MetadataAssemblyHelper.cs
- XmlAutoDetectWriter.cs
- ColumnBinding.cs
- DefaultParameterValueAttribute.cs
- BuildProviderInstallComponent.cs
- DocumentApplicationDocumentViewer.cs
- ECDsa.cs
- NotifyParentPropertyAttribute.cs
- PrintPreviewControl.cs
- LongValidatorAttribute.cs
- RelationshipFixer.cs
- ComplexPropertyEntry.cs
- TTSEvent.cs
- EventManager.cs
- DoubleStorage.cs
- Quaternion.cs
- PrintDialog.cs
- PhysicalFontFamily.cs