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
- QueryableDataSource.cs
- KeyConstraint.cs
- OleDbErrorCollection.cs
- BindingValueChangedEventArgs.cs
- VirtualDirectoryMapping.cs
- Menu.cs
- odbcmetadatacollectionnames.cs
- MarkupCompilePass2.cs
- SspiSafeHandles.cs
- FixedSOMTable.cs
- XmlEnumAttribute.cs
- UnsafeNativeMethods.cs
- FontFamilyConverter.cs
- XmlSchemaSimpleContent.cs
- TableTextElementCollectionInternal.cs
- ConfigurationLocation.cs
- MobileCategoryAttribute.cs
- AttributeEmitter.cs
- TextEditorTables.cs
- TagMapInfo.cs
- ToolboxItemLoader.cs
- MimeMultiPart.cs
- BuildProviderUtils.cs
- PropertyRecord.cs
- HttpListenerElement.cs
- TdsParameterSetter.cs
- GroupBox.cs
- XmlNamedNodeMap.cs
- SafeArrayTypeMismatchException.cs
- ProtocolReflector.cs
- ListItemConverter.cs
- HierarchicalDataSourceControl.cs
- _ShellExpression.cs
- EFTableProvider.cs
- ClientCredentials.cs
- WebPartConnection.cs
- TimelineClockCollection.cs
- PrimitiveType.cs
- FilePresentation.cs
- SystemWebSectionGroup.cs
- IIS7WorkerRequest.cs
- RijndaelManaged.cs
- SqlVersion.cs
- XmlSerializationReader.cs
- WindowsRegion.cs
- Lasso.cs
- SecurityManager.cs
- DbTypeMap.cs
- SchemaImporterExtensionElement.cs
- XmlDataSource.cs
- CustomAttribute.cs
- coordinatorfactory.cs
- NetStream.cs
- RedBlackList.cs
- TemplateContentLoader.cs
- XslAst.cs
- TagMapCollection.cs
- ImageDrawing.cs
- ValidationResult.cs
- InvokeSchedule.cs
- XamlFilter.cs
- SqlDataRecord.cs
- XsltContext.cs
- SqlServices.cs
- ListBindableAttribute.cs
- DataServiceException.cs
- BinaryObjectWriter.cs
- SqlInternalConnection.cs
- SelectionManager.cs
- DebugManager.cs
- ListItemConverter.cs
- RenameRuleObjectDialog.cs
- HwndProxyElementProvider.cs
- InkCanvasSelection.cs
- WindowsSysHeader.cs
- StoreItemCollection.cs
- DataSourceCacheDurationConverter.cs
- SelectionChangedEventArgs.cs
- IndentedTextWriter.cs
- AutomationTextAttribute.cs
- DllHostedComPlusServiceHost.cs
- PluralizationService.cs
- ControlIdConverter.cs
- SystemNetHelpers.cs
- BitmapVisualManager.cs
- CodeTypeReferenceExpression.cs
- XmlQueryCardinality.cs
- ArgumentDesigner.xaml.cs
- Hash.cs
- ColorEditor.cs
- Int32Rect.cs
- WebPartConnectionsCancelVerb.cs
- LightweightCodeGenerator.cs
- UpdateTranslator.cs
- SwitchAttribute.cs
- TextServicesHost.cs
- UnsafeNativeMethods.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- ClientScriptItem.cs
- Mapping.cs