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
- InfoCardServiceInstallComponent.cs
- HttpBrowserCapabilitiesWrapper.cs
- AttachedAnnotation.cs
- ProtocolViolationException.cs
- CommandBindingCollection.cs
- ShaderRenderModeValidation.cs
- WebPartManagerInternals.cs
- TextBoxBase.cs
- CalendarTable.cs
- SoapParser.cs
- IIS7WorkerRequest.cs
- cache.cs
- RangeContentEnumerator.cs
- ProvidersHelper.cs
- ChannelManagerService.cs
- PreservationFileReader.cs
- Decoder.cs
- Atom10FormatterFactory.cs
- ToolStripContentPanelDesigner.cs
- SqlFacetAttribute.cs
- ArrayElementGridEntry.cs
- HTMLTextWriter.cs
- GridViewUpdatedEventArgs.cs
- CodeAccessSecurityEngine.cs
- SpecialFolderEnumConverter.cs
- BuildProvider.cs
- ExecutionContext.cs
- MembershipPasswordException.cs
- StreamUpgradeProvider.cs
- TcpConnectionPoolSettingsElement.cs
- Console.cs
- SendMailErrorEventArgs.cs
- ModelItemDictionaryImpl.cs
- XmlName.cs
- ExpressionParser.cs
- TargetException.cs
- SqlBulkCopy.cs
- BrowserCapabilitiesFactory.cs
- InputScopeConverter.cs
- ClientCultureInfo.cs
- AstTree.cs
- ReaderWriterLock.cs
- CqlLexerHelpers.cs
- ParseHttpDate.cs
- SessionStateContainer.cs
- XmlNodeChangedEventManager.cs
- SettingsAttributeDictionary.cs
- MachinePropertyVariants.cs
- Point3DIndependentAnimationStorage.cs
- DCSafeHandle.cs
- FileCodeGroup.cs
- FlowDocumentFormatter.cs
- XmlDataSourceView.cs
- TraceContextEventArgs.cs
- FixedMaxHeap.cs
- SecurityTokenTypes.cs
- ValidationRule.cs
- SqlError.cs
- SizeConverter.cs
- ConstraintConverter.cs
- XmlAttributes.cs
- InvalidOleVariantTypeException.cs
- SqlNotificationRequest.cs
- XmlNodeChangedEventManager.cs
- AbstractSvcMapFileLoader.cs
- HtmlTable.cs
- NativeMethods.cs
- Aes.cs
- ListenerTraceUtility.cs
- SqlAliaser.cs
- InputBinding.cs
- FormViewUpdateEventArgs.cs
- StorageAssociationTypeMapping.cs
- UshortList2.cs
- DependencyStoreSurrogate.cs
- CalendarSelectionChangedEventArgs.cs
- AnnotationHighlightLayer.cs
- TextRange.cs
- DataGridViewCellCancelEventArgs.cs
- SqlParameterizer.cs
- ListViewEditEventArgs.cs
- SafeLocalMemHandle.cs
- WindowsBrush.cs
- MailWebEventProvider.cs
- ChildTable.cs
- ColorPalette.cs
- XPathBinder.cs
- AddingNewEventArgs.cs
- CommentGlyph.cs
- indexingfiltermarshaler.cs
- TransportManager.cs
- FixedTextPointer.cs
- PropertyMappingExceptionEventArgs.cs
- HttpRequestWrapper.cs
- RequestSecurityTokenForGetBrowserToken.cs
- documentation.cs
- Point3DCollection.cs
- RequestCachingSection.cs
- MetadataSource.cs
- WebPartEditVerb.cs