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
- DocumentSequenceHighlightLayer.cs
- HighlightComponent.cs
- TextTreeFixupNode.cs
- Pen.cs
- FileChangesMonitor.cs
- XmlProcessingInstruction.cs
- LZCodec.cs
- SecurityPolicySection.cs
- Vector3DKeyFrameCollection.cs
- SystemWebCachingSectionGroup.cs
- UIElementParaClient.cs
- DataGridViewComboBoxColumn.cs
- CodeDOMUtility.cs
- ReadOnlyDataSource.cs
- SystemEvents.cs
- MessageBuffer.cs
- metadatamappinghashervisitor.cs
- Crc32Helper.cs
- ThemeDirectoryCompiler.cs
- Root.cs
- OdbcConnectionPoolProviderInfo.cs
- DBSchemaRow.cs
- RuntimeConfigurationRecord.cs
- WebSysDescriptionAttribute.cs
- ContentFileHelper.cs
- BuildManagerHost.cs
- EastAsianLunisolarCalendar.cs
- MemoryMappedViewStream.cs
- Buffer.cs
- CompilerState.cs
- TraceContextRecord.cs
- wmiutil.cs
- DataControlFieldCell.cs
- Glyph.cs
- ElementHostAutomationPeer.cs
- WebScriptClientGenerator.cs
- AssemblyBuilder.cs
- ServiceNameElementCollection.cs
- KeyValueConfigurationCollection.cs
- mansign.cs
- ModelTreeEnumerator.cs
- ObjectDataSourceFilteringEventArgs.cs
- _BaseOverlappedAsyncResult.cs
- HierarchicalDataBoundControlAdapter.cs
- BitHelper.cs
- SrgsDocumentParser.cs
- CompiledQueryCacheKey.cs
- ArraySubsetEnumerator.cs
- Enum.cs
- ToReply.cs
- DefaultBinder.cs
- Lease.cs
- TrackingRecord.cs
- HwndTarget.cs
- UnmanagedHandle.cs
- AxHost.cs
- OracleMonthSpan.cs
- FrameworkElementFactoryMarkupObject.cs
- DataGridHeaderBorder.cs
- InstanceCollisionException.cs
- WebZone.cs
- HtmlInputReset.cs
- LabelAutomationPeer.cs
- LocatorPart.cs
- DefaultValueTypeConverter.cs
- Adorner.cs
- TransformDescriptor.cs
- PropertyChangingEventArgs.cs
- TdsParserSessionPool.cs
- PageOutputQuality.cs
- TreeNodeCollection.cs
- PrimitiveXmlSerializers.cs
- IImplicitResourceProvider.cs
- DataServiceException.cs
- SamlAssertion.cs
- SmiEventSink_DeferedProcessing.cs
- FusionWrap.cs
- LifetimeServices.cs
- GroupStyle.cs
- assertwrapper.cs
- XmlQueryStaticData.cs
- ContentDisposition.cs
- RemotingException.cs
- RelationshipEnd.cs
- SchemaSetCompiler.cs
- SafePointer.cs
- ValidationResult.cs
- DescendentsWalkerBase.cs
- WsiProfilesElementCollection.cs
- _IPv4Address.cs
- FileSecurity.cs
- IncrementalCompileAnalyzer.cs
- XslCompiledTransform.cs
- RadioButtonAutomationPeer.cs
- _SslStream.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- AccessibleObject.cs
- CommandEventArgs.cs
- RequestCachingSection.cs
- MimeBasePart.cs