Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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)); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // 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)); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CodePrimitiveExpression.cs
- OperationCanceledException.cs
- VariableQuery.cs
- DetailsViewModeEventArgs.cs
- MenuItem.cs
- CustomLineCap.cs
- __ConsoleStream.cs
- AuthenticationConfig.cs
- DBCSCodePageEncoding.cs
- SqlSelectStatement.cs
- XmlSchemaSimpleContent.cs
- ToolStripDropTargetManager.cs
- ProfileBuildProvider.cs
- SqlExpander.cs
- ListSourceHelper.cs
- ErrorFormatter.cs
- DataGridCellsPresenter.cs
- XmlComplianceUtil.cs
- NativeMethodsOther.cs
- Inflater.cs
- PersonalizationProvider.cs
- ArraySegment.cs
- StringToken.cs
- VideoDrawing.cs
- IChannel.cs
- DataGridViewCell.cs
- DesignBinding.cs
- ProxySimple.cs
- UserNameSecurityToken.cs
- PartialTrustVisibleAssembly.cs
- cache.cs
- LambdaCompiler.Expressions.cs
- XPathNavigatorReader.cs
- HttpResponseHeader.cs
- GlobalItem.cs
- Buffer.cs
- ChannelSinkStacks.cs
- ContextMenuAutomationPeer.cs
- Model3DGroup.cs
- MetadataSerializer.cs
- EntityObject.cs
- EncoderNLS.cs
- CompModSwitches.cs
- SegmentInfo.cs
- CompensatableSequenceActivity.cs
- SHA512.cs
- RefreshEventArgs.cs
- XmlUtf8RawTextWriter.cs
- DirectoryInfo.cs
- HtmlElementEventArgs.cs
- WorkItem.cs
- CodeTypeParameter.cs
- QilVisitor.cs
- CodeArrayIndexerExpression.cs
- EventSetter.cs
- StrokeFIndices.cs
- QuaternionIndependentAnimationStorage.cs
- OutputCacheProfile.cs
- ContractValidationHelper.cs
- CategoryGridEntry.cs
- XmlSchemaSimpleTypeList.cs
- PropertyChangedEventManager.cs
- SmtpFailedRecipientsException.cs
- DataTemplate.cs
- NamespaceCollection.cs
- XmlTextReader.cs
- WebPartAuthorizationEventArgs.cs
- RoleGroupCollection.cs
- XmlSchemaSimpleTypeRestriction.cs
- RegexRunner.cs
- EasingFunctionBase.cs
- CodeMemberField.cs
- HelpEvent.cs
- DictionarySectionHandler.cs
- NumericExpr.cs
- DataViewListener.cs
- ISFTagAndGuidCache.cs
- WebPartRestoreVerb.cs
- HtmlContainerControl.cs
- QuaternionValueSerializer.cs
- GeneralTransformGroup.cs
- PolyQuadraticBezierSegment.cs
- DetailsViewInsertedEventArgs.cs
- XpsSerializerWriter.cs
- ProfileSettingsCollection.cs
- RoutedEventConverter.cs
- EntityWrapper.cs
- LogReserveAndAppendState.cs
- EncoderReplacementFallback.cs
- ErrorCodes.cs
- Decimal.cs
- Application.cs
- SafeThemeHandle.cs
- RegularExpressionValidator.cs
- GeometryGroup.cs
- HTTPNotFoundHandler.cs
- EllipseGeometry.cs
- UnsafeNativeMethods.cs
- ApplicationCommands.cs
- TailCallAnalyzer.cs