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
- CallTemplateAction.cs
- DetailsViewModeEventArgs.cs
- EntityDataSourceDataSelection.cs
- DecoratedNameAttribute.cs
- SecurityDescriptor.cs
- MissingManifestResourceException.cs
- AnnouncementInnerClient11.cs
- TreeNodeCollection.cs
- ConfigXmlWhitespace.cs
- Helpers.cs
- HtmlElementCollection.cs
- QueryCacheManager.cs
- File.cs
- PaintEvent.cs
- AssertFilter.cs
- HiddenFieldPageStatePersister.cs
- ReflectionPermission.cs
- XmlName.cs
- EntityDataSourceConfigureObjectContextPanel.cs
- PageVisual.cs
- GridItemPatternIdentifiers.cs
- MemberProjectionIndex.cs
- DeferredTextReference.cs
- XmlNodeComparer.cs
- WsatRegistrationHeader.cs
- XamlToRtfParser.cs
- ScalarOps.cs
- ObfuscationAttribute.cs
- WebBrowser.cs
- HMACSHA1.cs
- WebPartEventArgs.cs
- IndependentAnimationStorage.cs
- DependencyObjectProvider.cs
- BrowserCapabilitiesFactoryBase.cs
- EditorBrowsableAttribute.cs
- Vector3DCollectionConverter.cs
- FrameworkRichTextComposition.cs
- RawStylusInput.cs
- LinkedList.cs
- DataSourceCache.cs
- TextRangeEditLists.cs
- RawStylusActions.cs
- MsmqTransportReceiveParameters.cs
- PrinterResolution.cs
- DelegateHelpers.Generated.cs
- ObjectComplexPropertyMapping.cs
- XmlUnspecifiedAttribute.cs
- ListenDesigner.cs
- ReferenceEqualityComparer.cs
- OperandQuery.cs
- DetailsViewInsertEventArgs.cs
- RuntimeCompatibilityAttribute.cs
- NotEqual.cs
- FolderLevelBuildProvider.cs
- Pair.cs
- HttpResponseHeader.cs
- ImageEditor.cs
- TabItem.cs
- BindableTemplateBuilder.cs
- GCHandleCookieTable.cs
- DataShape.cs
- TableCell.cs
- SqlDataSourceConnectionPanel.cs
- TypeUsage.cs
- StateMachineExecutionState.cs
- GestureRecognitionResult.cs
- FamilyMapCollection.cs
- XmlSchemaImport.cs
- ToolboxItem.cs
- ParamArrayAttribute.cs
- WizardSideBarListControlItem.cs
- PieceDirectory.cs
- DBSqlParser.cs
- Keyboard.cs
- ContextActivityUtils.cs
- Identity.cs
- EventLogInformation.cs
- GridEntry.cs
- TypeSystem.cs
- ConstructorNeedsTagAttribute.cs
- AmbientValueAttribute.cs
- WorkflowMarkupSerializationManager.cs
- MaskInputRejectedEventArgs.cs
- GridViewDeletedEventArgs.cs
- PrintController.cs
- AssemblyName.cs
- SoapWriter.cs
- LineBreak.cs
- CryptoKeySecurity.cs
- RouteItem.cs
- DataServiceRequestOfT.cs
- ApplicationId.cs
- PointCollectionConverter.cs
- StackSpiller.Generated.cs
- KeyValueSerializer.cs
- ClassValidator.cs
- AppDomainGrammarProxy.cs
- ReferenceSchema.cs
- CuspData.cs
- TableRow.cs