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
- PointF.cs
- MissingMethodException.cs
- CodeLinePragma.cs
- BrushMappingModeValidation.cs
- TriggerAction.cs
- LineInfo.cs
- PeerTransportListenAddressValidator.cs
- HtmlAnchor.cs
- ListParaClient.cs
- SerializationException.cs
- HtmlTitle.cs
- PreviewKeyDownEventArgs.cs
- LinkConverter.cs
- FixedElement.cs
- XmlConvert.cs
- InstallerTypeAttribute.cs
- TargetException.cs
- HttpConfigurationContext.cs
- TagMapCollection.cs
- ExpressionList.cs
- StagingAreaInputItem.cs
- StoreAnnotationsMap.cs
- ParamArrayAttribute.cs
- DrawingImage.cs
- Keywords.cs
- DebugHandleTracker.cs
- XPathEmptyIterator.cs
- HtmlSelectionListAdapter.cs
- CubicEase.cs
- CompilerErrorCollection.cs
- GridViewEditEventArgs.cs
- dbenumerator.cs
- wmiprovider.cs
- TransactionFormatter.cs
- CodeGeneratorAttribute.cs
- UserControl.cs
- GuidTagList.cs
- DesigntimeLicenseContext.cs
- DashStyle.cs
- AppDomain.cs
- NonClientArea.cs
- DateTimeOffsetAdapter.cs
- OrderToken.cs
- TableItemStyle.cs
- DataGridViewCellConverter.cs
- DesignerProperties.cs
- CatalogZone.cs
- WebPartCancelEventArgs.cs
- CodeTypeDeclarationCollection.cs
- HostingEnvironmentWrapper.cs
- SqlSelectStatement.cs
- CancelEventArgs.cs
- CheckBoxField.cs
- ADMembershipProvider.cs
- ClientBuildManager.cs
- CancelRequestedRecord.cs
- TextDecorationCollection.cs
- DWriteFactory.cs
- EntityDataSourceViewSchema.cs
- LocalBuilder.cs
- keycontainerpermission.cs
- PathNode.cs
- ResourceSet.cs
- StructuredCompositeActivityDesigner.cs
- SchemaEntity.cs
- WebPartConnection.cs
- TextFormatterContext.cs
- TypeHelpers.cs
- WebPartVerb.cs
- CommandPlan.cs
- ExcludePathInfo.cs
- ConfigurationSchemaErrors.cs
- Marshal.cs
- TextBoxAutoCompleteSourceConverter.cs
- TemplatePropertyEntry.cs
- DependencyPropertyKind.cs
- PassportAuthentication.cs
- ProfessionalColors.cs
- RowCache.cs
- XmlSchemaSet.cs
- WebBrowser.cs
- HandlerMappingMemo.cs
- XmlAutoDetectWriter.cs
- AttachedPropertyMethodSelector.cs
- GridErrorDlg.cs
- DecimalKeyFrameCollection.cs
- SQLBytes.cs
- EditorBrowsableAttribute.cs
- WebHttpSecurity.cs
- PageCatalogPart.cs
- PersonalizablePropertyEntry.cs
- ButtonAutomationPeer.cs
- TraceSwitch.cs
- UnsettableComboBox.cs
- SortQuery.cs
- DisplayNameAttribute.cs
- ListSourceHelper.cs
- AssemblyBuilder.cs
- ToolStripItem.cs
- EnumBuilder.cs