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
- EncodingNLS.cs
- StringInfo.cs
- PasswordPropertyTextAttribute.cs
- GridViewRowCollection.cs
- ObjectStateEntryDbDataRecord.cs
- WindowsGraphicsWrapper.cs
- HtmlLinkAdapter.cs
- DomainUpDown.cs
- MimeObjectFactory.cs
- RegexNode.cs
- ParserOptions.cs
- _OverlappedAsyncResult.cs
- XPathCompileException.cs
- SimpleHandlerFactory.cs
- InfoCardKeyedHashAlgorithm.cs
- UnaryOperationBinder.cs
- NetworkCredential.cs
- ArithmeticLiteral.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- UrlMappingsModule.cs
- CryptoStream.cs
- DeferredReference.cs
- ErrorTableItemStyle.cs
- ZoneIdentityPermission.cs
- UnionExpr.cs
- CodeConstructor.cs
- Tuple.cs
- TypeListConverter.cs
- CellConstantDomain.cs
- VectorAnimation.cs
- WeakEventTable.cs
- XmlSchemaComplexContentExtension.cs
- ArgumentNullException.cs
- DocumentGrid.cs
- ISAPIRuntime.cs
- SystemWebCachingSectionGroup.cs
- XmlText.cs
- CryptoApi.cs
- DataPagerCommandEventArgs.cs
- TemplateColumn.cs
- StrongTypingException.cs
- DataTableMapping.cs
- IgnoreDataMemberAttribute.cs
- WindowsAuthenticationEventArgs.cs
- SimpleModelProvider.cs
- TypeToken.cs
- CodeDirectoryCompiler.cs
- WebReferencesBuildProvider.cs
- XmlHelper.cs
- GenericXmlSecurityToken.cs
- SHA512Cng.cs
- EntityAdapter.cs
- SqlParameter.cs
- Image.cs
- GcHandle.cs
- MenuBindingsEditor.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- OdbcCommand.cs
- BitmapEffectInput.cs
- TextBox.cs
- Compiler.cs
- DefaultPropertyAttribute.cs
- Size.cs
- TypeElementCollection.cs
- ObjectDataSourceView.cs
- OutOfProcStateClientManager.cs
- DataBoundControlDesigner.cs
- TransformCryptoHandle.cs
- ArraySortHelper.cs
- QilGeneratorEnv.cs
- BezierSegment.cs
- DataGridViewRowsRemovedEventArgs.cs
- OleDbParameter.cs
- ProcessStartInfo.cs
- TextServicesManager.cs
- SpecularMaterial.cs
- SmtpTransport.cs
- OleDbError.cs
- SpellerError.cs
- _CacheStreams.cs
- DataBoundControlDesigner.cs
- OrderingExpression.cs
- VirtualDirectoryMappingCollection.cs
- DbCommandDefinition.cs
- ExpressionBindingCollection.cs
- FullTextLine.cs
- DataGridViewRowsRemovedEventArgs.cs
- DrawingContextDrawingContextWalker.cs
- UserControl.cs
- HttpApplicationFactory.cs
- RichTextBoxConstants.cs
- SortDescription.cs
- DependencySource.cs
- GlyphsSerializer.cs
- TraceHandler.cs
- Transform.cs
- HttpProtocolImporter.cs
- HintTextConverter.cs
- OletxDependentTransaction.cs
- ISO2022Encoding.cs