Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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)); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TypeUnloadedException.cs
- CustomErrorsSection.cs
- PasswordRecovery.cs
- Vector.cs
- WindowsToolbarAsMenu.cs
- WebPartConnectionsCloseVerb.cs
- CompatibleIComparer.cs
- ErrorFormatter.cs
- ListParaClient.cs
- SlipBehavior.cs
- DecimalAnimation.cs
- TextEditorMouse.cs
- Symbol.cs
- SystemIcmpV4Statistics.cs
- CookieHandler.cs
- CharStorage.cs
- SafeRightsManagementEnvironmentHandle.cs
- PropertyGridView.cs
- EntitySetRetriever.cs
- LogExtentCollection.cs
- XmlSchemaComplexContentRestriction.cs
- UnsafeNativeMethods.cs
- SingleStorage.cs
- CounterCreationDataCollection.cs
- baseaxisquery.cs
- DefaultClaimSet.cs
- x509store.cs
- OutputCacheSettingsSection.cs
- FamilyCollection.cs
- InvokeProviderWrapper.cs
- ToolStripTextBox.cs
- StaticFileHandler.cs
- DocumentPageTextView.cs
- ContactManager.cs
- DropDownButton.cs
- DropSource.cs
- ComAdminInterfaces.cs
- DataGridItemCollection.cs
- storepermission.cs
- HtmlInputPassword.cs
- DateRangeEvent.cs
- ResourcesBuildProvider.cs
- HttpRuntimeSection.cs
- ObjectTag.cs
- UnsafeNativeMethods.cs
- SubMenuStyle.cs
- WSHttpBindingBaseElement.cs
- ListViewGroupConverter.cs
- IODescriptionAttribute.cs
- ValidationException.cs
- PersonalizationStateInfo.cs
- BitmapImage.cs
- HyperlinkAutomationPeer.cs
- CodeSnippetStatement.cs
- OptimisticConcurrencyException.cs
- InputMethodStateTypeInfo.cs
- SqlDataSource.cs
- WSSecurityPolicy.cs
- SectionVisual.cs
- PackageRelationshipSelector.cs
- MenuItemStyleCollection.cs
- GestureRecognizer.cs
- ServiceXNameTypeConverter.cs
- SettingsAttributeDictionary.cs
- MapPathBasedVirtualPathProvider.cs
- RotationValidation.cs
- XmlWellformedWriter.cs
- TemplatePartAttribute.cs
- PermissionListSet.cs
- PrintPreviewGraphics.cs
- FlowPosition.cs
- PropertyToken.cs
- SystemIPv6InterfaceProperties.cs
- IndentedWriter.cs
- NavigatorInput.cs
- TagPrefixCollection.cs
- SortKey.cs
- UnknownBitmapEncoder.cs
- basemetadatamappingvisitor.cs
- PropertyItemInternal.cs
- ClientSideQueueItem.cs
- DataControlLinkButton.cs
- IssuedTokenClientBehaviorsElement.cs
- XmlSerializerVersionAttribute.cs
- InstanceDataCollection.cs
- Point.cs
- MethodToken.cs
- SmtpReplyReader.cs
- TextDecorations.cs
- SourceSwitch.cs
- StoreContentChangedEventArgs.cs
- Claim.cs
- GridViewColumnCollectionChangedEventArgs.cs
- ComNativeDescriptor.cs
- COM2IProvidePropertyBuilderHandler.cs
- DataStorage.cs
- ResourcePermissionBase.cs
- QilUnary.cs
- complextypematerializer.cs
- ChangeDirector.cs