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
- SmtpClient.cs
- CapabilitiesRule.cs
- XmlReflectionMember.cs
- ExpressionBuilder.cs
- EntityType.cs
- HandlerMappingMemo.cs
- TypedDataSourceCodeGenerator.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- Pen.cs
- XmlSchemaSubstitutionGroup.cs
- DataViewManagerListItemTypeDescriptor.cs
- CodeTypeOfExpression.cs
- EmptyReadOnlyDictionaryInternal.cs
- MenuItem.cs
- securitycriticaldata.cs
- DataGridParentRows.cs
- SafeNativeMethods.cs
- MenuItem.cs
- ToolboxBitmapAttribute.cs
- DecoderReplacementFallback.cs
- ThreadStateException.cs
- SpellerHighlightLayer.cs
- CodeCommentStatementCollection.cs
- GrammarBuilderRuleRef.cs
- PageCatalogPart.cs
- SocketInformation.cs
- ColumnCollection.cs
- MailMessage.cs
- EntityDataSourceChangingEventArgs.cs
- ContextMenuAutomationPeer.cs
- StringResourceManager.cs
- WinInetCache.cs
- DataGridViewBand.cs
- VoiceChangeEventArgs.cs
- FixedSOMGroup.cs
- RegexStringValidatorAttribute.cs
- ConditionalWeakTable.cs
- ArcSegment.cs
- EntityDataSourceChangedEventArgs.cs
- AttachInfo.cs
- CodeObjectCreateExpression.cs
- XsltInput.cs
- PrefixQName.cs
- RawAppCommandInputReport.cs
- Track.cs
- DataGridViewCheckBoxColumn.cs
- GeneralTransformCollection.cs
- CallInfo.cs
- SmiContext.cs
- StringFreezingAttribute.cs
- EntityTransaction.cs
- DateTimeConverter.cs
- GPRECT.cs
- LogSwitch.cs
- ExpressionNode.cs
- TypeUtils.cs
- StreamWriter.cs
- Rotation3DAnimation.cs
- GridViewPageEventArgs.cs
- XmlRawWriter.cs
- CodeComment.cs
- RoleManagerEventArgs.cs
- ViewPort3D.cs
- HtmlInputImage.cs
- HtmlMeta.cs
- DataGridViewImageColumn.cs
- SafeEventLogWriteHandle.cs
- CustomTypeDescriptor.cs
- TabRenderer.cs
- BrowserInteropHelper.cs
- TextRunCache.cs
- EntityContainer.cs
- FileInfo.cs
- DateTimeSerializationSection.cs
- DiscardableAttribute.cs
- AttachmentCollection.cs
- Int32Animation.cs
- FileLogRecordHeader.cs
- ConstantCheck.cs
- ToolStripOverflowButton.cs
- OperationCanceledException.cs
- TextClipboardData.cs
- DataViewSettingCollection.cs
- CatalogPartChrome.cs
- AlgoModule.cs
- unsafenativemethodstextservices.cs
- TypeHelper.cs
- FormatControl.cs
- PanelContainerDesigner.cs
- StorageMappingFragment.cs
- PaginationProgressEventArgs.cs
- ConfigurationValue.cs
- NullableDecimalMinMaxAggregationOperator.cs
- ListControl.cs
- CopyEncoder.cs
- NullableDecimalAverageAggregationOperator.cs
- CodeAttributeDeclarationCollection.cs
- EntityException.cs
- UIElementParaClient.cs
- smtpconnection.cs