Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- AuthenticationService.cs
- SettingsBindableAttribute.cs
- TypeBuilder.cs
- BooleanToVisibilityConverter.cs
- RoutedEventValueSerializer.cs
- AppDomainProtocolHandler.cs
- ContentPosition.cs
- DataReceivedEventArgs.cs
- DBSchemaRow.cs
- MailAddressCollection.cs
- DbFunctionCommandTree.cs
- ColorTranslator.cs
- Matrix3D.cs
- AddInAttribute.cs
- HwndTarget.cs
- GlobalEventManager.cs
- DeferrableContent.cs
- ItemContainerGenerator.cs
- RegexCompilationInfo.cs
- QilPatternFactory.cs
- RefreshPropertiesAttribute.cs
- HatchBrush.cs
- IDReferencePropertyAttribute.cs
- EntryWrittenEventArgs.cs
- ProcessMessagesAsyncResult.cs
- StyleSheetRefUrlEditor.cs
- COM2PropertyDescriptor.cs
- ClearTypeHintValidation.cs
- PathStreamGeometryContext.cs
- ProfileInfo.cs
- NamedPipeTransportElement.cs
- DataGridViewLinkCell.cs
- ReadOnlyHierarchicalDataSourceView.cs
- oledbmetadatacolumnnames.cs
- Crypto.cs
- VectorKeyFrameCollection.cs
- controlskin.cs
- EnterpriseServicesHelper.cs
- HttpModulesSection.cs
- DeclaredTypeValidator.cs
- InfiniteIntConverter.cs
- EntityParameterCollection.cs
- mactripleDES.cs
- DataGridViewButtonColumn.cs
- SqlFunctionAttribute.cs
- AnchoredBlock.cs
- DatatypeImplementation.cs
- sqlser.cs
- PageHandlerFactory.cs
- WebPartAddingEventArgs.cs
- StickyNote.cs
- HelpProvider.cs
- ParserExtension.cs
- Component.cs
- XmlAttributeProperties.cs
- TreeNodeEventArgs.cs
- HtmlInputRadioButton.cs
- DataGridViewDesigner.cs
- FastPropertyAccessor.cs
- ScriptControlManager.cs
- NestPullup.cs
- SQLRoleProvider.cs
- Separator.cs
- WebPartCloseVerb.cs
- TraceListener.cs
- HtmlLink.cs
- AppDomainProtocolHandler.cs
- StandardToolWindows.cs
- Item.cs
- URLAttribute.cs
- Metadata.cs
- XmlEntity.cs
- TemplateControlBuildProvider.cs
- XamlReaderHelper.cs
- ExpressionBuilderCollection.cs
- Rectangle.cs
- OptimisticConcurrencyException.cs
- HotSpot.cs
- WebPartCancelEventArgs.cs
- SizeChangedInfo.cs
- RequestBringIntoViewEventArgs.cs
- UncommonField.cs
- SynchronizingStream.cs
- __Filters.cs
- EnvironmentPermission.cs
- UnsafeNativeMethods.cs
- PositiveTimeSpanValidator.cs
- AutomationEventArgs.cs
- SendingRequestEventArgs.cs
- HtmlInputRadioButton.cs
- PropertyValueUIItem.cs
- TypedDataSourceCodeGenerator.cs
- XsdValidatingReader.cs
- GeometryGroup.cs
- OracleParameterCollection.cs
- CopyOnWriteList.cs
- RegisteredArrayDeclaration.cs
- DoubleAnimation.cs
- InputLanguageManager.cs
- ProcessModuleCollection.cs