Code:
/ FX-1434 / FX-1434 / 1.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
- PlatformCulture.cs
- TreeNodeBindingCollection.cs
- DataView.cs
- OleDbConnection.cs
- XamlStyleSerializer.cs
- SessionStateModule.cs
- TableItemStyle.cs
- Privilege.cs
- MissingMemberException.cs
- StyleCollection.cs
- StorageSetMapping.cs
- DPTypeDescriptorContext.cs
- PipeConnection.cs
- XmlStringTable.cs
- DataBoundControlHelper.cs
- UriSectionReader.cs
- DesignerAutoFormatStyle.cs
- GridViewEditEventArgs.cs
- SqlXmlStorage.cs
- MessageQueueKey.cs
- BinHexDecoder.cs
- CapabilitiesUse.cs
- TagPrefixInfo.cs
- DoubleAnimationUsingPath.cs
- DataServiceHost.cs
- ReplacementText.cs
- ComNativeDescriptor.cs
- ChtmlCalendarAdapter.cs
- RIPEMD160Managed.cs
- ElementFactory.cs
- PeerNameRecord.cs
- AnimatedTypeHelpers.cs
- DependsOnAttribute.cs
- WebPartMovingEventArgs.cs
- BehaviorEditorPart.cs
- QuerySettings.cs
- XmlNamespaceManager.cs
- RootBrowserWindowProxy.cs
- DatatypeImplementation.cs
- XmlNodeList.cs
- ProxyAttribute.cs
- ToolboxComponentsCreatedEventArgs.cs
- CompositeTypefaceMetrics.cs
- Error.cs
- TemplateApplicationHelper.cs
- WebPartCloseVerb.cs
- DataTable.cs
- CustomPopupPlacement.cs
- WindowsListViewItemCheckBox.cs
- BigInt.cs
- SHA384.cs
- XXXInfos.cs
- _ListenerRequestStream.cs
- Int32.cs
- DataObject.cs
- ServiceNameElement.cs
- AuthenticationManager.cs
- DiagnosticsConfigurationHandler.cs
- Compress.cs
- RadialGradientBrush.cs
- MetadataSet.cs
- WorkflowMarkupSerializationManager.cs
- HandledMouseEvent.cs
- SourceSwitch.cs
- XamlPoint3DCollectionSerializer.cs
- AssemblyBuilder.cs
- Win32PrintDialog.cs
- ViewPort3D.cs
- PrintingPermissionAttribute.cs
- LinqDataSourceDisposeEventArgs.cs
- RequestResizeEvent.cs
- EngineSite.cs
- Pen.cs
- EDesignUtil.cs
- StrokeCollection.cs
- Rethrow.cs
- PopupRootAutomationPeer.cs
- InfoCardTraceRecord.cs
- RadioButtonAutomationPeer.cs
- EntityDataSourceSelectedEventArgs.cs
- TextAutomationPeer.cs
- ManipulationDevice.cs
- CompoundFileReference.cs
- DictationGrammar.cs
- ElementFactory.cs
- ConfigXmlCDataSection.cs
- DateTimeUtil.cs
- LongTypeConverter.cs
- HtmlInputHidden.cs
- Types.cs
- PeerPresenceInfo.cs
- SHA256.cs
- ListItemCollection.cs
- EventsTab.cs
- HtmlControlPersistable.cs
- Properties.cs
- ContactManager.cs
- ItemCheckEvent.cs
- ForceCopyBuildProvider.cs
- ErrorEventArgs.cs