Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / ServiceModel / Configuration / InternalEnumValidator.cs / 1305376 / InternalEnumValidator.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Configuration { using System; using System.ComponentModel; using System.Configuration; using System.Reflection; using System.ServiceModel.Channels; internal class InternalEnumValidator : ConfigurationValidatorBase { Type enumHelperType; MethodInfo isDefined; public InternalEnumValidator(Type enumHelperType) { this.enumHelperType = enumHelperType; this.isDefined = this.enumHelperType.GetMethod("IsDefined", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); } public override bool CanValidate(Type type) { return (this.isDefined != null); } public override void Validate(object value) { bool retVal = (bool) this.isDefined.Invoke(null, new object[] { value }); if (!retVal) { ParameterInfo[] isDefinedParameters = this.isDefined.GetParameters(); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException("value", (int) value, isDefinedParameters[0].ParameterType)); } } } } // 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
- SQLDateTimeStorage.cs
- TcpTransportElement.cs
- rsa.cs
- StateManagedCollection.cs
- RefreshEventArgs.cs
- PrinterUnitConvert.cs
- AssemblyNameProxy.cs
- AsyncSerializedWorker.cs
- HotSpot.cs
- InvokeHandlers.cs
- CodeBinaryOperatorExpression.cs
- MaskedTextBox.cs
- TdsValueSetter.cs
- ImageInfo.cs
- ParallelDesigner.cs
- ADMembershipProvider.cs
- TraceListeners.cs
- DoubleLinkListEnumerator.cs
- EntitySetBase.cs
- UniqueCodeIdentifierScope.cs
- ForAllOperator.cs
- SqlPersonalizationProvider.cs
- XMLDiffLoader.cs
- WsdlParser.cs
- AudioLevelUpdatedEventArgs.cs
- SupportingTokenSpecification.cs
- TransformProviderWrapper.cs
- WebCategoryAttribute.cs
- SchemaImporterExtensionElementCollection.cs
- RelatedView.cs
- MimeFormReflector.cs
- updatecommandorderer.cs
- TextParagraphCache.cs
- DataPagerFieldItem.cs
- TabItem.cs
- Int64KeyFrameCollection.cs
- XmlSerializerNamespaces.cs
- GatewayDefinition.cs
- TransactionManager.cs
- DataGridHeaderBorder.cs
- Win32.cs
- ReflectionUtil.cs
- TypeGeneratedEventArgs.cs
- Math.cs
- XmlNotation.cs
- InvokeMethodDesigner.xaml.cs
- NeutralResourcesLanguageAttribute.cs
- IsolationInterop.cs
- PageStatePersister.cs
- EventArgs.cs
- DataGridTableStyleMappingNameEditor.cs
- CultureTable.cs
- OleAutBinder.cs
- HtmlProps.cs
- CompilationSection.cs
- PersistChildrenAttribute.cs
- ChooseAction.cs
- ColorConvertedBitmap.cs
- StrokeFIndices.cs
- FixedSchema.cs
- SymLanguageType.cs
- MultiBinding.cs
- XmlDocument.cs
- PersonalizableAttribute.cs
- HashCodeCombiner.cs
- Thread.cs
- HttpListenerRequest.cs
- BindableTemplateBuilder.cs
- ResourceWriter.cs
- ListViewSortEventArgs.cs
- DoubleCollection.cs
- DynamicControlParameter.cs
- SharedPerformanceCounter.cs
- DependencyObjectType.cs
- InstalledVoice.cs
- QilDataSource.cs
- MailMessage.cs
- DataGridTextBoxColumn.cs
- DbProviderManifest.cs
- DesignerEventService.cs
- SqlCommandBuilder.cs
- SignHashRequest.cs
- HashAlgorithm.cs
- ClockGroup.cs
- PatternMatcher.cs
- SortFieldComparer.cs
- Grid.cs
- ExtensionWindow.cs
- MimeMapping.cs
- OciHandle.cs
- ServicePoint.cs
- Rfc4050KeyFormatter.cs
- MobileCapabilities.cs
- ImageBrush.cs
- UInt32Storage.cs
- NullReferenceException.cs
- mediaeventshelper.cs
- UnsafePeerToPeerMethods.cs
- InputProcessorProfiles.cs
- ProjectionAnalyzer.cs