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
- SqlCommand.cs
- Vector3D.cs
- DocumentReferenceCollection.cs
- SchemaMerger.cs
- XmlLanguage.cs
- TypeSemantics.cs
- LOSFormatter.cs
- ExpandCollapsePattern.cs
- StateMachineAction.cs
- XamlStyleSerializer.cs
- RequestUriProcessor.cs
- Compilation.cs
- ButtonBaseAdapter.cs
- Update.cs
- ProcessModule.cs
- ToolStripLocationCancelEventArgs.cs
- RelationshipEnd.cs
- AutoGeneratedField.cs
- SiteMapSection.cs
- PropertyTab.cs
- ExpressionReplacer.cs
- RegexGroupCollection.cs
- AdornerDecorator.cs
- NativeMethods.cs
- IfJoinedCondition.cs
- SqlUserDefinedTypeAttribute.cs
- HtmlTableRowCollection.cs
- Ops.cs
- WindowsEditBox.cs
- StaticContext.cs
- StructuralObject.cs
- PeerCustomResolverBindingElement.cs
- TransactionInformation.cs
- ThreadSafeList.cs
- KerberosTicketHashIdentifierClause.cs
- TypeToken.cs
- CachedFontFamily.cs
- TraceHelpers.cs
- ConfigurationValidatorAttribute.cs
- DrawingImage.cs
- HtmlContainerControl.cs
- UnknownBitmapEncoder.cs
- CultureMapper.cs
- ScrollableControlDesigner.cs
- RowParagraph.cs
- MethodCallTranslator.cs
- TextViewElement.cs
- ListDictionaryInternal.cs
- CounterSet.cs
- InkPresenterAutomationPeer.cs
- ArrayWithOffset.cs
- SqlNode.cs
- SharedPerformanceCounter.cs
- DbResourceAllocator.cs
- SqlErrorCollection.cs
- WebPartEditVerb.cs
- SynchronizationValidator.cs
- OperationCanceledException.cs
- EntityClassGenerator.cs
- RectangleF.cs
- ReferencedAssembly.cs
- ZipPackage.cs
- FontStretches.cs
- ContainerSelectorActiveEvent.cs
- XmlArrayItemAttributes.cs
- XmlDataLoader.cs
- XmlQueryTypeFactory.cs
- ReturnValue.cs
- AnnotationHighlightLayer.cs
- ExpressionTextBox.xaml.cs
- SafeBitVector32.cs
- TrustLevel.cs
- StorageInfo.cs
- ProviderCollection.cs
- PictureBox.cs
- DbExpressionVisitor.cs
- DataObjectEventArgs.cs
- KnownColorTable.cs
- XslCompiledTransform.cs
- CalendarDateRange.cs
- ServicePointManager.cs
- NavigatorInvalidBodyAccessException.cs
- FontNamesConverter.cs
- Error.cs
- SortKey.cs
- DataControlCommands.cs
- Exceptions.cs
- ImageAnimator.cs
- ColorInterpolationModeValidation.cs
- EntityCollection.cs
- IsolationInterop.cs
- ContractUtils.cs
- WebPartEditorApplyVerb.cs
- DecoratedNameAttribute.cs
- XMLSchema.cs
- DATA_BLOB.cs
- CacheRequest.cs
- Point3D.cs
- NativeMethods.cs
- SecurityRuntime.cs