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
- PrefixHandle.cs
- FixedSOMTableRow.cs
- DefaultTraceListener.cs
- LoginDesigner.cs
- COM2ColorConverter.cs
- ResourceBinder.cs
- SerializationException.cs
- DeflateStreamAsyncResult.cs
- SuppressMergeCheckAttribute.cs
- HttpMethodAttribute.cs
- ImageEditor.cs
- DataControlFieldTypeEditor.cs
- NetworkInterface.cs
- _Rfc2616CacheValidators.cs
- _BaseOverlappedAsyncResult.cs
- DataSourceControl.cs
- Application.cs
- XD.cs
- CallContext.cs
- SchemaTableColumn.cs
- UserControlBuildProvider.cs
- OleStrCAMarshaler.cs
- ArrayExtension.cs
- CLRBindingWorker.cs
- NetPeerTcpBindingElement.cs
- RequestCache.cs
- MD5Cng.cs
- DataTableReader.cs
- OleDbEnumerator.cs
- Wow64ConfigurationLoader.cs
- FlowPosition.cs
- _HeaderInfoTable.cs
- KeyBinding.cs
- UpdateCommand.cs
- DBSqlParserTableCollection.cs
- SqlTypesSchemaImporter.cs
- TextTabProperties.cs
- MsmqEncryptionAlgorithm.cs
- SpStreamWrapper.cs
- WindowsScroll.cs
- ObjectDataSourceSelectingEventArgs.cs
- ListViewDeletedEventArgs.cs
- EncryptedXml.cs
- BitmapFrameEncode.cs
- _FtpDataStream.cs
- ColorAnimationUsingKeyFrames.cs
- ColorKeyFrameCollection.cs
- StatusBarPanel.cs
- ProjectionAnalyzer.cs
- ProxyWebPartManager.cs
- COM2PictureConverter.cs
- SchemaAttDef.cs
- RotationValidation.cs
- EncodingInfo.cs
- ControlTemplate.cs
- columnmapkeybuilder.cs
- Path.cs
- FixedLineResult.cs
- WaitHandle.cs
- Frame.cs
- DataKeyArray.cs
- Camera.cs
- sqlmetadatafactory.cs
- BevelBitmapEffect.cs
- BamlCollectionHolder.cs
- PostBackOptions.cs
- PerfCounters.cs
- XsltException.cs
- ClientConfigurationHost.cs
- InfoCardSymmetricAlgorithm.cs
- XmlDocumentFragment.cs
- NativeMethods.cs
- XamlPathDataSerializer.cs
- WindowsRichEdit.cs
- AcceptorSessionSymmetricMessageSecurityProtocol.cs
- SelectedGridItemChangedEvent.cs
- PassportAuthenticationModule.cs
- TypedServiceChannelBuilder.cs
- RestClientProxyHandler.cs
- AnnotationComponentManager.cs
- Dynamic.cs
- RegexWorker.cs
- TextDocumentView.cs
- ConfigXmlWhitespace.cs
- ReadContentAsBinaryHelper.cs
- GraphicsState.cs
- ColumnHeader.cs
- MonthCalendar.cs
- RequestResizeEvent.cs
- Parallel.cs
- StylusPointPropertyInfo.cs
- ItemMap.cs
- SrgsItemList.cs
- SynchronousChannel.cs
- FloaterParaClient.cs
- Config.cs
- HitTestParameters3D.cs
- UIElement3D.cs
- EnumerableRowCollection.cs
- AutomationPropertyInfo.cs