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
- WebPartsPersonalizationAuthorization.cs
- RoleManagerSection.cs
- Pen.cs
- TabControlCancelEvent.cs
- IndexedGlyphRun.cs
- Binding.cs
- MemberHolder.cs
- RectangleF.cs
- TextInfo.cs
- LinqExpressionNormalizer.cs
- XmlSchemaValidationException.cs
- linebase.cs
- SoapWriter.cs
- TransactionsSectionGroup.cs
- Int16Animation.cs
- NativeMethods.cs
- NodeInfo.cs
- WindowsPen.cs
- SamlSecurityTokenAuthenticator.cs
- ScopelessEnumAttribute.cs
- TextParagraphView.cs
- RectKeyFrameCollection.cs
- ProjectionPlanCompiler.cs
- DSASignatureDeformatter.cs
- _PooledStream.cs
- PeerPresenceInfo.cs
- ProcessModuleCollection.cs
- InternalConfigHost.cs
- AdditionalEntityFunctions.cs
- GeneralTransform.cs
- StateManagedCollection.cs
- GridView.cs
- CachedTypeface.cs
- CryptoApi.cs
- WebHttpSecurityModeHelper.cs
- BindingsCollection.cs
- DataComponentNameHandler.cs
- SendMailErrorEventArgs.cs
- Missing.cs
- EmissiveMaterial.cs
- ControlTemplate.cs
- ServiceProviders.cs
- ObjectViewFactory.cs
- SecurityPolicySection.cs
- TypeDescriptor.cs
- FileDialog.cs
- ZipIORawDataFileBlock.cs
- DesignerSerializationOptionsAttribute.cs
- ConditionalAttribute.cs
- DataGridViewSelectedRowCollection.cs
- PathSegment.cs
- BoundingRectTracker.cs
- ProxyAttribute.cs
- AutomationPatternInfo.cs
- CombinedGeometry.cs
- RequestQueue.cs
- VectorValueSerializer.cs
- TextParagraphView.cs
- XmlText.cs
- KeyNotFoundException.cs
- Logging.cs
- Rect.cs
- OSFeature.cs
- FigureHelper.cs
- MonikerProxyAttribute.cs
- OutputScopeManager.cs
- SmtpNegotiateAuthenticationModule.cs
- PrimitiveXmlSerializers.cs
- SoapUnknownHeader.cs
- ServiceDurableInstanceContextProvider.cs
- TemplateBuilder.cs
- SettingsPropertyWrongTypeException.cs
- CodeDomDecompiler.cs
- TreeNodeClickEventArgs.cs
- GradientBrush.cs
- ChooseAction.cs
- ProtocolsSection.cs
- GridViewDeletedEventArgs.cs
- DecimalConstantAttribute.cs
- LowerCaseStringConverter.cs
- ProxyWebPartManager.cs
- ConsoleTraceListener.cs
- NetPeerTcpBindingElement.cs
- InputLangChangeRequestEvent.cs
- BindingWorker.cs
- KeyedHashAlgorithm.cs
- TrackingAnnotationCollection.cs
- HttpStreamXmlDictionaryWriter.cs
- RemotingException.cs
- ListBoxItemAutomationPeer.cs
- UICuesEvent.cs
- GridItemCollection.cs
- UnsignedPublishLicense.cs
- SqlDataSourceSelectingEventArgs.cs
- PostBackOptions.cs
- BitmapSizeOptions.cs
- CollectionView.cs
- BuildProvider.cs
- ResXResourceWriter.cs
- ObjectMemberMapping.cs