Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / SubclassTypeValidator.cs / 1305376 / SubclassTypeValidator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Collections.Specialized; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; using System.Text.RegularExpressions; namespace System.Configuration { // This class validates that the value is a subclass of a specified type public sealed class SubclassTypeValidator : ConfigurationValidatorBase { private Type _base; public SubclassTypeValidator(Type baseClass) { if (baseClass == null) { throw new ArgumentNullException("baseClass"); } _base = baseClass; } public override bool CanValidate(Type type) { return (type == typeof(Type)); } public override void Validate(object value) { if (value == null) { return; } // Make a check here since value.GetType() returns RuntimeType rather then Type if (!(value is Type)) { ValidatorUtils.HelperParamValidation(value, typeof(Type)); } if (!_base.IsAssignableFrom((Type)value)) { throw new ArgumentException(SR.GetString(SR.Subclass_validator_error, ((Type)value).FullName, _base.FullName)); } } } } // 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
- BitmapEffectInput.cs
- CompilationUtil.cs
- XPathDescendantIterator.cs
- ControlBuilderAttribute.cs
- XPathDocumentIterator.cs
- _BufferOffsetSize.cs
- storepermissionattribute.cs
- DelegatingTypeDescriptionProvider.cs
- ConfigurationManagerHelper.cs
- WpfSharedBamlSchemaContext.cs
- CodeDesigner.cs
- DetailsViewModeEventArgs.cs
- CfgArc.cs
- ProcessProtocolHandler.cs
- SqlDeflator.cs
- UInt32Storage.cs
- QueryContinueDragEvent.cs
- AffineTransform3D.cs
- OdbcConnectionString.cs
- TrueReadOnlyCollection.cs
- LineServicesRun.cs
- DataTableTypeConverter.cs
- SecurityResources.cs
- NextPreviousPagerField.cs
- DataGridItemCollection.cs
- GroupBoxRenderer.cs
- TaskFormBase.cs
- ConfigurationFileMap.cs
- _NegoState.cs
- safemediahandle.cs
- TCPClient.cs
- ParallelEnumerable.cs
- RangeBaseAutomationPeer.cs
- XmlNamespaceMappingCollection.cs
- UnionCqlBlock.cs
- diagnosticsswitches.cs
- OdbcParameter.cs
- DataGridColumn.cs
- RTLAwareMessageBox.cs
- SimpleHandlerBuildProvider.cs
- SrgsElement.cs
- StructuralObject.cs
- KnownTypes.cs
- UrlEncodedParameterWriter.cs
- ItemMap.cs
- Point3DCollection.cs
- precedingquery.cs
- translator.cs
- XmlToDatasetMap.cs
- SqlReferenceCollection.cs
- SendParametersContent.cs
- ExpressionCopier.cs
- ElementAtQueryOperator.cs
- LocalBuilder.cs
- MatrixTransform.cs
- ResolveNameEventArgs.cs
- Rule.cs
- FixedPageAutomationPeer.cs
- ModulesEntry.cs
- WinFormsUtils.cs
- XmlWriterDelegator.cs
- MsmqOutputChannel.cs
- CaseInsensitiveComparer.cs
- CompositeControlDesigner.cs
- XmlSerializerSection.cs
- _ChunkParse.cs
- Adorner.cs
- HijriCalendar.cs
- JapaneseLunisolarCalendar.cs
- HashHelper.cs
- TextEditorSelection.cs
- NotifyInputEventArgs.cs
- CryptoStream.cs
- Line.cs
- Validator.cs
- ReaderWriterLockSlim.cs
- ExpressionConverter.cs
- ScriptReference.cs
- Version.cs
- SettingsPropertyWrongTypeException.cs
- GCHandleCookieTable.cs
- MsmqHostedTransportManager.cs
- MinimizableAttributeTypeConverter.cs
- DriveNotFoundException.cs
- ProcessThread.cs
- SqlConnectionStringBuilder.cs
- InternalEnumValidatorAttribute.cs
- StyleBamlTreeBuilder.cs
- QuaternionKeyFrameCollection.cs
- PageEventArgs.cs
- AccessibleObject.cs
- DPTypeDescriptorContext.cs
- SimpleApplicationHost.cs
- FormatterServices.cs
- RSAPKCS1KeyExchangeFormatter.cs
- DataConnectionHelper.cs
- CultureInfoConverter.cs
- SingleQueryOperator.cs
- Config.cs
- ObjectDataSourceChooseTypePanel.cs