Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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));
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FunctionImportMapping.cs
- XmlnsDictionary.cs
- CmsInterop.cs
- MD5.cs
- FormViewCommandEventArgs.cs
- ExtenderControl.cs
- SQLMembershipProvider.cs
- ThreadStartException.cs
- DBAsyncResult.cs
- BigInt.cs
- ChineseLunisolarCalendar.cs
- ImportCatalogPart.cs
- TouchPoint.cs
- Classification.cs
- SiblingIterators.cs
- TimeoutHelper.cs
- ThreadInterruptedException.cs
- ParsedAttributeCollection.cs
- ZipPackage.cs
- DesignerProperties.cs
- AnnotationResourceCollection.cs
- WebSysDefaultValueAttribute.cs
- LocalizedNameDescriptionPair.cs
- AjaxFrameworkAssemblyAttribute.cs
- documentsequencetextcontainer.cs
- XmlDataDocument.cs
- HttpListenerRequest.cs
- FlowDocumentFormatter.cs
- DocumentsTrace.cs
- SafeArchiveContext.cs
- DataSourceExpression.cs
- Membership.cs
- MemberAccessException.cs
- LeaseManager.cs
- WindowsSpinner.cs
- ConstraintConverter.cs
- LockCookie.cs
- UIAgentAsyncBeginRequest.cs
- TransformPattern.cs
- ResXBuildProvider.cs
- SessionPageStatePersister.cs
- WorkflowMarkupElementEventArgs.cs
- EmbeddedMailObject.cs
- ControlBuilder.cs
- DrawTreeNodeEventArgs.cs
- WorkflowViewService.cs
- ConfigurationStrings.cs
- ColumnHeader.cs
- ErrorTableItemStyle.cs
- Composition.cs
- SkewTransform.cs
- InputLanguageProfileNotifySink.cs
- unsafenativemethodsother.cs
- DataAdapter.cs
- Timer.cs
- MetadataArtifactLoaderComposite.cs
- SQLGuidStorage.cs
- TypedReference.cs
- MenuItemCollection.cs
- ApplicationSecurityInfo.cs
- UnsafeNativeMethodsPenimc.cs
- SeverityFilter.cs
- XmlSchemaComplexContent.cs
- XmlSchemaSimpleType.cs
- Bidi.cs
- SplitterDesigner.cs
- SqlCacheDependency.cs
- SqlCharStream.cs
- ProgressBar.cs
- SystemSounds.cs
- StringSorter.cs
- UnmanagedMemoryStreamWrapper.cs
- X509SecurityToken.cs
- OpacityConverter.cs
- LockRenewalTask.cs
- SystemKeyConverter.cs
- FileDataSource.cs
- SpellerStatusTable.cs
- TableParagraph.cs
- ErrorTableItemStyle.cs
- WebPartConnectionsConfigureVerb.cs
- FormsAuthenticationCredentials.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- Matrix.cs
- BackStopAuthenticationModule.cs
- ObjRef.cs
- XPathAncestorIterator.cs
- CodeGeneratorOptions.cs
- PagerSettings.cs
- IntegerValidator.cs
- MDIClient.cs
- HtmlTitle.cs
- XslAst.cs
- Visual3DCollection.cs
- BaseTreeIterator.cs
- ElementInit.cs
- BamlLocalizer.cs
- TransactionFlowBindingElementImporter.cs
- safesecurityhelperavalon.cs
- BitmapCodecInfoInternal.cs