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
- AsymmetricSignatureFormatter.cs
- ChannelListenerBase.cs
- DependencyObjectPropertyDescriptor.cs
- BoolLiteral.cs
- IRCollection.cs
- Event.cs
- OutOfMemoryException.cs
- WindowsFormsHelpers.cs
- TextServicesDisplayAttribute.cs
- DeclarativeCatalogPart.cs
- SoapIncludeAttribute.cs
- OrderedEnumerableRowCollection.cs
- SingleSelectRootGridEntry.cs
- CssClassPropertyAttribute.cs
- ArgumentException.cs
- BitmapMetadataEnumerator.cs
- ProcessModuleCollection.cs
- RSAPKCS1SignatureFormatter.cs
- SiteMapDataSource.cs
- RSAOAEPKeyExchangeDeformatter.cs
- SectionRecord.cs
- SubclassTypeValidatorAttribute.cs
- CursorEditor.cs
- UnionExpr.cs
- EntityProviderFactory.cs
- SiteMapDataSourceView.cs
- MemberDescriptor.cs
- WindowsTooltip.cs
- ExpressionBinding.cs
- securitymgrsite.cs
- GiveFeedbackEvent.cs
- AttachedPropertyDescriptor.cs
- StringUtil.cs
- InputScopeConverter.cs
- NetCodeGroup.cs
- XmlIlVisitor.cs
- Size3D.cs
- Formatter.cs
- EditorZoneBase.cs
- SelectQueryOperator.cs
- DragCompletedEventArgs.cs
- CapabilitiesPattern.cs
- SemaphoreSecurity.cs
- ValidationError.cs
- DocumentPageViewAutomationPeer.cs
- CookieProtection.cs
- ItemCollection.cs
- WsiProfilesElement.cs
- NetworkInformationPermission.cs
- HttpApplicationFactory.cs
- StyleSheetRefUrlEditor.cs
- HttpProxyCredentialType.cs
- DataGridViewCheckBoxColumn.cs
- ApplicationTrust.cs
- NullEntityWrapper.cs
- ListComponentEditorPage.cs
- SynchronizationFilter.cs
- HitTestParameters3D.cs
- InkCanvasFeedbackAdorner.cs
- SafeEventLogWriteHandle.cs
- EventLogger.cs
- SystemIcons.cs
- EqualityComparer.cs
- ZipIOFileItemStream.cs
- ReferencedType.cs
- DmlSqlGenerator.cs
- ScopelessEnumAttribute.cs
- HandoffBehavior.cs
- FixedSchema.cs
- PrintingPermission.cs
- RegexCaptureCollection.cs
- Journal.cs
- UTF7Encoding.cs
- OleCmdHelper.cs
- FormView.cs
- CacheForPrimitiveTypes.cs
- EventMappingSettings.cs
- ScheduleChanges.cs
- Zone.cs
- DocumentPaginator.cs
- TreeViewCancelEvent.cs
- NestPullup.cs
- EventProperty.cs
- ThemeableAttribute.cs
- SqlPersonalizationProvider.cs
- DataServiceQueryContinuation.cs
- CharUnicodeInfo.cs
- LocalizationComments.cs
- AutomationTextAttribute.cs
- BooleanStorage.cs
- OdbcConnectionOpen.cs
- SqlSupersetValidator.cs
- CodeTypeReference.cs
- SystemIPAddressInformation.cs
- ValidationManager.cs
- HijriCalendar.cs
- Assign.cs
- KeyManager.cs
- ExceptionUtility.cs
- AutoGeneratedFieldProperties.cs