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
- FlowDocument.cs
- MimeImporter.cs
- LocatorPartList.cs
- COM2Enum.cs
- TextBlock.cs
- XmlMembersMapping.cs
- EventData.cs
- CodeAttributeArgument.cs
- CorrelationScope.cs
- CommonGetThemePartSize.cs
- CellTreeNode.cs
- PageThemeCodeDomTreeGenerator.cs
- CodeGenerator.cs
- Stack.cs
- DecoderBestFitFallback.cs
- WindowsSpinner.cs
- DataGridViewImageColumn.cs
- returneventsaver.cs
- XmlUtf8RawTextWriter.cs
- ExtenderProvidedPropertyAttribute.cs
- uribuilder.cs
- HandleRef.cs
- DSASignatureDeformatter.cs
- FillBehavior.cs
- Transform.cs
- MailSettingsSection.cs
- AliasGenerator.cs
- ObjectItemCollection.cs
- Label.cs
- BrowsableAttribute.cs
- sapiproxy.cs
- HandlerBase.cs
- EDesignUtil.cs
- MenuItem.cs
- SafeReversePInvokeHandle.cs
- xml.cs
- XmlReader.cs
- TaskDesigner.cs
- RuntimeHelpers.cs
- ComponentChangedEvent.cs
- VisualStyleTypesAndProperties.cs
- DrawingContextWalker.cs
- ResourceCollectionInfo.cs
- Sentence.cs
- ClientTargetCollection.cs
- ComponentConverter.cs
- SvcMapFileLoader.cs
- StyleCollectionEditor.cs
- Pool.cs
- TextModifierScope.cs
- _ScatterGatherBuffers.cs
- BaseAsyncResult.cs
- ShaderEffect.cs
- SafeHandle.cs
- EnumUnknown.cs
- WinOEToolBoxItem.cs
- SystemInfo.cs
- PrintPageEvent.cs
- EventWaitHandle.cs
- SafeLibraryHandle.cs
- ArrayTypeMismatchException.cs
- XPathSingletonIterator.cs
- ClientCredentials.cs
- VariableAction.cs
- Input.cs
- EnumConverter.cs
- EtwTrace.cs
- TextElementEditingBehaviorAttribute.cs
- DecoderReplacementFallback.cs
- Reference.cs
- CodeObjectCreateExpression.cs
- ResumeStoryboard.cs
- WinCategoryAttribute.cs
- DebugController.cs
- ViewLoader.cs
- MeasurementDCInfo.cs
- Opcode.cs
- ProtocolsConfiguration.cs
- TypedElement.cs
- QilName.cs
- MaterializeFromAtom.cs
- TimeoutTimer.cs
- InputManager.cs
- SQLByte.cs
- DbMetaDataCollectionNames.cs
- CultureInfoConverter.cs
- ItemType.cs
- _LazyAsyncResult.cs
- ImportException.cs
- DataGridViewRow.cs
- DataGridTablesFactory.cs
- ShellProvider.cs
- IisTraceListener.cs
- Collection.cs
- ProfileParameter.cs
- TypeConverter.cs
- DataGridItemCollection.cs
- ApplicationHost.cs
- Pens.cs
- File.cs