Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / ArgumentException.cs / 1305376 / 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; using System.Diagnostics.Contracts; // 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); } [System.Security.SecuritySafeCritical] // auto-generated protected ArgumentException(SerializationInfo info, StreamingContext context) : base(info, context) { m_paramName = info.GetString("ParamName"); } public override String Message { get { String s = base.Message; if (!String.IsNullOrEmpty(m_paramName)) { String resourceString = Environment.GetRuntimeResourceString("Arg_ParamName_Name", m_paramName); return s + Environment.NewLine + resourceString; } else return s; } } public virtual String ParamName { get { return m_paramName; } } [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException("info"); } Contract.EndContractBlock(); 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; using System.Diagnostics.Contracts; // 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); } [System.Security.SecuritySafeCritical] // auto-generated protected ArgumentException(SerializationInfo info, StreamingContext context) : base(info, context) { m_paramName = info.GetString("ParamName"); } public override String Message { get { String s = base.Message; if (!String.IsNullOrEmpty(m_paramName)) { String resourceString = Environment.GetRuntimeResourceString("Arg_ParamName_Name", m_paramName); return s + Environment.NewLine + resourceString; } else return s; } } public virtual String ParamName { get { return m_paramName; } } [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException("info"); } Contract.EndContractBlock(); 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
- XmlTypeMapping.cs
- XmlSchemaSearchPattern.cs
- Size.cs
- Selection.cs
- PostBackTrigger.cs
- LinearGradientBrush.cs
- AsymmetricSignatureDeformatter.cs
- Ref.cs
- EditorZoneBase.cs
- TextServicesCompartment.cs
- GatewayDefinition.cs
- Quaternion.cs
- ComplexLine.cs
- StylusPointPropertyUnit.cs
- HideDisabledControlAdapter.cs
- SecurityRequiresReviewAttribute.cs
- CookieProtection.cs
- TabletCollection.cs
- MimeParameterWriter.cs
- TextContainer.cs
- PagerSettings.cs
- SHA256Managed.cs
- BamlLocalizableResource.cs
- AttachedAnnotation.cs
- BuiltInExpr.cs
- SecurityStateEncoder.cs
- ThreadPool.cs
- RIPEMD160Managed.cs
- MouseBinding.cs
- WebServicesInteroperability.cs
- XmlUtf8RawTextWriter.cs
- SendingRequestEventArgs.cs
- OleDbCommand.cs
- IdentitySection.cs
- UnhandledExceptionEventArgs.cs
- XmlSchemaAny.cs
- FormViewDeleteEventArgs.cs
- RemotingConfiguration.cs
- SimpleRecyclingCache.cs
- TaiwanLunisolarCalendar.cs
- HttpListenerPrefixCollection.cs
- ColorConverter.cs
- ResourceReferenceKeyNotFoundException.cs
- UriSection.cs
- MenuItemStyleCollection.cs
- LogEntryUtils.cs
- ReadWriteControlDesigner.cs
- DesignTimeParseData.cs
- ContentFileHelper.cs
- LayoutTableCell.cs
- BufferManager.cs
- XmlDataSourceView.cs
- HealthMonitoringSectionHelper.cs
- XamlClipboardData.cs
- EUCJPEncoding.cs
- DataGridViewAutoSizeModeEventArgs.cs
- WebPartEditorApplyVerb.cs
- XmlNavigatorStack.cs
- NamespaceDecl.cs
- _RegBlobWebProxyDataBuilder.cs
- ByteStorage.cs
- Msec.cs
- CoTaskMemUnicodeSafeHandle.cs
- SamlAuthenticationStatement.cs
- ImmutableCollection.cs
- LinqDataView.cs
- counter.cs
- RenderingBiasValidation.cs
- SqlBooleanMismatchVisitor.cs
- UnknownWrapper.cs
- RetriableClipboard.cs
- FontWeights.cs
- ContextMenuAutomationPeer.cs
- TemplateControlCodeDomTreeGenerator.cs
- TimeSpanValidatorAttribute.cs
- MetadataCollection.cs
- InvokeAction.cs
- VectorAnimationBase.cs
- InkPresenterAutomationPeer.cs
- DateTimeFormatInfoScanner.cs
- SecurityElement.cs
- AssemblyAttributesGoHere.cs
- StringDictionaryCodeDomSerializer.cs
- BitmapEffect.cs
- MobileRedirect.cs
- ColorContextHelper.cs
- CodeMemberField.cs
- TouchDevice.cs
- FixedSOMFixedBlock.cs
- ReflectionUtil.cs
- DifferencingCollection.cs
- ConnectionOrientedTransportBindingElement.cs
- DisplayNameAttribute.cs
- EntityContainerEmitter.cs
- EventData.cs
- MailAddressCollection.cs
- WindowsScrollBar.cs
- DataSourceControlBuilder.cs
- FixedSOMFixedBlock.cs
- LocalValueEnumerator.cs